CHAPTER 7The Blockchain

The blockchain is arguably the most important innovation introduced by Bitcoin. It is the missing link that makes distributed peer-to-peer digital currencies possible. The blockchain is in essence a distributed database holding all the Bitcoin transactions since the beginning (January 3, 2009) and a method to secure this database.

The blockchain keeps a secure list of all the transactions. However, there are relevant questions, such as whether a particular transaction output is spendable, that the block-chain does not answer directly. Software that uses the blockchain, like mining nodes or wallets, has to parse the blockchain to extract the relevant information. This information extracted from the blockchain is usually fed to a database. For instance, the Bitcoin node software uses LevelDB, a key-value store to keep a copy of the unspent transaction outputs (UTXO). To populate this database, the whole blockchain has to be parsed as explained at the beginning of Chapter 6 (see Figure 6.2).

The blockchain uses proof-of-work to secure the distributed database. This means the blockchain is secured against tamper attempts by the computational power that has been applied to create it. An attacker wishing to change the blockchain would have to apply a computational power equivalent to all the computational power spent from that point in time to the present. Furthermore, the attacker would have to outrun the legitimate Bitcoin network, which keeps adding entries ...

Get Understanding Bitcoin: Cryptography, Engineering and Economics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.