A network of special computers that keeps track of a ledger
I guess a quick recap of what we’ve learned in Part 1 might prove useful to bring us up to speed.
The blockchain is a network of special computers, called nodes. The nodes are accountants that maintain an accounting book, called a ledger. In this ledger, the nodes append transactions – sending/receiving of value or data.
The nodes maintain the ledger by storing the transactions in bundles called blocks. The blocks are always ordered chronologically. This order is maintained by linking each new block to the previous one by its unique identifier called block hash.
We saw what each node does, so it is time to look at the blockchain network and what makes blockchain decentralized as a whole.
…and synchronize with each other
As we’ve already seen the nodes maintain a ledger. To be precise, every node maintains a copy of the ledger. This allows any given node to be able to validate and agree/reject the transactions sent to them.
Having all nodes maintain an identical copy of the ledger is critical for the validation process. If the ledgers are not identical the nodes will disagree over the facts written.
Consider the following example:
A villain has a balance of $20. He sends one node a transaction spending all his $20. Then he sends another node another transaction spending $20.
If the nodes do not maintain an identical copy and do not synchronize, the villain will be able to spend two times his balance – the double-spending problem.
Puzzle piece 7: Synchronization – the process through which all nodes agree on the latest version of the ledger.
There are two solutions to this problem – let’s review them.
Solution #1 – The bank solution
One easy solution would be to have only one node in the world. This node will be a central point and our villain will send both his transactions to it. Being a smart accountant, the central node will realize the fraud as soon as the second transaction comes in and will reject the transaction.
This, in essence, is the premise for the current banking system – a central point that maintains a ledger of your bank balance.
Central points, however, are not as perfect as it sounds…
Whole host of real-world system work through a central point.
A central point keeps the balance of your bank account – the bank. Social networks, like Facebook, are the central points for accessing your social media profiles. Systems based on central points are fast and relatively easy to synchronize. Central points can exercise their position of power to right a wrong, reverse a mistake, or just recover your forgotten password. We are very used to these systems in our everyday life.
Centralization, however, is not a perfect solution, but a tradeoff by itself. By their nature centralization and central points inherit two main problems – a single point of failure problem and censorship problem.
Let’s illustrate these two problems using the scenario we outlined above – imagine we’ve solved the double-spending problem by reducing the network to a single central node.
The most straightforward example of a single point of failure problem would occur if our central node experiences a fault and shuts down. Any failure causing the central node to “die” would stop the whole system. For example – if Facebook is down, you cannot use your account.
Another class of examples of a single point of failure problem does not involve the node shutting down. Instead, the central node becomes a villain itself. This might happen because of a rogue employee of the company operating the node, villainous hacker that has taken control over the node or even an honest mistake in the software code.
In these cases, the failure will result in the ability of the malicious party to change the ledger in any way they want. In the case of a bank – probably adding billions to their account.
To put it simply, with central points you gain conveniences like speed and password recovery, but you run the risk of the system being compromised or shutting down for good, leaving you helpless to do anything.
On the other hand, an example of the censorship problem would be if the central node decides to never include a transaction coming from you. You will never be able to access your balance.
Puzzle piece 8: “Single point of failure problem” is the scenario where a single central point is compromised, taken down, limited or being exploited. The damage during a single point of failure normally is unrepairable.
“Censorship problem” is the scenario where the central point has the ability to decide which transactions to include and which to ignore.*
Solution #2 – Decentralization in Blockchain
Decentralization is a word that you will hear a lot in the blockchain space. But what makes blockchain decentralized? This is the ability of the blockchain network to operate without any central point, and still be able to get all nodes to agree to an identical copy of their ledgers.
Due to blockchain being decentralized, the blockchain networks are inherently resistant to a single point of failure and centralization problems. Here lies the disruptive power of blockchain technology.
Even if one node gets hacked or goes rogue, the other nodes will quickly realize it, exclude it and the system will continue working as expected. Even if one node shuts down, the other nodes will continue operating and you will be able to connect to the blockchain network through them, or even run one yourself. Even if one node decides to censor your transactions, you can always send them to another node and they will include it in the next block.
Puzzle piece 9: Decentralization in blockchain is the ability of a system to function without having one single central focal point.
In order to achieve this decentralized blockchain, the nodes need to perform two tasks.
Firstly, they have to relay any transactions they receive. Through this collaborative effort, all nodes receive all transactions, regardless of exactly which one the user originally sent the transaction to.
Secondly, the nodes work and reach a consensus with the rest of the network, over the current state of the ledger. To be precise, they agree on the appending of each new block to the chain of blocks in their ledger. This is done by performing specific steps called “consensus algorithms”. We will learn more about them in the next part of the series.
The art of relaying
Relaying sounds kind of easy, right? You receive a transaction and you then relay it to everyone else in the network. Well not exactly.
The blockchain networks consist of tens of thousands of nodes. Let’s imagine every node was relaying every transaction to every other node. The more nodes there are in the network, the more relaying you’d have to do. At a certain point, you would spend so much time relaying transactions that you will not have any time to produce blocks.
Instead the relaying follows a bit more relaxed rules. Here are a couple of interesting examples of such rules:
– Instead of sending to every other node in the blockchain network, the nodes pick a subset of nodes to send to. For example, a node might relay transactions to ever 7th node they know of. Due to different nodes picking different subsets, very quickly everyone receives the information.
– Every node relays one and the same transaction only once. If they receive the same transaction again, they no longer relay it (as they’ve already sent it to their chosen subset)
The act of relaying transactions and other important information between nodes has the playful name of “gossiping”.
Puzzle piece 10: Gossiping – the act of relaying transactions and information to other nodes in the network.
Up next – “reaching consensus”
Now we know what is blockchain network is, what makes blockchain decentralized, how a node operates as a unit, and why decentralization and gossiping are important. In the next part, we will learn exactly how the nodes reach consensus over what is the correct ledger version.