3

Assume that I send a specific value from a source wallet to a destination wallet and simultaneously capture the input and output traffic with Wireshark.

I can extract output address and it's value from captured traffic, but how i can detect (from packets of traffic) that my transaction confirmed from miners?

In the other words, when i check out the bitcoin traffic, i see that the specific value which i sent(and it's output address), exists in some packets with different IP addresses, which i don't know which one is a miner. is there a flag or specific message sent to me that help me to understand that my transaction is confirmed?

4

A transaction is confirmed when it is included in a block, so you will need to watch for a message that alerts your node (or whatever software you are using to watch the P2P gossip traffic) to a new block, that includes the transaction in question. It doesn't matter if a node run by a miner relays your transaction to other nodes on the network, it only matters that the transaction is included in a block that is included in the longest (most work) valid chain.

Note that the relaying of this information has been optimized through various BIPs, so that the network is not naïvely using more bandwidth than required. This means that a message explicitly listing your transaction as confirmed may never be encountered, instead a node can gain this information implicitly, through the use of their mempool, and computational filters included with the new block message. You should take some time to learn about these optimizations if you're working to understand the network's P2P traffic, there are some questions on here that have more info. This one may be a good starting point.

  • 2
    Of course, just because you see your transaction in a block, that does not prove it is a valid block. To check that, you need to verify that the block meets all Bitcoin protocol requirements and links into the longest chain - which basically entails writing your own Bitcoin node. So it's probably better to solve this problem by actually running an off-the-shelf Bitcoin node, and having it notify you when the transaction is confirmed. – Nate Eldredge Jun 8 at 20:38

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.