One of the greatest achievements of the Bitcoin blockchain has been its demonstration that distributed systems can be an effective way to share and protect your data, and right now when the cost of hacking is estimated to be £600bn per year it deserves more of our attention.
With over 1500 cryptocurrencies, a total market cap of $415bn, Bitcoin represents 37% of the market and has over 10,000 nodes. These nodes keep a copy of the whole blockchain and communicate with each other to ensure they all have the right copy of the data and like every distributed peer-to-peer network they need to reach a consensus on the data they hold to ensure they all are aligned.
It is the reaching of this consensus that protects data from being tampered with. Reaching consensus when you may have nodes that go offline or are subject to malicious attacks is an agreement problem much like the Byzantine Generals Problem (Lamport et al 1992). These generals are distributed around a city and wish to formulate a plan for attacking the city. In its simplest form, the generals must decide only whether to attack or retreat. Some generals may prefer to attack, while others prefer to retreat. The important thing is that every general agrees on a common decision, for a half-hearted attack by a few generals would become a rout and be worse than a coordinated attack or a coordinated retreat.
The problem is complicated by the presence of traitorous generals who may not only cast a vote for a suboptimal strategy, they may do so selectively. For instance, if nine generals are voting, four of whom support attacking while four others are in favour of retreat, the ninth general may send a vote of retreat to those generals in favour of retreat, and a vote of attack to the rest. Those who received a retreat vote from the ninth general will retreat, while the rest will attack (which may not go well for the attackers). The problem is complicated further by the generals being physically separated and having to send their votes via messengers who may fail to deliver votes or may forge false votes.
The Bitcoin network is similar in many ways but has overcome this issue by working in parallel, each attempting to solve a puzzle with the winner rewarded with Bitcoins. As each miner validates the latest bitcoin transactions and inserts them into a block of data, they attach a hash of the previous block and create a hash of the new block, linking them together. The Bitcoin hash is an algorithm that generates a 256 bit signature of that block and is unique based on the data. Each miner changes a field in the block, the ‘nonce’ and therefore the corresponding hash signature until that signature satisfies the rules of the game. The first of all the miners to correctly ‘guess’ a signature that works will win and will share the block and signature with all nodes, proving that their signature works, namely called ‘Proof of Work’ (PoW). So, the puzzle is reasonably hard to solve but very easy to check.
To encourage the growth of the network, Bitcoin incentivise each miner with coins for successfully unlocking the latest block but will only pay after the miner has continued to participate, and as the network has grown the processing power and energy cost of solving the problem has grown, there can only be one winner but with 10,000+ nodes on the bitcoin network and significantly more estimated to be mining, over 1.5m miners in the top 5 mining pools alone, the total cost of is huge.
As each block is created, encrypted and linked to the previous block it forms a chain. If at any point nodes have different data, through attack or error, the nodes reach consensus on which chain reflects the truth by selecting the longest chain. This protects the data from any malicious attacks or someone wanting to rewrite events because the time it takes to amend a block, encrypt it and unlock it and so on for all subsequent blocks will mean that this tampered block will never be adopted by the community as the genuine blockchain will always be longer.
The network also needs to reach consensus on any code changes that a developer wishes to introduce, the majority of the network (>51%) need to agree to potential changes before they will be adopted and therefore limiting the ability for anyone to behave maliciously. On a large network like Bitcoin, owning 51% of the computing power is highly unlikely, limiting anyones ability to attack it by introducing faulty code.
But the ‘Proof of Work’ (PoW) protocol is not the only approach to agreeing consensus, in fact there are many approaches, Proof of Stake, Proof of Burn, Proof of Capacity, Proof of Elapsed Time, and many others depending on their unique requirements.
A popular alternative approach, assumes that members of a network who have coins will act in the best interest of the network, the more coins they have the more responsible and trustworthy they will be. Known as ‘Proof of Stake’ (PoS) these nodes validate the transactions to earn a transaction fee, there is no mining to be done, as all coins exist from day one. A PoS miner who owns 5% of the total coins, is allowed to mine only 5% of the blocks using a lottery approach. PoS blockchains aim to overcome the scalability and efficiency issues related to PoW, however in doing so transfer control from all distributed participants to the few.
As the value of PoW diminishes, and the number of nodes fall the Bitcoin network may be at risk that a group could gain control of 51% of all computing power and introduce changes that are not in the interest of all. With a PoS, any attacker would need to obtain 51% of the cryptocurrency to carry out an attack and therefore be against their interests. If Bitcoin was a PoS blockchain today the attacker would need $80bn in bitcoin to achieve their goals.
These protocols are designed to establish trust and incentivise adoption in a permissionless blockchains, like Bitcoin and Ethereum, both currently POW blockchains. But Ethereum is switching to POS over the next year. They have not only demonstrated how to make data transparent and safe from tampering but by being opensource, they have enabled an unprecedented sharing of knowledge as well as the ability to share value which has propelled distributed solutions into the mainstream.
Reaching consensus allows us to share data without it being tampered with and Bitcoin has opened the door to many different consensus mechanisms. The evolution of these mechanisms will reduce the total energy costs, will improve the scalability, will incentivise the network to play a part and will make our data increasingly more transparent and secure.