39

If a person sends a transaction to another person, and Bitcoin is a peer-to-peer application, how will the transaction get to the rest of the Bitcoin community? How does everyone have the same blockchain?

Does every system know about every other system in the network? If so, how?

3
  • 4
    Patrick, have you read this? bitcoin.org/bitcoin.pdf
    – Nick ODell
    Commented Oct 30, 2014 at 21:18
  • This pdf is new to me. Thank you. This looks to be very informative. Commented Oct 30, 2014 at 21:24
  • 1
    The PDF does not talk about how the broadcast is realized though Commented Feb 26, 2021 at 11:14

5 Answers 5

26

If a person sends a transaction to another person, and Bitcoin is a peer-to-peer application, how will the transaction get to the rest of the Bitcoin community?

Think of it like how gossip would spread. There are a bunch of people (nodes), and when one of them knows something, they tell it to the few (8 or so) people they are near (connected with), and then those people tell a few more people the message that was told to them, and then... Eventually everyone knows about the original information (transaction).

So when we say bitcoin is peer-to-peer, we mean it's just nodes that have internet connections (on port 8333 usually) with other peers. Not even necessarily the one you're sending the coins to!

How does everyone have the same blockchain?

After peers exchange their information (and validate that all transactions and blocks follow the protocol rules), they store it. Since all of the bitcoin transactions from the beginning of the bitcoin block chain are needed to validate everything that has taken place, essentially all full nodes store the same data (about 27.5 GB of pure block chain data as of now).

Does every system know about every other system in the network? If so, how?

No need to know about every other system on the network, each node just knows about the 8 or so nodes that it is connected to!

2
  • 1
    Is it possible that the message loop happens? e.g., A->B->C->A.
    – Helin Wang
    Commented May 19, 2018 at 4:19
  • 9
    No. What actually happens is when a node receives a transaction, they advertise the txid to their peers, and then their peer will only request the transaction if they haven't seen a transaction with that txid yet, so it prevents requesting duplicates.
    – morsecoder
    Commented May 19, 2018 at 13:10
8

According to https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery


DNS Addresses

Upon startup, if peer node discovery is needed, the client then issues DNS requests to learn about the addresses of other peer nodes. The client includes a list of host names for DNS services that are seeded. As of December, 2017 the list (from chainparams.cpp[1]) includes:

seed.bitcoin.sipa.be dnsseed.bluematt.me dnsseed.bitcoin.dashjr.org seed.bitcoinstats.com seed.bitcoin.jonasschnelli.ch seed.btc.petertodd.org A DNS reply can contain multiple IP addresses for a requested name.

Addresses discovered via DNS are initially given a zero timestamp, therefore they are not advertised in response to a "getaddr" request.


Hard Coded "Seed" Addresses

The client contains hard coded IP addresses that represent bitcoin nodes.

These addresses are only used as a last resort, if no other method has produced any addresses at all. When the loop in the connection handling thread ThreadOpenConnections2() sees an empty address map, it uses the "seed" IP addresses as backup.

There is code is move away from seed nodes when possible. The presumption is that this is to avoid overloading those nodes. Once the local node has enough addresses (presumably learned from the seed nodes), the connection thread will close seed node connections.

Seed Addresses are initially given a zero timestamp, therefore they are not advertised in response to a "getaddr" request.

2
  • Welcome to Bitcoin.SE! Your well-written answer is not complete, it does not address the original question but, it is a good beginning for a detailed answer.
    – Willtech
    Commented Feb 3, 2018 at 8:38
  • Thanks, I shaded light to me on what addresses where used and how the client find out about the rest of the nodes!
    – mrbarletta
    Commented Mar 16, 2022 at 15:30
5

The bitcoin daemon makes the transaction with the source address and the destination address then broadcasts the transaction to the network.

The Bitcoin miners confirm the transaction and include it in the next(s) blockchain blocks. The miners receive the transaction fee as the reward for this.

When the receiver downloads a new Bitcoin blockchain block and sees incoming transaction to his/her address, the receiver knows the payment was made.

So all Bitcoin nodes share the same blockchain data (approx. 27.5 GB at the moment). This blockchain as eventually consistent, append-only, database of all Bitcoin transactions.

4
  • 1
    how do they all have the same 20GB blockchain? How can the daemon broadcast the transaction to the network? Would you have to know all the systems on the network? Commented Oct 30, 2014 at 20:46
  • Each node communicates with neighbouring nodes and they communicate with neighbours and so on. Then the information propagades. For more details please refer to en.bitcoin.it/wiki/Network Commented Oct 30, 2014 at 20:54
  • 1
    If i just created a wallet after installing the software how would i know of any other nodes to connect to the network? Commented Oct 30, 2014 at 20:58
  • 1
    @PatrickW.McMahon bitcoin.stackexchange.com/questions/3536/…
    – Nick ODell
    Commented Oct 30, 2014 at 21:16
3

Transactions which are not double spends will be happily relayed by all nodes who receive them to all the people they connect to. This ensures that miners will hear about transactions.

Everyone who is fully synced will share the same blockchain. Bitcoin helps people achieve consensus, which simply means they all agree on the same list.

Generally bitcoin nodes will connect to at least 8 other (random) nodes. This is enough - You pick geographically separate nodes to get a true sense of the network's state. Nodes are responsible for relaying information about new transactions and blocks to their peers.

1
  • How the wallet know that is fully synced with others ?
    – Muflix
    Commented Sep 15, 2018 at 17:48
0

There is a well explained article in harmony website you can read https://blog.harmony.one/peer-discovery-in-harmony-network/

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.