Bitcoin For Dummies. Peter Kent
a partial or full copy of the ledger. And, by the way, those nodes are in scores of different countries — certainly more than 100. As a result, no single government can stop Bitcoin, should it decide to do so.
Using the Bitcoin Blockchain’s Blocks of Business
So now you know about the Bitcoin network — thousands of nodes holding a copy of the ledger, along with wallets owned by ordinary Bitcoin owners (like you) which send transactions to the network. Now let’s look at the actual ledger.
You found out earlier why a blockchain is known as a blockchain: because it chains blocks of data together. What does that mean, though? How are blocks chained together? Let us explain. (By the way, we’re focusing here on the Bitcoin blockchain; blockchains can be used for many different purposes, and may have different characteristics, but they generally follow the same overall structure.)
First, we start with blocks of data. In the case of the Bitcoin blockchain, each block of data contains information about transactions. We’ll explain addresses in a moment, but suffice it to say that a transaction is a record of a transfer from one address in the blockchain to another address.
Wallets send transactions to the network, and the nodes add them to a list of transactions that need to be added to the blockchain. Every ten minutes, more or less, these transactions are gathered together into a block of data, and added to the blockchain. But remember, these blocks are not merely connected to one another; they are chained together. In a sense, they are locked together, and this is done using a complicated piece of mathematics called hashing.
Hashing the blocks
All these blocks of data containing a record of transactions are, as you’ve discovered, stored on multiple computers — thousands of them, in scores of countries. That’s a powerful thing in itself; how can you hack all those computers? But there’s more; the chaining of the blocks from which blockchains get their name further complicates any attempt at hacking. Here’s how it works.
The Bitcoin network uses a hash to identify each block of transactions. The block is passed through a special hashing algorithm, a bit of complex mathematics that has very useful characteristics.
When you hash a block of information, you end up with a very large string of characters.
This string of characters is unique, and only matches that particular piece of hashed data. It acts like a fingerprint, uniquely identifying a particular block of data.
Every time you hash the data, you will always end up with the same unique hash number.
If you were to change a single character in the list of transactions, the hash would no longer match. That is, should you hash the modified data again, you would end up with a completely different hash.
How does this hashing mathematics do all this? You don’t need to know! We don’t know, after all, so why should you? Just accept that the mathematics does all this (it does), and don’t worry about how (just as you accept how your smartphone works do you really know how it functions?).
So here’s how the overall process works:
1 A node puts together a block of transactions.
2 The hash — the long string of characters acting as a “fingerprint” — copied from the previous block is also added to the block of transactions.
3 The node then hashes the block, previous-block’s hash and all. That is, it passes the combination to the hashing algorithm, which reads it and then creates the “fingerprint” the hash.Here’s a real example, taken from the Bitcoin blockchain:00000000000000000012b707bf6d172f0de94cfb311113c5d26dfe92764acc95
4 The hash is added to the block of transactions.
5 The block of transactions is added to the blockchain.
So, as the process moves along, and more transactions are added, we have a series of blocks of data, each containing two hashes: the hash identifying the previous block, and the new hash identifying the current block (including the current transactions and the previous block’s hash).
That’s how blocks are chained together into the blockchain (see Figure 2-1). Each block contains the previous block’s hash — in effect, a copy of the previous block’s unique fingerprint. Each block is also, in effect, identifying its position in the blockchain; the hash from the previous block identifies the order in which the current block sits.
FIGURE 2-1: Each block’s hash is stored in the next block of data. The hashes chain the blocks together in an orderly fashion.
The Bitcoin blockchain is “immutable”
Remember when we said earlier that the Bitcoin blockchain is immutable that once created, it can’t be changed? It’s the hashes that make it immutable. If the Bitcoin blockchain says you own x Bitcoin, then you do own x Bitcoin, and there can be no disagreement…and nobody can go into the blockchain and hack it or somehow change or alter it.
Imagine what would happen if someone went into a block (we’ll call it Block A) and changed a little bit of data — for example, they went in and showed that instead of sending someone one Bitcoin, you sent nine.
Well, the hash in Block A would no longer match its data. Remember, a hash is a fingerprint that identifies the data, so if you change the data, the hash no longer matches.
Okay, so the hacker could rehash Block A’s data and then save the “corrected” hash. But wait, now the next block (Block B) would not match because Block B is carrying Block A’s original hash, and they just changed that. So now, the hacker needs to change the Block A hash stored in Block B.
But now Block B’s hash doesn’t match Block B’s data, because that hash was created from a combination of Block B’s transaction data and Block A’s hash!
So, Block B would have to be re-hashed, and the hash updated. But wait! That means Block B’s hash stored in Block C now doesn’t match!…
See where we’re going? This would ripple through the entire blockchain. The entire blockchain would now be broken above the “hacked” block, by modifying just one single character in that block. In order to fix the problem, the entire blockchain would have to be recalculated. From the hacked block onwards, it would need to be “re-mined,” as they say in the Bitcoin world. What may look like a simple hack and database edit has now turned into a major computational headache that cannot be easily completed.
So, this hashing function, combined with the fact that thousands of other nodes must be in sync with identical copies of the blockchain, makes the blockchain virtually immutable; it simply can’t be hacked.
Nobody can change it or destroy it. Hackers can’t get into the peer-to-peer node network and create transactions in order to steal crypto, governments can’t close it down (China, for example, could attempt to shut down Bitcoin within its borders, as they have tried recently, but the blockchain would continue to exist in many other countries, and even in China for people managing to get through the Chinese “Great Firewall”), a terrorist group can’t destroy it, one nation can’t attack another and destroy its blockchain, and so on. Because so many copies of the Bitcoin blockchain prevail in so many countries, and as long as enough people want to continue working with the blockchain, it’s practically immutable and indestructible.
Finding Out How the Ledger Functions
So