7

I am trying to understand Bitcoin at a more fundamental level. I'd like to know how a new transaction enters and propagates across the network? I've read many Bob and Alice type scenarios where it's said that "the transaction is broadcast to the network". If there are many nodes on the Bitcoin network, how does the wallet know which node to initially broadcast the transaction to?

EDIT

Just for clarification, I'm referring to the process of sending from the client wallet (e.g. Mycelium on Android) to Node 1, before it gets propagated to all other nodes. How does my wallet know which node to send to first, or does it just randomly pick one?

2 Answers 2

7

I'd suggest you read this blog post about using the raw Bitcoin protocol: http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html

To answer your question, you should specifically read the "How to find peers" section of that post. Specifically this part:

There's a chicken-and-egg problem, though, of how to find the first peer. Bitcoin clients solve this problem with several methods. Several reliable peers are registered in DNS under the name bitseed.xf2.org. By doing a nslookup, a client gets the IP addresses of these peers, and hopefully one of them will work. If that doesn't work, a seed list of peers is hardcoded into the client.

and

The hardcoded peer list in the Bitcoin client is in chainparams.cpp in the array pnseed. For more information on finding Bitcoin peers, see How Bitcoin clients find each other or Satoshi client node discovery.

0
4
  • A node learns about a new transaction, either from a peer or of it's own creation.
  • It announces to every one of it's peers (8+ typically) with an inventory message that it has learned about a transaction or block with a particular ID.
  • If the connected peer doesn't already know about the announced transaction, it sends a getdata request back asking for the contents of the transaction. If it already knows about the transaction, no getdata is made in response.

Within a few seconds (less than 5s on average currently) every peer in the network has the relayed transaction. This is possible because of the mesh layout of the network, every node connects to every other node through some degree of separation. The design makes it incredibly difficult to determine if a node created a transaction or is just relaying it, this is by design.

3
  • The type of structure is known as a "gossip network". Where nodes in network try to know as much as possible.
    – John T
    Feb 12, 2014 at 21:46
  • You mention it can know about a transaction "from a peer or of it's own creation", but what is meant by "of it's own creation"? I initiate a transaction from my Android wallet, how does that reach the first node? The node itself isn't creating the transaction? thanks!
    – QFDev
    Feb 12, 2014 at 21:48
  • I'm not sure how the android wallet works, but it's probably different to the normal network topography. In the case of other lite clients (see, spv client on the wiki), it will announce to normal peers on the network and ignore everything else going on. It's a bit different to how normal nodes work.
    – user13413
    Feb 12, 2014 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.