[Ethereum] Doubts regarding transactions broadcasting and concept of tx pool

transaction-propagationtransactions

This is going to be a long and some questions may sound dumb. But let's go ahead with this.

As per my understanding, once we send a transaction to blockchain, it goes to transaction pool with other transactions. Once the transaction is picked by any miner and included in a block, the transaction is removed from the transaction pool (mempool, bitcoin analogy).

  1. Is the transaction pool (or mempool or queue pool) specific to a ethereum node or the ethereum-client (geth,prity)?
  2. What is the difference between tx pool of geth and tx pool of my node (if they are different, I am not sure of this)?
  3. How can I know if the transaction is in tx pool? Can we assume all the transactions that are not mined are in tx pool?
  4. If by any way transaction is not in tx pool and not mined, can we assume that this transaction can never make it to a block?
    or When can I be sure that my transaction is dropped completely and won't be mined.
  5. I can see a lot of pending/queued transaction on my node.
      Are these transactions send from my node only?
      What happens to these transactions when:
      a) I stop geth node for some time and restart
      b) I remove db, update geth and resync using light/fast sync
  6. Suppose the ethereum network is under heavy load. What are the cases where my transaction will never be included in a block (assuming transaction doesn't run out of gas and sufficient gas price is provided).

  7. How can I be sure that the transaction is successfully broadcasted to network,if I am unable to see it on block explorers like etherscan (not even in Pending transaction pool).

Best Answer

Technically, it should be "a transaction pool", not "the transaction pool": each node has a set of transactions that it knows (or cares to know) about that are waiting to be confirmed from all users (not just your own) -- its own transaction pool. Thus, if there are n Ethereum nodes, there are n transaction pools. Transactions may disappear from tx pools if the node runs out of memory allocated to its tx pool or, I suppose, it filters them out when it receives them (e.g., if it doesn't meet its gas price requirement, it could filter it out). Note that the tx pool is specifically for pending transactions (your question 7 suggests confusion about that point).

If your transaction has been broadcast to the network, it may not appear on any particular node, even without malicious actors, for several reasons. These include

  • evicted from a node's tx pool (so it used to be there, but no longer is),
  • has not yet reached the node,
  • network partitioning (hopefully this doesn't happen).

To answer your question more specifically, no, you cannot assume an unmined tx is in any tx pool (not even your own). Even if your transaction is not in any tx pool, you can't be sure it won't be mined unless you send a "cancelling" transaction with the same nonce and that transaction is mined (though someone could still roll back the network). The reason why you cannot assume the transaction won't be mined otherwise is because someone might have stored your transaction and could rebroadcast it at a later date. Or, less maliciously, a node may have gone offline during, e.g., a high-fee period while caching your transaction and then coming back when fees are low.

Until you find a node where your transaction appears other than your own, you can't be sure its been broadcast. You can set up multiple nodes on the Internet and see if they appear in any of their transaction pools.

Related Topic