7

I am researching Bitcoin; what I can't find much information on though is how the P2P network itself operates. For example, BitTorrent uses a DHT protocol that allows for node discovery and calculating distances between nodes etc.

So if a Bitcoin client wants to do a transaction, how does it know which IP address to connect to in order to announce it?

And how does the node that the transaction gets sent to know which other nodes it needs to connect to, and so on?

  • 1
    Not really a duplicate: the question is mostly about how data moves through the network, not actually about how peers are found (I think). – Pieter Wuille May 28 '13 at 6:35
  • 1
    The question is based on the false premise that nodes decide which other nodes to connect to based on what they need to do. That's just not how Bitcoin works. – David Schwartz May 28 '13 at 14:19
11

Bitcoin is a so-called gossip network. They announce any new object to all of their peers (just the hash of the data). If the peer doesn't know the object yet, it asks for the full object. So it's certainly not a DHT or any smart organisation of data: every (full) node (eventually) learns about every block and transaction. They have to, there is no other way of validating history otherwise.

As for how the client discovers peers, see How do Bitcoin clients find each other?

  • If you want to know how peers are found: see the link to the potential duplicate (it's independent from what you want to do). If you want to know where blocks and transactions get sent, it'd easy: everywhere. – Pieter Wuille May 28 '13 at 16:49

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.