- Foundations of Blockchain
- Koshik Raj
- 392字
- 2021-07-02 14:17:17
Linking blocks in a blockchain
As defined in the introductory chapter, a blockchain is a continuously growing collection of blocks that are chained together to form an open ledger by using cryptography as a key ingredient. Each block in the blockchain is given an identity to mark that block as unique, and this is achieved by using the hash functions that will generate a digest for that block. The collision resistance property of the cryptographic hash function, as mentioned in the previous chapter, Chapter 2, A Bit of Cryptography, ensures that it is infeasible to find two blocks that will result in the same hash value. As a result, the hash function guarantees the uniqueness of the identity created for the block.
When a new block is created, it will backreference the previous block using the digest of the previous block, thus linking that block to the blockchain. Modifying any of the blocks would change the identity of that block due to the new hash value. As a result, this would break the chain, as one of the block references will be invalid due to the newly generated hash value. Therefore, it's infeasible to modify a block such that it generates the same hash value as before. This is due to the pre-image resistance property of the cryptographic hash function, which ensures that the data of the blocks cannot be predicted even if we possess the hash value. This is why, once a chain of blocks is created, the integrity of the chain is ensured as each block references the previous block. The only way to modify the data of a block is by modifying all the subsequent blocks by updating its reference to the previous block:
The preceding Figure 3.1 shows the design of blockchain from the original paper, Bitcoin: A Peer-to-Peer Electronic Cash System, by Satoshi Nakamoto, the creator of the original reference implementation of Bitcoin. It shows that each block's hash value is affected by the value of the previous block's hash value, thereby linking each block in the blockchain. Anyone who holds a copy of the blockchain ledger will be able to verify whether all of the blocks in the blockchain are valid just by verifying each block's hash with the next block.