0

I want to get historical list of pending transactions. For example, for a block number 1,000,000 is it possible to get this list?

Right now I have downloaded blockchain data up to block 1,600,000 , however if I execute this:

> eth.getBlock('pending', true).transactions
[]
>

I get no pending transactions.

Does this mean geth doesn't store pending transactions per block in its database? If geth does not, maybe Parity does it ???

1

Pending transactions are actually currently pending transactions: they are transactions in the memory of each node (the transaction pool), waiting to be included into a block by a miner.

When a tx is included into a block, it's is not in pending status anymore. So, it makes no sense trying to get pending transactions for a specific block number.

  • But it makes sens to store pending transactions locally , to keep history of when a particular transaction has appeared on the network. Such data will help analyzing the network and can give pointers for improvement. – Nulik Jun 19 '18 at 17:37
  • Maybe, but in any case you don't get when that tx "has appeared on the network", only when that tx reached your node: you don't know "when" the sender actually sent that tx. You can try to audit specific transactions that you send, trying to understand the network performance in that specific moment, but storing when your node sees for the first time a tx don't seem very useful "per se", you need to relate that information with many others to gain some useful knowledge about the network state. – Giuseppe Bertone Jun 19 '18 at 21:59
  • "don't seem very useful" ? It is very useful. For example , having this data you can calculate the average time it takes for a specific Gas Price to process a transaction. You could chart this data, say 2 GWei = transaction processed in 5 minutes, 10 GWei = transaction processed in 30 seconds. And show a chart of transaction processing time versus gas price. This is very useful data and you can't get it without the knowledge of when you received the transaction on the network. Nodes relay transactions quickly, so propagation time should be minimal. – Nulik Jun 20 '18 at 17:24
  • It don't seem very useful to do it with a single node. If you aggregate informations from many sources (for example what is done by services like ethgasstation.info or ethstats.net) that starts to become interesting (but even then IMHO still far away from "very useful" ^^) – Giuseppe Bertone Jun 21 '18 at 17:40
1

To add some completion to Giuseppe's response, this answer says that web3.eth.getBlock('pending') is only relevant if you are mining.

They are not persisted on the blockchain. They "live" in the txpool.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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