Go-ethereum: console "admin" feature to view pending transactions

Created on 8 Apr 2015  Â·  9Comments  Â·  Source: ethereum/go-ethereum

When running geth console I'd like to get pending transactions from the admin object. (as mentioned by @obscuren)

feature

Most helpful comment

guys this is really just working now as it should. so I am closing this

eth.getBlock("pending", true).transactions

All 9 comments

you can get pending transactions via the eth object:

eth.getBlock(-2, true).transactions

-2 stands for pending block, true to include transaction objects
I documented the magic numbers -1/-2 in JS API wiki https://github.com/ethereum/wiki/wiki/JavaScript-API
let me know if this is not what you need

Thanks this looks good.
Is there a way to get it with RPC (in case scripts need)? Also, I usually run geth cli instead of console, and is there a way that I can access this? I know I can't run get console since db already open, but maybe there's some other way?

On second thought this is probably not what you want.

-------- Original message --------
From: ethers [email protected]
Date:22/04/2015 04:46 (GMT+00:00)
To: ethereum/go-ethereum [email protected]
Cc: Viktor Trón viktor.[email protected]
Subject: Re: [go-ethereum] console "admin" feature to view pending
transactions (#675)

Thanks this looks good.
Is there a way to get it with RPC (in case scripts need)? Also, I usually run geth cli instead of console, and is there a way that I can access this? I know I can't run get console since db already open, but maybe there's some other way?

—
Reply to this email directly or view it on GitHub.

The -1 and -2 should not be documented. These are only for internal usage. The canonical way of doing this is by supplying "latest" or "pending".

agree

me too :) but so then it needs to be implemented in go rpc/xeth for

  • [x] eth.getBlock
  • [x] eth.getBlockTransactionCount
  • [x] eth.getTransactionFromBlock and
  • [x] eth.getUncle
    I create an issue

@obscuren But as for the original issue: will my solution (using getBlock("pending")) work if we are not mining?
Cos then no pending block is created right?
Yet we do send transactions and until they are confirmed in a block, they are pending.

pending blocks are always created regardless of mining. So yes, still works.

guys this is really just working now as it should. so I am closing this

eth.getBlock("pending", true).transactions
Was this page helpful?
0 / 5 - 0 ratings