Blockchain: The Byzantine Generals Problem
There is a problem in computing which until very recently, had no solution. The problem is called the Byzantine Generals Problem. It essentially describes a problem in consensus-making in a system where communication channels cannot be trusted. The problem follows.
Imagine you are the general of an army for the Byzantine Empire in its heyday. You and a general of another Byzantine army decide to sack an enemy city. Both the armies approach the city from opposite sides and set up camp. The generals of the armies need to agree on an exact time to attack because the city is able to withstand the attack from only one army. The armies share a messenger which they use to communicate with each other to decide on a time to attack. However, the only way for the messenger to get from one armies camp to the other is to go through the enemy city.
This makes the messenger untrustworthy because there is no way of knowing whether the message you received from the other army is authentic. Imagine I send to the other army that I will attack Monday at 5 PM and the other general responds saying they would rather attack Tuesday, but the message is tampered with somewhere along the way. The message now says they will also attack Monday.
I am under the impression that we have reached consensus when in fact we have not. So what’s the solution?
Let’s first look at the messages themselves. They are currently being sent in plain text. This is a problem because plain text is easily manipulated. Clearly we need another system that we can use to validate that the message has not been tampered with.
First, a few terms of vocabulary. Hashing is the use of a mathematical function to convert a message into another string of characters which represents the original message. A nonce is an arbitrary number that is used only once in a hash calculation. So what does this actually look like?
Say the message I want to send is “Attack Monday.” I would then calculate the hash (using a computer) and the result would look something like this: 213c7959454dcce3794e6ebecaecf77a44c33ccabb87a4c767ae997fd982fd45.
We’ve accomplished the task of obscuring the plain text message. If I want to add a nonce to it, I would simply append my message string with the nonce and then hash. For example, “Attack Monday 30d5f.”
The general on the other side has a partial input known as a hash target that he is looking for in the hashed version of my message to confirm that the message is authentic. The other general simply hashes my (message + nonce) and compares it with his hash target. If the target is contained in the hashed message, then he can confirm the message is authentic.
Hashing happens fast. I, the sender of the message, had to spend time and computing power to produce the nonce that, when hashed with the message, will contain the hash target. There is no efficient way to compute this nonce. I simply have to try all numbers until the (message + nonce) contains the hash target. This concept is called proof of work. If an adversary were to tamper with my message, they would have to not only change the message, but they would also have to recalculate the nonce. What if the enemy city has this computing power? Then we again have an insecure channel. What else can we do?
Let’s imagine now instead of two armies on each side we have many armies on both sides. The generals on one side combine the messages of their armies into a “block.” They also combine all of their computing power to find a nonce for this block. They also make the hash target longer, therefore requiring more time and more computing power in order to calculate the nonce. Essentially what we have done is make it practically impossible for the enemy city to overcome our combined computing power to solve our problem. The more people that use the system, the more secure it becomes. The power is in the numbers.
This solution to the Byzantine Generals’ Problem was developed by a man/group (identity unknown) who goes by the name Satoshi Nakamoto. Satoshi was the inventor of the increasingly popular and groundbreaking bitcoin blockchain. The blockchain is a general solution to the Byzantine Generals’ Problem. Each army can be thought of as a node in the system. Messages can be thought of as transactions and the enemy city can be thought of as any man in the middle who seeks to alter the blockchain.
Blockchain technology has recently been touted as one of the greatest inventions since the internet. It is essentially a way to make consensus in a distributed system. It’s not just about money. It’s a very sophisticated and revolutionary way of building trust. Money is simply one of the applications. Blockchain technology has the potential to disrupt not only the finance industry but also healthcare, education, voting, and real estate among countless others. The idea of decentralized power, which blockchain technology is rooted in, has a lot of important implications many of which have yet to be imagined.