I was browsing /r/bitcoin today, where from beneath the tonnes of news surrounding Bitcoin’s increased adoption, came an insight so marvellous I thought I might share.

Today I realized that Satoshi Nakamoto’s great invention was the blockchain, not Bitcoin [reddit]

The blockchain is the underlying structure beneath the digital currency that allows everyone to reach a consensus on the ledger (who has how much money) without having to trust anyone. What Satoshi has given is a practical solution to is a problem known to computer scientists as the Two Generals’ Problem, which is as follows:

Two armies, each led by a general, are preparing to attack a fortified city. The generals must have their armies attack the city at the same time in order to succeed. Thus they must communicate with each other to decide on a time to attack and to agree to attack at that time, and each general must know that the other general knows that they have agreed to the attack plan. The problem is that to communicate with one another, their messengers must cross a valley occupied by the city’s defenders. They could be captured, and their message failed to be relayed. They could be forced to relay an incorrect message. So how do the general’s agree upon a time when they can’t trust their messengers to relay the message correctly?

The problem: how do you get a bunch of people who can’t trust each other to reach a consensus? The solution, like all great solutions, seems so intuitively obvious that you wonder why you didn’t think of it after reading it.

The idea is to make everyone work on a difficult problem, a proof-of-work, to demonstrate how much power they have. Every time someone (whether it be the generals or the enemy) solves this problem, they announce to everyone what time they want to attack, and the proof-of-work serves as a vote. Once received, everyone sets to work on the new proof-of-work problem that is based on the previous solution, such that a chain of votes is established for attacking at that time. If anyone was working on a different chain which is longer, they switch to this one because it has more work put into it and thus represents the greater majority of power.

After about two hours, the longest proof-of-work chain, which represents the majority of votes, is the consensus on the time of attack. Recall that the enemy city is still weaker than combined power of the generals’ armies, so even if they solved some problems, their proof-of-work chain could never grow longer than that of the majority (doing this is called a 51% attack). This is how both generals know the correct time of attack — they follow the longest proof-of-work chain, that of the majority.

And that is how you get a bunch of people who can’t trust each other to reach a consensus, and it has far-reaching implications for an increasingly technologically-bound society.