1

I need to monitor a future (also known as pending or unconfirmed) transactions.

First of all, let's start with the source code. In the core/tx_pool.go let's configure logging a little. Replace

log.Trace("Pooled new future transaction", "hash", hash, "from", from, "to", tx.To())

in the func (pool *TxPool) add(tx *types.Transaction, local bool) with the

log.Info("Pooled new future transaction", "hash", hash, "from", from, "to", tx.To())

After building with make geth and running this code, I see a lot of logging messages like:

INFO [05-20|22:35:42|core/tx_pool.go:672]                Pooled new future transaction            hash=3a6716…b8252e from=0xFF4690F85cd1b43aEdcCbeabE15744b5d496bcEE to=0xd0a6E6C54DbC68Db5db3A091B171A77407Ff7ccf
INFO [05-20|22:35:42|core/tx_pool.go:672]                Pooled new future transaction            hash=77175c…54e233 from=0x4b5624B25CeDc608C1e092d906B2fFF1DB919C56 to=0x4549c04465e1a89c16D5037c962077857e3923C4
INFO [05-20|22:35:42|core/tx_pool.go:672]                Pooled new future transaction            hash=a47f2f…bc7df9 from=0xA15D4f7a9272c178aFA468cA9a0779bC76C37B9e to=0xfD107B473AB90e8Fbd89872144a3DC92C40Fa8C9
INFO [05-20|22:35:42|core/tx_pool.go:672]                Pooled new future transaction            hash=fb0061…50a38f from=0x160741663430A72D5725FdF059dE936a4E4c7171 to=0x86Fa049857E0209aa7D9e616F7eb3b3B78ECfdb0
INFO [05-20|22:35:42|core/tx_pool.go:672]                Pooled new future transaction            hash=73dc11…cf1165 from=0xb219B36e2f176a271E9b9EfA877c546e922c1329 to=0x390D6673c1FA9DBb8000dB1AE89252b7d531Ab75
INFO [05-20|22:35:42|core/tx_pool.go:672]                Pooled new future transaction            hash=fde95f…af7b68 from=0xEC2e44E44F3c9163029A55d9BC4B310eB524895b to=0xe57Cf6e88505f36954e7c8e6cA9d6b645D030375

But they are shown only after geth is fully synced. I didn't find any special message inside the Ethereum protocol, which means something like I'm ready, sent me new transactions, so most likely there's some if ... else ... statement in the code, which controls processing of future transctions. I'm not very good with golang, so I'm stuck.

How can I make geth logs Pooled new future transaction ... messages right out of the box, without syncing it?

Thanks in advance!

  • 1
    In order to accept new transactions you need to validate some parameters that require the node to be synced like the sender nonce or the sender balance is enough to pay for the gas. – Ismael May 22 '18 at 3:00

Your Answer

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

Browse other questions tagged or ask your own question.