Mempool Propagation
The mempool is a critical component in the transaction lifecycle of Celestium. It acts as a staging area for transactions that have been submitted by users but are not yet included in a block. The propagation of transactions through the mempool ensures that validators and other nodes in the network are aware of pending transactions, enabling their eventual inclusion in the blockchain.
Understanding mempool propagation is essential for developers and node operators to grasp how transactions move across the network before finalization.
1. What is the Mempool?
The mempool is a temporary, in-memory data structure maintained by Celestium nodes. It holds transactions that have been:
Validated locally by the submitting node.
Not yet included in a finalized block.
Nodes continuously share their mempool content with peers to ensure network-wide transaction visibility.
2. Transaction Validation Before Mempool Admission
Upon receiving a transaction, a Celestium node performs several validation checks before adding it to the mempool:
Balance Check: The account must have a sufficient available balance to cover
value + gasLimit * maxFeePerGas
.Nonce Check: The nonce must be sequential according to the account’s transaction history.
Signature Verification: The transaction’s signature must be valid.
Gas Price Check: The gas price must meet the minimum network requirement.
Transactions that fail any of these checks are rejected and not propagated.
3. Propagation Across Peers
Once a transaction passes validation and is added to the mempool, it is propagated to peer nodes:
The node broadcasts the transaction hash and basic metadata to its peers.
Peers request the full transaction data if they do not already have it.
Each node performs its own validation before adding the transaction to its mempool.
This propagation mechanism ensures that transactions spread rapidly across the Celestium network.
4. Managing Mempool Capacity
To prevent spam and ensure performance, Celestium nodes enforce mempool limits:
Maximum Mempool Size: A limit on the number of transactions in the mempool.
Eviction Policy: Low-fee or stale transactions may be dropped when the mempool is full.
Replacement Transactions: Users can replace pending transactions by submitting a new transaction with the same nonce and a higher fee (known as a “speed-up” or “cancel” transaction).
Nodes prioritize transactions based on effective gas price (base fee + priority fee).
5. Real-Time Available Balance Tracking
One of Celestium’s innovations is real-time tracking of an account’s available balance during mempool admission. As transactions are added, the available balance is decremented:
Prevents the same funds from being spent multiple times in pending transactions.
Reduces the risk of block proposals containing invalid transactions.
This approach safeguards against denial-of-service (DoS) attacks and enhances network efficiency.
6. Mempool Gossip Protocol
Celestium employs a gossip protocol to ensure rapid propagation of transactions:
Each node randomly selects a subset of peers to gossip new transactions.
Gossip is limited to reduce network congestion.
Peers that already have the transaction ignore redundant announcements.
This decentralized broadcasting approach ensures that valid transactions reach block proposers swiftly.
7. Transaction Replacement and Cancellation
Users often need to speed up or cancel pending transactions:
Speed Up: Submit a new transaction with the same nonce and a higher gas price.
Cancel: Submit a zero-value transaction with the same nonce and a higher gas price.
Replacement transactions must meet the price bump requirement (e.g., 10-12% higher gas price) to be accepted by nodes.
Example with Web3.js:
8. Priority Gas Auction (PGA)
Validators use PGA (Priority Gas Auction) to order transactions in a block:
Transactions offering higher fees per gas are prioritized.
This auction mechanism creates competition during network congestion.
Users can monitor current gas prices to optimize their fee settings.
9. Mempool and Finality
Transactions in the mempool are not final until included in a block. Once a block is finalized (1-second finality in Celestium), transactions within that block are considered part of the immutable blockchain history.
10. Summary of Mempool Propagation Flow
Transaction Submission: User submits a signed transaction.
Validation: Node checks balance, nonce, signature, and gas price.
Mempool Admission: Valid transactions are added to the mempool.
Propagation: Transaction details are gossiped to peers.
Replacement: Pending transactions can be replaced or canceled.
Block Inclusion: Validators select transactions based on fees.
Finality: Transactions are finalized after block confirmation.
Related RPC Endpoints
Method
Description
eth_sendRawTransaction
Submit a signed transaction.
eth_getTransactionByHash
Retrieve transaction details.
eth_getTransactionReceipt
Get transaction outcome and logs.
Key Benefits of Celestium Mempool Design
Real-Time Balance Tracking: Reduces invalid transaction inclusion.
Efficient Propagation: Ensures fast transaction distribution.
Spam Protection: Limits prevent network abuse.
User Control: Supports transaction replacement and cancellation.
Understanding mempool propagation allows developers and users to optimize transaction submissions, ensuring timely and cost-efficient interactions with the Celestium blockchain.
Last updated