What is a mempool?
The mempool, short for the “memory pool,” serves as a holding area for yet-to-be-confirmed transactions within a blockchain ecosystem. In the case of the Ethereum ecosystem, after a node receives a transaction, it stores it in the mempool, validates it, and then broadcasts it to other nodes on the network. While a transaction is in the mempool, a block builder observes the transactions, organizes them to capture the most MEV, and then sends the just-built block to a block proposer. A block with the most value included will be put on chain. A new block is created every 12 seconds on Ethereum.
Mempool in DeFi Algo Trading
Based on “pending” mempool transactions, traders develop trading algorithms that monitor and identify trading opportunities on pending but highly probable transactions before they are included in the block. The capability to trade and position yourself ahead of time with the help of mempool monitoring tools has been widely adopted. It is vastly used by various market actors pursuing lucrative trading opportunities.
How does mempool operate?
Users initiate transactions from their wallets. Transactions are added to the mempool as they are broadcasted. Then, these transactions are removed from the mempool after being included in blocks landing on a chain. The size of the mempool can vary depending on the network's traffic. There is no universal mempool since each node has its own mempool depending upon the transactions they receive and originate.
Mempool on Ethereum
The gateway to Ethereum’s blockchain is the mempoo. After user submission, transactions are not immediately put on the Ethereum blockchain. Instead, they go through a series of validations. Only after these validations are successfully passed and the gas value of the transaction is sufficient enough for it to execute the transaction is removed from the mempool and added to a newly created block.
Why is the mempool important in DeFi trading?
The mempool plays a pivotal role in DeFi trading, and it stems from several factors:
- Transaction Speed and Efficiency:
In DeFi trading, speed is of the essence. In general, traders need to be the first ones to see the transactions in the mempool to be able to capture the opportunities.
DeFi traders can become aware of opportunities faster by observing mempool data in real-time. This allows traders to make predictions on future state changes in the blockchain and create their own transactions to take advantage of those state changes.
- Arbitrage Opportunities: DeFi traders often engage in arbitrage, exploiting price discrepancies across various decentralized (DEXs) and centralized (CEXs) exchanges to make profits. By monitoring the mempool, DeFi traders can view these price inefficiencies as well as price differences that are yet to occur.
- Transaction Cost Optimization: In DeFi, transaction costs are primarily determined by gas fees in EVM-compatible networks. By carefully watching transactions in the mempool and accurately selecting gas prices, traders can minimize transaction costs and increase their overall profitability.
- Vulnerability to Front-Running: Front-running refers to the trading strategy where traders utilize their knowledge of pending transactions to execute trades in front of other pending TXs.
bloXroute Mempool Services
- Fastest mempool data: bloXroute provides a variety of mempool services for all market actors, including searchers, traders, and market makers. As a leading ultra-low latency mempool data provider, bloXroute offers several tiers designed to be sufficient for beginning traders and prograde institutional trading desks. Read more about BDN plans.
- Protect RPCs: bloXroute enables immediate frontrunning and sandwich attack protection for all users for free. You can find information on how to connect and use the RPC Protect suite in our GitBook.
Below, we have outlined the most important endpoints you can interact with:
- newTxs and pendingTxs - Stream of all new transactions as they are propagated in the BDN and stream of all new transactions as they enter the Ethereum/BSC/Polygon transaction pool.
- internalTxsMempool - Feed of internal transactions pending in the mempool.
- newBlocks - Stream of new blocks as they are propagated in the BDN.
- transactionStatus - Stream that shows the real-time status of transactions as they propagate throughout the Ethereum network.
- bdnBlocks - Faster stream of newBlocks as they are propagated in the BDN, but executed with fewer validation checks, hence may not land on chain sometimes
- MEVNextProposerInfo - Provides details of the next Ethereum block proposer, allowing searchers to know if the proposer is registered with an MEV relay service.
- arbOnlyMEV - Stream of private transactions that are available for arbitrage opportunities where the searcher shares the profit with the transaction sender, validator, and bloXroute. Only available on special Cloud API instances.
- MEVBlockValue - Provides information on the block at the next slot number, allowing block builders to know the latest best block received by an MEV relay.