2

If I run a full node (say geth) in the Ethereum network, then the way things work out is that every node releases/ announces new transactions as they receive new ones. I'm assuming that my node must also be receiving a lot of unconfirmed transactions. My objective is to attach an IP address (of the node from which I received the transaction details) to the actual transaction message itself.

How can this be achieved? I'm vaguely aware that ÐΞVp2p is used for communication between nodes, but is it also used for actual transaction detail transmission or just peer discovery? Also, will I have to run my geth client as a miner (to actually make sure that I receive the transaction messages from other nodes in the network).

2 Answers 2

1

You can find out lots of information regarding pending/queued transactions by using the txpool API methods.

However, there's no straight way to find the IP address of the node that you're receiving a tx from. You could implement a proxy through which your geth node to communicate with the network and inspect the traffic through it, but the info you'd got would be most probably useless:

  • your node is connected to a limited number of nodes (below 100), while there are tens of thousands of nodes online.
  • even if your node A gets lots of transactions from node B, it doesn't mean that node B is the original broadcaster of that tx. It only means that node B relays more transactions than other nodes.
  • If you hope to catch hackers that steal ETH/tokens by looking at the originating node IPs, I am almost certain that's not possible: transactions can be created and signed offline and broadcast from etherscan and most probably there are other hosted ETH nodes available.
2
  • I guess my answer lies somewhere a level below the actual API implementations. I can always connect to more peers, correct me if I'm wrong. I know that the actual transaction may have originated somewhere else, I care only about the IP of the peer which 'gossiped' the transaction details to me.
    – DaveIdito
    Commented May 29, 2018 at 13:57
  • The protocol is peer to peer. Most probably you get the same tx from multiple peers. The order in which you get that tx depends rather on the network connection than on the actual closeness to the originating node. I assume it's this lack of relevance that made the devs not include the IP address in the API. Commented May 29, 2018 at 14:11
0

if you prefer to use javascript, https://web3js.readthedocs.io/en/1.0/web3-eth-txpool.html might be quite handsome. but i fear the required IP information you are looking for is not available at all.

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.