Cryptocurrencies are an application of the more general distributed computing field of research.
While Bitcoin’s potential impact on financial markets sent it straight to the spotlight, the reality is that the technical concepts behind Bitcoin have long been the subject of intense research. Many peer-to-peer technologies came before Bitcoin and attempted to solve various different problems in the field.
One of the most difficult distributed computing problems to solve is a word crypto enthusiasts have become very familiar with: consensus.
While we now take cloud servers, multithreading, serverless apps and other modern distributed computing concepts for granted, there really is nothing simple when it comes to keeping multiple remote components in perfect synchronization.
In fact, getting a large number of network participants to reach consensus it’s a fairly hard problem.
Classical consensus involves every participant talking to every other party on a network. While this consensus mechanism is by no means simple, it works perfectly as long as everyone exchanges information with everyone else.
As you may have guessed, there’s an obvious problem in classic consensus: it doesn’t scale. Since classic consensus displays quadratic complexity as the number of nodes grows, it becomes intractable to reach consensus when millions of nodes join a classic consensus network.
As such, classic consensus is commonly used in controlled and trusted environments. For example corporate databases with leader nodes and replication nodes where all sub-nodes pull the latest updates from the main copy.
In this seminal paper, Nakamoto describes a new distributed computing consensus mechanism that has since become known as Nakamoto consensus.
Nakamoto consensus differs from classic consensus in that it does not require N to N communication between participants.
In order for everyone to be in sync, every participant simply looks for the longest chain in a tree of blockchains. The longest chain becomes the consensus.
The chain is designed to be cryptographically secure through the use of digital signatures and one-way hashing functions. The entire system is based on the assumption that neither the signatures or the hashes can be forged.
In order to build a longer chain, a participant has to solve a very difficult cryptographic puzzle, making the process extremely costly. So whoever comes up with a chain that is 1 valid block longer has won the cryptographic puzzle competition. For this, they receive a block reward (currently at 6.25 BTC per block).
Even if two nodes haven’t communicated while one of them has solved the puzzle, as soon as they check which one has the longest chain, they’ll quickly get in sync again.
Two nodes can have their own chain individually and be out of sync for a very long time. As long as the chain parameters match and they have a common ancestor block, the longest chain becomes the accepted chain as soon as they contact each other.
Since Bitcoin mining is very dynamic and has thousands of miners participating, it’s very difficult for any two nodes to have different chains today. But the concept works even if nodes didn’t communicate for several blocks. As soon as they do trade gossip, the one with the longest chain wins.
Although this sounds a bit convoluted, Nakamoto consensus is very simple in practice. The cryptographic tools used in Bitcoin were well known for decades before the first coin was ever mined.
In 2018, Team Rocket published a paper describing a new consensus mechanism that differs from classic and Nakamoto consensus. The Avalanche consensus mechanism takes a completely different approach from either previous method.
Read our Avalanche consensus mechanism post for details.