From my understanding, there is a bit of state which is held on a node when interacting with it over JSON RPC. One of these states local to the node is the txpool. The txpool is exposed with the web3.eth.getTransaction(txHash) method. It returns a transaction where transaction.blockHash == null if the transaction is in the txPool and returns transaction == null when the transaction is unknown.

If a sendTransaction call is made to one node followed by a getTransaction call to another node, with the transaction hash returned from sendTransaction, a null transaction will be returned because the transaction is only in the first node's txpool and the second node knows nothing about it.

What do services like myetherwallet do to ensure that sessions are maintained across requests so things like this don't happen? Is there a way to synchronize the transaction pools?

1 Answer 1


It's a complex question, i use the briefest description as far as possible. At first read the facking source code.

Broadcats Transaction. In handler.go file, there is a txBroadcastLoop method, the function of it is sending a local transaction to peers of connected, when a transaction committed, this method would be called by event. by BroadcastTx method, this tx will be delivered to peers by p2p network, if you have interest to analysis it, please read source file to know how p2p network created, connected, receive or send message.

Receive transaction. The same source file handler.go, you can find a handleMsg method, it's duty is receive message from connected peers. On lines 650, there is the logic dealing with remote transaction. At first, this txs will be marked remote transaction, because there is a especial judgement, for example, drop remote transactions under our own minimal accepted gas price, etc. And then, this remote txs will be added to tx_pool, before added tx_pool, there is so many validating, you can find a detail adding logic about transaction pool in source file tx_pool.go.

Hope it helps~


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.