8
3
A Bitcoin client has to download the whole blockchain from the P2P network in order to become a full node.
A full node is able to determine, if a transaction in the network is valid or not.
To download the blockchain, the client queries other peers in the network for more blocks by providing them with the hash of the last block it has currently in its downloaded blockchain.
The other nodes search in their currently best blockchain for the specified hash and return a list of hashes of further blocks the client can download.
After the client determines that the further block hashes are indeed in the longest block chain by crossvalidating other nodes, it requests those blocks from its peers by giving them the hashes of those new blocks.
After the download, it checks for itself that the blocks follow the rules of the bitcoin network and inserts them in its current blockchain.
This algorithm assumes that any valid block in the blockchain has a unique hash that identifies it. What happens, if by chance a block is inserted in the blockchain that has the same hash as a previous block and that complies with all rules of the bitcoin network?
Wouldn't that break the algorithm?
3little bit less than 2^256 :)) because hashes have several leading zeros :)) – amaclin – 2015-07-03T10:58:45.870
2Oh, of course yes. I totally forgot about that also being the metric being compared to the target. – Murch – 2015-07-03T12:01:12.370
1Worth noting that you don't have to request an inventory item to receive it, you can push items directly to nodes and they will happily download and process it. Violation of the protocol and a waste of bandwidth, but it is valid behavior. – Anonymous – 2015-07-03T13:33:41.863
@Bitcoin: So, essentially, those that had it would remain on the fork until a longer chain orphaned it? Or those that hadn't gotten it and couldn't request it, would not be able to join the chain? – Murch – 2015-07-03T18:22:21.230
I'd have to read some of the code to find out for sure. I suspect the client would just implode when trying to import a duplicate block hash though, making the question especially moot. – Anonymous – 2015-07-03T18:30:28.887
Doesn't this limit the usability of bitcoin ? At some point the amount of transactions that can ever be made will be used up. Would the hashspace just be made larger at that point ? – HopefullyHelpful – 2017-11-02T18:15:41.683
1There are 2^256 = 1.1579209e+77 possible transactions. For the block hashes slightly fewer due to the constraints from difficulty. Either way, I think we're good for a few millenia. ;) – Murch – 2017-11-02T18:33:16.320