New class online! The world’s leading experts of blockchain participate in the course design, and learn the basic knowledge, architecture and application of blockchain in 24 weeks. Challenge cutting-edge combat project, Learning by Doing, become a sought-after blockchain engineer! Limited seats, join nowBlockchain Engineer”For more information

Translated by Tal Kol by Freecodecamp


If you were to be stranded on a deserted island with a group of strangers, what would be the best skill to master?



There may be countless answers in your mind, but today yoda is going to tell you that you can make fire to catch fish and pick fruit, which can only be covered by cold and hunger for a while. If the survivors don’t want to live in the primitive society of barter,
A stable, fair, efficient and decentralized consensus system is essential. In other words, issue some blockchain currency and enter modern society in one step.



What, a computer? Who says you need a computer to send money? All you need is a bunch of friends who are still alive, some pen and paper or something you can write with, and this article. Let’s go when we’re ready!



The story begins


Let’s go back to where the story began. Four intrepid… Unlucky: Zhang SAN, Li Si, Ah Mei and Xiao Wang, unfortunately drifted to an uninhabited island somewhere in the South Pacific.





In short, after the primitive barter life and the rampant inflation of using shells as money, (they’re not crazy enough to use stones as money)
They decided to launch an entirely new currency, the IslandCoin, to save the local economy from collapse.



To be fair, everyone will start with 100 island coins. Since plans for the mint’s construction were not yet in sight, it was decided to record ownership by pen and paper. However, after a year in which the island’s currency was monopolized by Ah Mui, the “banker”, no one could be trusted not to fiddle with the records, so no one could be allowed to monopolize the money records.
In the end, they decided on a blockchain approach, where everyone keeps a record of everyone’s money.



Currently, this is about the simplest blockchain application on the island. In the future, they may add concepts like “proof of work” or “proof of equity” — both have their pros and cons — but for now, let’s start with the simplest case.



What do our four main characters want? It’s really simple. It’s just a piece of paper with a chart on it, and the chart shows everyone’s money, and that’s it. The problem is, you can’t really have a single piece of paper with a single result. So everyone has to be equal when it comes to keeping records, and everyone has a share — this is called decentralization; At the same time, each member should have the same version — this is called “consensus”.



So, what does this paper look like?





Desert Island Survival Day1



This piece of paper is the first record that everyone agrees on — that’s why it’s marked Day one. As I said before, everyone agreed that everyone would have 100 coins at the beginning. At the same time, someone needs to write down the notes and distribute them to everyone, making sure everyone has a copy. Let Joe do the work.



Money is meant to be traded, so the amount of money held must be constantly changing. Therefore, an update for the day needs to be posted at the end of each day. To be fair, don’t always let Joe record and post the amount.

Since the recorder cannot be trusted indefinitely, there is one more important thing to do after Posting the recorder. That is, each member should confirm the update of the record separately, and sign their names if they agree to the change of the amount.
Easy, right?



So, how many people need to sign up for the day’s record changes to be finalized and approved? To reach consensus, we need a majority. Since there are currently four, a “majority” means a minimum of three signatures. This piece of paper is signed by all four people, so it’s settled.



Why don’t you need four unanimous votes?
It is possible for one member to interfere with the process.If Thursday leaves camp for a few days to fish far away, the others cannot update their current balance until he returns — giving too much power to a single member.



Why do we need a majority? Can’t four people have two signatures? If only two are needed, there may be a situation where two people (such as Zhang SAN and Li Si) support one outcome and two others (Ah Mui and Xiao Wang) support a different outcome. This would make it impossible to reach an agreement, because two different versions of the result cannot both be true at the same time.



So, everyone happily set the rules, and the first day of the blockchain economy passed like this.



Desert island survival Day2



The next morning, Ah Mui decided to buy a tomato to eat. She bought it from Sam for 2 coins. So she wrote the deal down on a piece of paper:





This is Mui’s first deal, so the deal number is #1. In addition, she had to sign the paper to make sure no one was using her name to make payments.



By the next night, it was time to update and post everyone’s balance. On the first day, John wrote and asked for everyone’s signature. And then as long as you take turns doing it, it seems reasonable, right?



So we reached an agreement, according to Zhang SAN -> Li Si -> Ah Mei -> Xiao Wang -> Zhang SAN -> Li Si…. It’s a cycle like this, taking turns. This means that Li Si should release the update of the fund balance of the day the next day. So he included Ah Mui’s trading information in the day’s update:





The paper written by Li Si is not final, because only one person, li Si himself, signed it. He also needs to ask other members to confirm the updates and sign them.



Of course, it’s an easy thing to confirm.



First, the validator can take out the record data in his possession and look at the final record data of the last item above (the current one, which is the data of the first day).



Next, the validator checks the list of new transactions for the day. There was only one trade message from Ah Mui that day. This information is also easy to confirm, as long as you confirm that the note is indeed signed by Ah Mui, and according to the records of the previous day, Ah Mui’s balance also has enough coins for Zhang SAN to complete the transaction.



Once each islander had completed his verification process and signed the paper, He had the final version of the next day’s balance, which he distributed to everyone, everyone making sure they had an identical copy, and everyone could rest happily and contenfully.



This is the end result of day two:

Day3 of Survival on Desert Island



By day three, the system looked great and everyone was eager to trade. Zhang SAN is going to buy some firewood from Li Si for 10 yuan, Li Si is going to buy some tablets from Wang for 25 yuan, and Wang is going to buy tomatoes from Zhang SAN for 2 yuan. They each wrote down the transaction information:





As night falls, ah Mui is in charge of publishing the accounts today. To ensure that Ah Mui will include her trading information, everyone has to give ah Mui a slip of trading information. Of course, generally speaking, trading information needs to be broadcast to everyone, because when you trade, you don’t always remember who is responsible for Posting updates today.



However, Wang was dragging his feet on the matter. By the time he gave the transaction information to Ah Mui, the transaction information of the day had already been written and signed:



Wang was blindsided that his trading information was not included. This means that Zhang SAN did not receive the money transfer from Wang that day, so he will not give wang the ordered tomatoes. So the unfortunate xiao Wang could only go hungry that night.



Hungry, Wang refused to sign the paper and ran angrily out of the camp, muttering about what he wanted to find for himself. Fortunately, Ah Mui has already got enough signatures from other members:



Ah Mui got three signatures, each of whom confirmed that the recorded balance and transaction information were accurate and matched the previous day’s record. By majority rule, today’s numbers are settled.

Desert Island Survival Day4



On the fourth day, everything was normal — except that no one knew where Xiao Wang had gone. He had gone out fishing the night before, and there had been a storm, and he had not returned to camp all night. This is a little trouble, after all, the fourth day should be responsible for the statistics and release of the day’s fund changes.



Ah Mui wanted to make some deals, so she wrote down the information and passed it on to everyone:



In the evening, Xiao Wang still didn’t show up. According to the order set before, today should be Xiaowang to count, but we still can not find him. So the rest of the day took turns and nothing moved.

Desert island survival Day5



The fifth day came, and it was Zhang SAN’s turn. Because the weather in the past two days has not been very good, wet everywhere, Zhang SAN hopes to change a dry and warm place to sleep. He wanted Li Si to help him build a wooden shed, and Li Si offered 200 yuan. The problem is, Joe only has 92 coins. What can he do? Zhang SAN suddenly had a bold idea.



Zhang SAN feels, anyway today is he is responsible for the statistics trade balance information, why not directly fight a big, bicycle changes motorbike, ah not, empty hand covers the hut. So he wrote 200 coins directly to Li Si:





Besides, there were no other deals for the day. However, because of yesterday’s rotation, ah Mui’s two transactions, as well as xiao Wang’s transactions that were not included the day before yesterday, will be recorded today. So, Zhang SAN mixed his own records in the middle, hoping to get away with it:





Even or not, Joe had the nerve to sign it anyway. But he didn’t have to say it alone. He needed two more signatures. When Li Si and Ah Mui saw the list, they soon found the discrepancy in the balance: On the third day’s balance, Zhang SAN only had 92 yuan, how could he send 200 yuan to someone else?



They all refused to sign and asked Zhang SAN to correct the record. Zhang SAN reluctantly deleted the record and recalculated everyone’s balance:







Ah Mui and Li Sisi finally signed their names.



With three signatures, the fifth day’s transaction was recorded.



Desert island survival Day6



On the morning of the sixth day, Xiao Wang shuffled back to camp. He struggled for his life in the storm these days. It couldn’t be worse. After missing these two days, he wasn’t even sure how much money he had left. But as soon as he got back, he asked someone and had no trouble getting his hands on the deals posted on the third and fifth days.



It is easy for Wang to confirm recent transactions and that his balance has not been tampered with. Because these pieces of paper had at least three signatures, based on the transactions recorded on them, he could make a simple calculation using the data he kept for the next day and be sure that on the fifth day all the balances were correct.



So, Wang’s camp life went back to normal.





Desert island survival version of the blockchain story





Overall, the system works satisfactorily. Yes, it’s a bit shabby, but it’s perfectly adequate for the four islanders who have to live here. However, to use blockchain to issue money, how can there be no white paper, so all of us drafted and officially released a great white paper:







Some readers may ask, after all, what does this have to do with blockchain? Let me explain:



  • A balance sheet for the day, published every day, is one
    Block.
  • Each block is numbered and points to the previous block — that is, the previous day’s balance table — and forms one
    The chain.
  • To verify that any block of data is correct, you only need to start at the beginning of the chain (the first day’s data, i.e
    The foundation block) To start, the calculations are made in order according to the data within each block. All balances are increased and decreased day by day.


So is this the ideal blockchain implementation?Probably not, because there’s so much that can be optimized. For example, this may only support 4 users at first, what if new people come in? How do you adjust to accommodate them? Meanwhile, the blockchain is now
Need permissionIs it possible to convert to a non-permissive chain? And if you want to introduce
Proof of workOr,
Interest inHow to change the mechanism of the



Well, that might be worth another discussion later, but today, let’s just rest our four champions.


New class online! The world’s leading experts of blockchain participate in the course design, and learn the basic knowledge, architecture and application of blockchain in 24 weeks. Challenge < digital identity management >< Ethereum smart contract >< private chain notary service >< blockchain architecture >< supply chain and data audit > and other actual combat projects, Learning by Doing, become a hot blockchain engineer! Seat limit, click”Blockchain Engineer”For more information