17

What is the difference between eth.pendingTransactions and eth.getBlock('pending').transactions?

I have noticed that sometimes eth.pendingTransactions have some transactions that eth.getBlock('pending').transactions does not have.

15

eth.pendingTransactions are the transactions that your local Geth node has, that haven't been mined to a block.

eth.getBlock('pending') is the current block your node is mining (or would be mining on). It is not a block that has been added to the blockchain. eth.getBlock('pending').transactions are the transactions that are included in this hypothetical block.

If you are sending a transaction, you will see it first in eth.pendingTransactions, before a miner includes it in a block.

  • 2
    Does eth.pendingTransactions only contain tx created by the own node or also tx broadcasted by others? Or in other words: Is it possible to know about incoming ether payment transactions before they are confirmed in a block (like in btc) – tobi Mar 29 '17 at 10:30
  • @tobi For Geth you can take a look at txpool – eth Mar 31 '17 at 7:40
  • cool, thanks! So probably for parity too, right? I'm just starting to look into it but my assumption is that their rpc interfaces are quite similar – tobi Mar 31 '17 at 11:50
  • @eth Hi, is this true for a node that's not mining ? I can't see what that "hypothetical block" could represent on a non-mining node when using "pending" as parameter. – Nicolas Massart Oct 18 '18 at 9:43
  • 1
    @NicolasMassart If not mining, 'pending' would be the same as 'latest' block (your node has). If there's a difference, may be worth linking a new question. – eth Oct 22 '18 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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