4 ms·
You ask for blocks from everybody, starting with the genesis block (block #1). You verify that they're all valid, and the blockchain with the greatest accumula
by Natanael_L 10y ago
You ask for blocks from everybody, starting with the genesis block (block #1).
You verify that they're all valid, and the blockchain with the greatest accumulated difficulty (correlated with chain length) is assumed to be the valid one used by the whole network.
Whenever you get new blocks you first verify validity, and then you check if they make up for a conflicting blockchain longer than yours (if so, you switch), shorter than yours (ignore), or if it extends the blockchain you have (then you add them).
Number of peers don't matter in Bitcoin.
- baby 10y agoOK. So you get an arbitrary number of blockchains, you check which one is the longest, it wins. Doesn't matter if you have 50 against 1 that are shorter and on a different path?
- Natanael_L 10y agoOnly one thing matters - a validly formed blockchain with a total accumulated proof of work greater than that of any other individual chain. This typically also means that the longest individual blockchain wins.