Blockchain, as simple as pineapple
In the company with which I currently work, I was asked to give a very small talk about the blockchain to everyone, both devs and sales. The latter might have a very fuzzy idea of what cryptography actually is, and not understand words like hash and signing.
So, I thought, the most sensible thing to do might be to implement a blockchain with them, live. As long as it doesn't involve any code nor maths. Only pineapples, post-its, and rhymes.
The goal was for them to grasp the key notions behind the blockchain, in very simple terms:
- Soft-branches and consensus
- Double spending and always-on requirement
- 51% attacks
Names, characters, businesses, places, events, locales, and incidents are either the products of the author’s imagination or used in a fictitious manner. Any resemblance to actual persons, living or dead, or actual events is purely coincidental. No pineapples were harmed in the making of this article.
Once upon a time, in a regular office, like any other regular office, peoples were collecting pineapples, and it turned pretty much into a competition. So they came up with a public ledger system to keep track of who got the most pineapples. (Did you just suggest they could just count the pineapples ? No can do, they are eating them, almost as soon as they get them. Pretty strange notion of collecting, I agree)
Let's dive into their public ledger system.
They stick post-it notes in lines, all around the office, to recall them of the acquisitions. One post-it noting the acquisition of some pineapples — one or more. (They got lots of pineapple, it started on the billboard, but soon escaped onto the walls and windows of the office).
It should be noted that they never actually write down an updated number of pineapples each one got, they just count this number from reading the post its, which is equivalent. It is exactly like if you listen to a full basketball game, you can count the score solely based on the commentator comments on scoring baskets. The list of operations (the ledger), and the final result holds the same information, they are equivalent.
But it would be way too easy for anyone to just stick some post-it, tampering with the counts. So they came up with an elegant system to be sure no one cheats. It is a bit similar to the children songs "Hello Operator", or "trois p'tit chats" in french. The beginning of each line use the end of the preceding line.
Each time someone got some new pineapples, she picks a post-it whose color indicates its hers, and writes down a random word on a post-it. This word must :
- have as many syllables as the number of pineapples she got, without counting the first and last syllables. So pineapple, 3 syllables means 1 pineapple. otorhinolaryngological, 10 syllables, means 8 pineapples.
- start with the syllable of the word from the previous post-it in the chain. (This is actually not a rhyme, but a stylistic device called anadiplosis, or Dorica Castra)
Her handwriting serves as an unforgeable proof of the authenticity. Like when one signs a bank check.
It wouldn't make any sense for anyone to increase the count of a rival, though. But in the real blockchains, transactions are signed
Then, she put this post-it on the counter, and everyone try to find a word with as many syllables, and rhymes with the random word written on the post-it. This seems easy, but it is actually super duper hard to come up with rhymes, and it surely takes some time. it is really a proof of work — legit.
So they go about their business, while thinking about the current rhyme to find. Until someone hits the jackpot, writes it down on the post-it, and stick it at the end the chain.
In the real blockchains, there are often incentives to compute the proof of work. Like a slice of pineapple.
Soft-branch and consensus
Sometime two people come up with rhymes, because they were on separate meetings, or whatever pineapple collectors do. And they end up with a chain with two heads : a soft branch.
They all agreed initially that the longest chain of post-it is the tru tru, the true truth, the real stuff. The longest chain represents the longest amount of rhyme searching. And because everyone has the same ability to find rhymes, the amount of rhymes searching matches with the amount of people working on a chain. Therefore, the longest chain represents the majority, and the majority should be right, it is the consensus.
So until now it is just a really convoluted way to count pineapples.
Double-spending and always-on requirement
But where it really shines, is to avoid tampering with the counts. Let's say Eve wants to modify the chain afterwards, to note that she got 2 pineapple instead of just one. It is just a matter of replacing the post-it with another one with a bigger word.
So she must find a random word of 4 syllables (first syllable, 2 syllable counting 2 pineapples, then last syllable) that starts with the syllable of the word from the previous post-it, to blend right in the chain. Easy, peasy, thought Eve. And find another word it rhymes with. Quite harder, but manageable with some time.
But to keep the chain valid, this word must also ends with the syllable of the word on the following post-it. Let's get this straight, it is absolutely impossible. That's too much, thought Eve, I better change the following post-it as well, and all the other ones, until my chain is longer, to reach the consensus.
But while she is busy finding rhymes to build an alternative branch where she is filled with pineapples, all of her coworker are also busy appending post-it on the legitimate chain. And because they are more, they can find rhymes faster. There is no way Eve is gonna catch up with them, ever.
As long as they continue looking for rhymes, obviously. If they ever stopped long enough acquiring pineapples, and putting more post-it, Eve could have the time to catch up. So if no new pineapples are coming through for long enough, they just append post-it with 2 words syllables. This is the always-on requirement.
Though, in the real blockchains, the pace of transactions is obviously way faster than the creation of new blocks — post-its, here — so there is no need for empty blocks.
But if Eve was really, really competitive to a point that she absolutely wanted to pull this off, she could invite a bunch of her friends to help her out. She would need more friends than the total number of coworkers. This clique would finding rhymes faster and actually catch up with the chain everybody else think is legitimate. Eve and her friends actually become the majority. If a majority band up together, and tries to altere the truth indicated in the ledger — compared to the reality — it is called a 51% attack.
But if that actually happens, and people start to notice it, nobody would continue believe in the ledger, and all the value held by the ledger would be lost. And everyone would be screwed, Eve and here friends as well. All these pineapples would have been wasted in vain.
Though, in the real blockchains, it is really unlikely to happen, because all the people finding rhymes — the miners — invested lots of money in rhyme-finding machines.