Marketplace has launched, further enabling blockchain developers! Learn more

How to access Ethereum Mempool

September 15, 2022


On Ethereum, when a transaction is sent, before being added to a block, it resides in what is called a Mempool. To receive information about this transaction, the Mempool must be queried. This guide will demonstrate how to query a node’s mempool using QuickNode Ethereum nodes.

What is Ethereum Mempool?

In blockchain terminology, a mempool is a waiting area for the transactions that haven't been added to a block and are still unconfirmed. This is how a Blockchain node deals with transactions that have not yet been included in a block.

When an Ethereum node receives a transaction, it will propagate the transaction to peer nodes until a miner approves the transaction and adds it to a new block. Before it’s added to the next block, the transaction remains in a staging/waiting area called mempool or txpool. It is also known as “pending transactions” to some people.

This waiting area or buffer zone functionality is needed because transactions aren't immediately added to the Blockchain. Nodes also run a series of validity checks on these transactions. These checks include ensuring that the funds are still available, the output is not exceeding the input, the signature is valid, etc. The transaction is rejected if it fails any of these tests. Note that the Mempool cannot be considered as a master reference shared universally by all nodes. Each node configures its own rules for the node’s mempool. Additionally, a node may be the first to receive a transaction but may not have propagated the transaction to the rest of the network.

For example, the default settings for slots and memory on Geth and OpenEthereum dictate their behavior with mempool transactions. When a new pending transaction is allowed into the mempool, but all the node spaces are full -- the transaction with the lowest gas fee will be dropped from the pool. The rules for accepting and dropping transactions vary for different nodes and depend on their settings.

Even the term itself differs depending on clients:

However, “mempool” is a widely used and accepted term.

What is the use of Ethereum Mempool?
As stated above, transactions need to be stored before they are confirmed and picked up by a miner. Usually, the transactions with lower gas prices spend more time in a mempool. Such transactions may be overwritten with replacement transactions (commonly known as 'cancel and speed up transaction'). One of the most prominent uses of the Mempool is to get pending transactions. Here’s why you may want to do that:

  • In Trading, to obtain trading prices on DEX like Uniswap, Balancer, etc.
  • To analyze the gas prices and adjust the transaction price to avoid getting dropped.
  • To analyze and simulate pending transactions, which can help reduce rejection rates.

Let’s get started!

Booting our Ethereum node

For the purpose of this guide, any Ethereum client can be used, such as Geth or OpenEthereum (fka Parity). To boot a new Ethereum node - first, select a client and configure it. Note that syncing and maintaining an Ethereum node is a challenging task and could take days.

To make things easy, we'll grab a node from QuickNode, which is a lot easier to set up. After a QuikNode Ethereum node is up, copy your HTTP Provider endpoint: 

This guide uses an OpenEthereum (Parity) node and Geth node to illustrate the difference between their Mempool approach. But, we can use pretty much any node from QuikNode API plans to access TX-QUEUE and TX-POOL content.

Screenshot of Ethereum Endpoint

Copy and save your HTTP provider endpoint.

How to access and query Ethereum Mempool with QuickNode?

First, query the OpenEthereum node's Mempool. OpenEthereum calls its mempool a Transaction Queue or TX-QUEUE. An OpenEthereum client listens to the network for transactions to include in the blocks (if mining/validating) or for transaction broadcasting. These transactions (emitted locally or externally) are verified and ordered into a transaction queue. 

Make a cURL request to the transaction queue/mempool of your node:

how to access and query ethereum mempool with quicknode

$ curl --data '{"method":"parity_pendingTransactions","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST ADD_YOUR_ETHEREUM_NODE_URL

Replace `ADD_YOUR_ETHEREUM_NODE_URL` with the HTTP provider you saved earlier.

The above command is making a cURL JSON-RPC request to your node's transaction queue/mempool.

The `parity_pendingTransactions` method returns the pending transactions. In the params section, the number of transactions to return is set with the `limit` parameter. Transactions can also be filtered based on the `to` and `from` address, gas, gasPrice, value, and nonce.

A successful output should look like this (a single transaction is highlighted):

The output contains the stream of transactions arranged by priority. Each transaction includes the hash, nonce, block hash, block number, value, gas price, gas, raw transaction data, `to` and `from` address, public key, chain id, etc.

The other txqueue methods are `parity_localTransactions,` which returns 25 local transactions that may be mined, pending, or dropped, and `parity_allTransactions` to return the transactions to be processed in the future as well as dropped transactions.

To query a Geth node's Mempool or TX-POOL or Transaction Pool

Make a cURL request to the transaction pool/mempool of your node:

how to access and query ethereum mempool with quicknode

$ curl --data '{"method":"txpool_content","id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST ADD_YOUR_ETHEREUM_NODE_URL

Replace `ADD_YOUR_ETHEREUM_NODE_URL` with the HTTP provider you saved earlier.

This will make a cURL JSON-RPC request to your Geth node's transaction pool/mempool by using the `txpool_content` method, which will return the pending transactions and those queued for future execution. The output stream will have two fields: pending and queued.

A successful output should look like this (a single transaction is highlighted):

This output features the same elements as in the previous example.

The other txpool methods are `txpool_inspect,` which returns a listed summary of pending transactions in text form for a quick view, and `txpool_status,` which returns the current number of pending and queued transactions.

Querying with Web3

Let’s examine how to subscribe to pending transactions from the mempool using Web3.js. 

  • NodeJS installed on your system.
  • A text editor
  • CLI

Check our guide on 'How to connect to Ethereum network with Web3.js' to learn how to install and work with the Web3.js library.

Step 1.
Install web3.js by executing the following command: 

querying with web3

$ npm install web3

Step 2.
Now, create a text script file and call it index.js

querying with web3

var Web3 = require("web3");

var options = {
  timeout: 30000,
  clientConfig: {
    maxReceivedFrameSize: 100000000,
    maxReceivedMessageSize: 100000000,
  reconnect: {
    auto: true,
    delay: 5000,
    maxAttempts: 15,
    onTimeout: false,

var web3 = new Web3(new Web3.providers.WebsocketProvider(url, options));
const subscription = web3.eth.subscribe("pendingTransactions", (err, res) => {
  if (err) console.error(err);

var init = function () {
  subscription.on("data", (txHash) => {
    setTimeout(async () => {
      try {
        let tx = await web3.eth.getTransaction(txHash);
      } catch (err) {


Explanation of the code above:

Line 1-2: Importing the web3 library, and adding QuickNode's wss URL to the variable url.

Line 4-16: Adding a reconnect logic, so that if the connection is dropped for some reason the script will reattempt to establish a connection.

Line 18-21: Instantiating a WebSocketProvider instance, and assigning it to the web3 variable, subscribing to pending transactions. 

Line 23-34: Getting the transaction body by hash, and printing the transactions. 

When we run this file, it should output a stream of pending transactions currently in the mempool.

querying with web3

$ node index

This can be useful for mempool tracking, tracking specific transactions, trading bots, and much more.


This short guide showed you how to easily query a mempool of an Ethereum node using QuikNode as an example. Understanding pending (in-flight) transactions provide valuable insights into your (& others’)  transactions, so you can make valuable adjustments.

Further reading: How to stream pending transactions with ethers.js

Subscribe to our newsletter for more articles and guide on Ethereum. If you have any feedback, please feel free to reach out to us via Twitter, and you can always chat with us if you have a question via our community server on Discord; thanks :)

Related articles 35

How to do a non-custodial transaction with QuickNode
Originally Published On: Jun 19, 2021
Updated On: Sep 9, 2022

Private keys are one of the most... A non-custodial wallet is a... Custodian of Private... At We could use pretty much any... We could use any of the many... Let us create a token transfer... Congratulations on making a...

Continue reading
How to Set Up a Near Project from Scratch
Originally Published On: Jan 27, 2022
Updated On: Sep 9, 2022

In this tutorial we will look at... In this section, we will... In this section, we will look at... In this section, we will look at... When writing smart contracts on... In the last section, we looked... In the last section, we looked... In the last section, we looked... We have finally come to the end...

Continue reading
Estimating gas price using pending transactions in Python
Originally Published On: Feb 20, 2021
Updated On: Sep 9, 2022

To send a transaction on the... Gas is the unit to measure the... Why do we want to estimate gas?... Our first step here would be to... For our purposes today, we could... The first thing we’re going to... Now you know how to estimate gas...

Continue reading
Como crear y lanzar un ERC-721 (NFT)
Originally Published On: Dec 27, 2021
Updated On: Sep 9, 2022

Coleccionables digitales que son... Fungible significa que es lo... ERC es la abreviación para... Ahora que conocemos qué es y... Antes de escribir nuestro... Felicidades por crear tu propio...

Continue reading
How to Access Bitcoin Mempool
Originally Published On: Aug 16, 2021
Updated On: Sep 21, 2022

Bitcoin is the father of... The transactions which are sent... For our purpose today, we need a... We will use Bitcoin RPC methods... Congratulations on mastering the...

Continue reading
How to Mint an NFT on Polygon with Ethers.js
Originally Published On: Mar 28, 2022
Updated On: Sep 9, 2022

This guide demonstrates how to... Ethers.js is a complete Ethereum... As a reminder, the act of... We will deploy our contract on... Time to write the code! Start by... Note, you will need some... That’s it! You have minted an...

Continue reading
The Web3 Developer Stack
Originally Published On: Jul 3, 2021
Updated On: Sep 15, 2022

A developer stack is a bag of... If we can imagine web3 as a car... The Chainlink price feed... Head over to the We’ll need a Kovan node to... We’ll now write a short... Congratulations :D You’ve taken...

Continue reading
How to Mint NFTs on the Stacks Blockchain
Originally Published On: Aug 19, 2022
Updated On: Sep 9, 2022

Stacks is an emerging blockchain... The Stacks ecosystem has adopted... Open up a terminal window and... Implementing the SIP-009... This section will demonstrate... The moment you've been waiting... Awesome Work! You’ve learned how...

Continue reading
Introduction to Scaffold-ETH 🏗
Originally Published On: Oct 7, 2021
Updated On: Sep 9, 2022

Developing applications involves... First of all, before getting... Scaffold-ETH comes with a demo... We will set up a QuickNode... Congratulations, and thank you...

Continue reading
How to connect to Ethereum using PHP
Originally Published On: Jun 11, 2021
Updated On: Sep 9, 2022

PHP is a very popular choice... Before installing the web3.php,... We could use pretty much any... Now, make a PHP script file... Congratulations on connecting to...

Continue reading
How to use Subspace with QuickNode
Originally Published On: Sep 8, 2020
Updated On: Sep 9, 2022

In this guide, we'll understand... To install Subspace, we'll need... For our purposes today, we could... Now let's create a short script,... Run the file using the node...

Continue reading
How to Connect Your Dapp With MetaMask Using Ethers.js
Originally Published On: Dec 13, 2021
Updated On: Sep 9, 2022

In our dApp, we will have a... A dApp is an application that... We will need to install the... Ethers.js is a lightweight... With this application, we will... Next, we will create a function... After connecting to MetaMask, we... To handle the wallet address of... This section will show us how to... In this tutorial, we...

Continue reading
How to Lazy Mint an NFT on Rarible with Rarepress
Originally Published On: Feb 23, 2022
Updated On: Sep 9, 2022

NFTs are great for creators to... To mint an NFT, you write data... Lazy Minting is a process in... We will write some JavaScript... Rarepress interacts with the... Now that we have everything in... Congratulations on listing your...

Continue reading
How to get the balance of an ERC-20 token
Originally Published On: Jun 14, 2021
Updated On: Sep 21, 2022

When a new token is made on the... You could use any Ethereum... Now that you've done the legwork... Getting the ERC20-Token Balance... In the top of your... ABI is short for You will most likely interact... You can use a similar process... We now have a connection to an... Having made it to the end, you...

Continue reading