4

Are blocks sent in parallel or in series?

I would also like to know about the implementation part of Bitcoin Core.

1 Answer 1

5

Blocks are downloaded in series from a given peer, but a node can download blocks from multiple peers at the same time, effectively downloading blocks in parallel. This parallel downloading is not about downloading different parts of the same block from different peers, but rather downloading different blocks from different peers.

This design allows a node to download the blockchain more quickly, as it is not limited by the upload speed of a single peer. It also adds a layer of redundancy.

Despite the parallel downloading of blocks, they must be processed serially. This is essential for the node to maintain accurate information about the existing unspent transaction outputs (UTXOs) and to verify the validity of transactions.

The actual implementation of this process in Bitcoin Core is quite complex and involves various aspects like handling timeouts, validating blocks, and so on. You can review the actual code in the Bitcoin Core GitHub repository to get a deeper understanding.

You may also check the P2P Network part of Bitcoin Developer site - see the explanation for Block, GetBlocks, GetData, GetHeaders messages, that are involved when blocks are sent between nodes.

4
  • How does a node send blocks to adjacent nodes? Does it upload blocks to multiple adjacent nodes simultaneously? Or is it a sequential transmission implementation where the node sends the block to one individual, and after that, to the next node?
    – masuda
    Dec 31, 2023 at 10:14
  • @masuda Blocks are sent to peers when they ask for it. If multiple peers ask for it simultaneously, a node can send to multiple at the same time. Dec 31, 2023 at 14:49
  • Do you know in which file of Bitcoin Core this is implemented?
    – masuda
    Jan 1 at 5:12
  • @masuda net_processing.cpp and net.cpp primarily. Jan 2 at 1:37

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.