Can I see the bitcoin address (pkh) of my directly connected peers?

I'm asking this question because if I can, I can deanonymize my peers given their IP addresses (from the TCP header) right?

If this is the case, isn't this a security flaw as one can set up a node and connect to as many nodes as they can. They can then create a mapping of IP to bitcoin addresses, thus deanonymize most users if they don't use a proxy service like Tor.


First of all, nodes do not necessarily have an address, nor do they necessarily have just one. Addresses are not identities and are not tied to nodes. A node operator can operate a node without a wallet, so that node does not have any addresses. A node operator could have a wallet on their node that has many addresses, that node would have many addresses. So this idea that each node has an address is itself incorrect.

For nodes that do have wallets, the wallet and the node basically operate separately. The node part (handles P2P, tx and block validation, etc.) does not know the contents of the wallet. It does not know what addresses are in the wallet and what transactions actually belong to the wallet. So no, the node cannot directly reveal the addresses for its associated wallet(s) as it does not have access to that information.

The only way you would learn what addresses belong to a node are by observing the transactions that it sends. But in order to know what transactions it truly sends, you need to surround that node with nodes that you control so that you can control/observe everything that that node learns about and sends. When it sends a transaction, it will be a transaction that was not relayed to it by one of your nodes surrounding it so you know that transaction originated from that node and then you can do other blockchain analysis techniques on that transaction to learn further information. This kind of attack is known as a sybil attack.

Another related attack is to connect to every single node on the network and see which node first relays a transaction. However this is basically impossible to do. There are many non-listening nodes so you wouldn't be able to connect to them. Additionally due to latency and physics, this is not as reliable as your node(s) could learn the transaction from a relay node instead of the direct connection to the originator if there is too much latency on that direct connection.

However performing these attacks is not easy. Nodes have active countermeasures to make these attacks more expensive and increase their own privacy. These attacks can be fairly costly and there is no real monetary gain from learning this information.


No, nodes do not have a Bitcoin address.

Addresses are managed by wallets, but wallets are not the same as nodes. They're generally separate software, or hardware, often offline, and not accessible through nodes' P2P interfaces.

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.