The positioning of this article will be more popular science, trying to explain the basic principles of Bitcoin using analogies, without involving the more detailed parts of the algorithms and protocols.
In this article, there will be a virtual village called ‘Bit village’, and the story will gradually tell everyone about the motivation proposed by Bitcoin, the problems it solves, and some key components, goals, and design plans.
Let’s start with the motivation behind the creation of Bitcoin.
In this world, there is a small village called Bit village, with hundreds of households. This village is almost isolated from the world and lives a self-sufficient life. Because there is no large-scale trade, the villagers of Bit village have always lived a barter life, that is, there is no unified currency used among the villagers, and the trade between them is basically that Old Zhang takes a bag of flour to exchange for an Old Li’s sheep, or that Big Sister Wang takes a basket of wild fruits to exchange for Aunt Liu’s two feet of cloth. The villagers have been living such a simple life.
Finally, the villagers found it too inconvenient to trade goods for goods all the time, so the whole village held a meeting to discuss how to solve this problem. Someone proposed that for the sake of divisibility and rarity, such as gold, as a general equivalent, to compile a table of the corresponding relationship between other items and gold, such as one gram of gold for one sheep, one gram of gold for a bag of flour, etc. At this time, Old Zhang no longer needed to carry a bag of flour and breathe heavily to go to Old Li’s house to exchange for a sheep. He just needed to take out one gram of gold from his home to go to Old Li’s house and take back a sheep. And Old Li, holding this one gram of gold, can exchange for a bag of flour from anyone willing to part with flour, of course, or for any item that is equivalent to one gram of gold.
At this time, Bit village entered the era of physical currency.
The good times did not last long, and after a period of time, the disadvantages of the physical currency also emerged. Because there are not many gold mines near Bit village, mining and smelting gold is too time-consuming and labor-intensive. Moreover, with use, gold is always subject to wear, loss, or intentional hoarding by some, resulting in损耗. The whole village gathered together again to discuss countermeasures. At this time, someone said that in fact, everyone does not necessarily have to use real gold. Just find a piece of paper, write ‘one gram of gold’ on it, as long as the whole village recognizes this paper as equal to one gram of gold, the problem would be solved. Others expressed their agreement, but at the same time, they also had a new problem: real gold needs to be mined and smelted, and the gold mines are limited, and mining and smelting also require costs, so no one can produce a large amount of gold out of thin air in the short term. But writing is different, as long as I have enough paper and pens, I can write as much as I want. This has become a competition of who has more paper at home, and it might end up that ten thousand pieces of paper are needed to exchange for a sheep (in fact, this is what happened in the economic inflation).
It’s true to think so. However, at this time, someone proposed a solution: this paper is not valid for anyone to write, we only recognize the paper written by the respected old village chief, whom everyone recognizes. The old village chief wrote some paper, at the same time distributed an equal amount of paper to each household according to the gold reserves, for example, Old Zhang’s family had two hundred grams of gold, the old village chief issued two hundred pieces of paper written with ‘one gram of gold’ to Old Zhang, and at the same time took away Old Zhang’s gold as collateral. In this way, the old village chief collected all the gold in the village into his own home and issued paper with the value of the gold each household handed in. At this time, the villagers could use these papers as gold for trade, and everyone recognized the old village chief’s handwriting, which others could not forge. In addition, if anyone’s paper was worn too severely, they could exchange it for new equal-value paper with the old village chief. In addition, the old village chief promised that anyone who wanted to exchange for real gold could get an equal amount of gold back by returning the paper. Because the amount of gold on the paper written by the old village chief was the same as the real gold kept at home, as long as the principle of destroying as much paper as written was strictly followed, every valid paper could always be exchanged for the corresponding real gold.
At this time, Bit village entered the era of symbolic currency (paper money), and the old village chief took on the roles of government and bank.
A few years later, the old village chief, due to the need to verify a large number of old paper money every day, write new paper money, and carefully record various accounts, overworked and unfortunately passed away.
Bit village held a general meeting again to discuss what should be done. At this time, the son of the old village chief, Er Gouzi, volunteered to take over his father’s pen and take on the responsibility of currency issuance. This young village chief, Er Gouzi, was very clever. After a few days, he found that it was not necessary to write so many papers. It could be done like this: the villagers handed in their paper money, destroyed it, but Er Gouzi would record the amount of paper money each household handed in. In the future, if there was a payment to be made, for example, Old Zhang wanted to exchange one gram of gold for an old sheep with Old Li, they would call Er Gouzi together to explain that one gram of gold under Old Zhang’s name should be transferred to Old Li’s name. Er Gouzi would take out the ledger, check if there was one gram of gold under Old Zhang’s name, and if there was, subtract one gram from Old Zhang’s name and add one gram to Old Li’s name, thus completing the payment. At this time, Old Li could rest assured that Old Zhang would take the sheep away after hearing Er Gouzi confirm the transfer over the phone.
At this time, the Bitcoin village entered the central system Online casino and How to find it era. Each villager does not need to use physical payment, and the payment process has become the change of numbers in the ledger maintained by the second dog.
The newly appointed second dog was clever, but sometimes he was clever and made a mistake. One day, the second dog was staring at the ledger, thinking that he could decide how much money each household in the village had, and then he thought, ‘Then I would…’. He got excited and privately transferred ten grams of gold from Old Zhang’s account to his own name.
He thought it was perfect, but he didn’t expect that Old Zhang also had the habit of keeping accounts. One day, when he was about to pay, he was told by the second dog that there was no money in his account. Old Zhang checked his ledger and found that he still had ten grams. He then took the ledger to argue with the second dog, and found that there was a transfer that was not agreed upon by Old Zhang.
The lid was blown off! The Bitcoin village was in an uproaronline casino help and Where is it. It was inevitable that the second dog would be impeached. However, through this incident, everyone discovered the disadvantages of the ledger being concentrated in one person’s hands:
This system is completely dependent on the personal credit of the ledger holder. If this person does not follow the rules and arbitrarily alter the ledger, the entire monetary system will collapse.
If this person’s house catches fire or the ledger is stolen, it will also bring a devastating blow to the entire system.
When people were at a loss, a宅男 scientist named Satoshi Nakamoto in the village took the stage and told everyone that he had designed a system called Bitcoin, an Online casino and How to find it that does not rely on any central processor, which can solve the above problems. Then he slowly explained his plan.
Let’s take a look at how Satoshi Nakamoto designed this system.
Satoshi Nakamoto first explained that the existing ledger needs to be modified as follows:
The ledger no longer records the balance of each household, but only records each transaction. That is, it records the payer, payee, and payment amount of each transaction. As long as the initial state of the ledger is determined, each transaction record is reliable and has a chronological order, and the amount of money each person holds can be calculated.
The ledger changed from private to public, and any villager could obtain the current complete ledger as needed. The ledger recorded all transactions from the creation of the ledger to the present.
Upon hearing this, the crowd below immediately exploded. The first one was okay, but the second one was simply unacceptable because the ledger recorded all the transactions of the villagers, wasn’t everyone’s privacy fully exposed?
Satoshi Nakamoto was not in a hurry and took out a pair of strange things.
Satoshi Nakamoto said, ‘Don’t panic, everyone. Under this system, no one uses their real identity for transactions, but instead uses a unique code for transactions.
He showed a神奇的东西 in his hand, saying that the two things were called Confidential Seal and Seal Scanner. He will give each household in the village a Confidential Seal and a Seal Scanner later. The functions of the two are as follows:
保密印章可以在纸上盖一个章,每个印章盖出的章都隐含了一个全村唯一的一串字符,但是凭肉眼是看不出来的。也无法通过观察来制造出相应的印章。lottery plan and The latest plan
印章扫描器可以扫描某个已经盖好的章,读出隐含的信息,并在液晶屏上显示出一串字符。
有了这两个神奇的东西,大家就可以在不暴露真实身份的情况下进行交易了,而印章隐含的那一串字符就是这户人家的代号。具体如何巧妙利用保密印章和印章扫描器进行交易,会在下文详述。
下一步,中本聪面向全村招募虚拟矿工,招募要求如下:
矿工以组为单位,一组可以是单独的一户,也可以是几户联合为一组
成为矿工不影响正常使用货币
矿工每天要花费一定时间从事比特币“挖矿”活动,但是不同于挖金矿,虚拟矿工不需要拿着工具去野外作业,在家里就可以完成工作
矿工有一定可能性获得报酬,在挖矿活动中付出的努力越多,获得报酬的可能性越大
矿工可以随时退出,也可以随时有新的矿工加进来
很快,大约有五分之一的村民加入比特币矿工组织,共分成了7个组。
下面,中本聪宣布,先根据二狗子手里的账簿,把抵押的所有黄金按账簿记录的余额退还给每位村民,然后彻底销毁这本账簿。
然后,中本聪拿出一本新账簿,在账簿的第一页上记录了一些交易记录,特别的是,这些记录的付款人一栏全都是“系统”,而收款人分别是每个印章对应的隐含字符,代表初始时刻,系统为每一户默认分配了一定数量比特币,但是数量非常少,都只有几枚,甚至有些不幸的村户没有获得比特币。
接着中本聪说,由于目前市面上比特币非常少,大家可以先回到用黄金做货币的时代,由于我不是村长,我也没有权利强迫大家一定要承认比特币,大家可以自行决定要不要接受比特币。不过随着比特币的流动和矿工的活动,比特币会慢慢多起来。
做了这么多铺垫,终于说到重点了,下面说一下在这样一个体系下如何完成支付。以老张付给老李10个比特币为例。
付款人签署交易单
为了支付10个比特币,老张首先要询问老李的标识字符串,例如是“ABCDEFG”,同时老张也有一个标识字符串例如是“HIJKLMN”,然后老张写一张单子,内容为“HILKLMN支付10比特币给ABCDEFG”,然后用自己的保密印章改一个章,将这张单子交给老李。另外为了便于追溯这笔钱的来源,还要在单子里注明这笔钱的来源记在哪一页,例如这个单子里,老张的10比特币来自建立账簿时系统的赠送,记录在账簿第一页online casino entrance and How to find it。
After Old Li receives this document, he needs to confirm that the document is indeed signed by the person ‘HIJKLMN’ (that is, Old Zhang). This is not difficult. Because the document must have a secret seal. Old Li takes out the seal scanner, scans the seal, and if the characters displayed on the liquid crystal screen are consistent with the payer’s characters (here ‘HIJKLMN’), he can confirm that the document is indeed signed by the payer. This is because according to the mechanism of the secret seal, no one else can forge the seal, and anyone who scans the seal can confirm whether the payer and the seal are consistent on the document.
This system still has some problems. Although the recipient can confirm that the payer has indeed signed this document through the secret seal, they cannot confirm on their own whether the payer has enough balance to pay. In the previous central Online casino and How to find it system, Doggus was responsible for checking the payer’s balance and notifying the recipient whether the transaction was valid. Now that Doggus has been fired, who is responsible for keeping records and confirming the validity of each transaction?
As mentioned before, the system designed by Satoshi Nakamoto is a decentralized currency system that does not depend on any central figure, so there will not be one or a few people responsible for this. The final responsibility for this work falls on the miner organization mentioned earlier. Old Zhang, Old Li, and all other villagers who use Bitcoin for transactions depend on the work of the miner organization to complete transactions.
The miner’s work is the core of the entire system and the most complex part. Below, we will gradually introduce the content and purpose of the miner’s work.
As the saying goes, ‘If you want to do a good job, you must first prepare the tools.’ Although Bitcoin miners do not use tools such as iron picks, shovels, and spotlights, they still need some essential items.
Initial ledgersports betting tutorial and How to find it. Each group first makes a copy of the initial ledger, which only has one page and records the first gift of the system
Empty ledger paper. Each group has a certain number of ledger papers, and each page only has the ledger structure without content filled in. The specific rules for writing content will be described later. Below is the appearance of an empty ledger paper, and the meanings of each field will be explained later
Encoding generator (hash function). Satoshi Nakamoto also distributed several encoding generators to each component of the miner organization. This thing is amazing; when you put a ledger page filled with content into this machine, the machine will automatically print a string of ‘0’ and ‘1’ numbers in the ‘Current Bill Number’ column, totaling 256. The most amazing thing is that the encoder has the following functions:
The generated number is only related to the content filled in the ledger paper, and has nothing to do with the person filling it, the font, the time of filling, and other factors.
The numbers generated by ledger papers with the same content are always the same, but if even one character of the content is changed, the number will be completely different.
When the encoder prints the code, it also needs to put all the transaction lists filled in the ledger paper into it. The machine will scan the consistency of the transaction lists and the filled transaction lists, especially the confidentiality seal. If it is found that the confidentiality seal and the payer are inconsistent, it will refuse to print the code.
Place a printed ledger page into the machine, and the machine will determine whether the number is a valid machine print and whether the number and content are consistent. This number cannot be forged.
Transaction list receiving box. Each miner group needs to hang a box at the door to collect transaction lists.
Notice board. Each miner group also needs a notice board to公示 some information.
With the above tools, the miner organization can start working!
Satoshi Nakamoto stipulated that the initiators of each transaction must not only give the transaction list to the payee but also simultaneously send several identical copies of the transaction list to the inboxes of each miner group.
The members of the miner group regularly go to their inboxes to collect all the transaction lists they have collected.
At this time, the members of the group take out an empty ledger page and fill in these transactions in the ‘transaction list’ column, and find the last page of the current ledger and copy the number on the last page to the ‘previous bill number’ column. Note that there is also a ‘lucky number’, which can be filled with any number, such as 12345. Then, put this ledger page into the number generator, print the number, and one ledger is completed.
If you think that the work of miners is as simple as that, then you are deeply mistaken. Satoshi Nakamoto has a weird rule: only if the first 10 numbers of the number are all 0, this ledger page is considered valid.
According to the previous description of the number generator, to modify the number, you can only modify the content of the ledger paper, and the ‘transaction list’ and ‘previous ledger page number’ cannot be changed arbitrarily, so you can only change the lucky number. Therefore, in order to generate a valid ledger page, the miners in the group continuously copy the ledger paper, but each paper has a different lucky number, and then continuously repeat the process of putting the paper into the encoder. If the generated number does not meet the requirements, this paper is considered wasted, and repeat this process until a valid number sequence is generated.
We know that if every digit of the number is random, then on average, you need to write more than 1000 pieces of paper with different lucky numbers to get a valid number.
This is strange, why do these miners work so hard on something that seems meaningless? Remember that miners are paid, and this is their motivation. Satoshi Nakamoto stipulated that the first transaction on each ledger page is ‘The system pays this group 50 bitcoins’. That is to say, if you generate a ledger page with a meaningful content and it is accepted by all mining groups, then this transaction is also accepted, and your mining group earns 50 bitcoins.
This is why miners are called miners, and why it was said earlier that with the activities of transactions and miners, the number of bitcoins will keep increasing. For example, the following is a mining process, and the public bitcoin account number of this group is ‘UVWXYZ’.
When the lucky number is tried to ‘533’, the system generated a valid ledger page.
When a mining group is lucky enough to generate a meaningful ledger, they must immediately ask other groups to confirm their work to receive the reward. As mentioned before, there are currently 7 mining groups in the village, so this group must copy the valid ledger paper 6 times and send them quickly to the other 6 groups for confirmation.
Satoshi Nakamoto stipulated that when a group receives ledger paper from another group, they must immediately stop their mining work to confirm the ledger.
There are three pieces of information to be confirmed:
The ledger number is valid
The previous page of the ledger is valid
entrance lottery entrance and The latest entrance
The validity of the transaction list
First, let’s look at the first one, which is relatively simple to confirm. Just put the ledger paper sent to the encoding generator for verification, and if the verification passes, the number is valid.
The second part requires comparing the ‘previous ledger page number’ on the ledger page with the last valid ledger page number currently saved by this group. If they are the same, confirmation is made. If different, it is necessary to compare forward from the existing ledger until the page with this number is found. If the specified ‘previous ledger page number’ does not correspond to a page, this group will discard this page and not confirm it.
Note that the above mechanism ensures that if the ledger papers in each group are the same, they can be bound into the same ledger in the same order. Because the number of the next paper always depends on the number of the previous paper, the mechanism of the encoding generator ensures that the relative order of all legitimate ledger papers is the same in each group (there may be branches, but no loops, to be elaborated later).
How to confirm the validity of the transaction list is essentially to confirm that the payer of each transaction has sufficient balance to pay this amount. Since the transaction information includes how the money came about, as well as the bill number of the source transaction. For example, HIJKLMN needs to pay 10 bitcoins to ABCDEFGH, and it is noted that these 10 bitcoins come from a previous transaction paid to HIJKLMN by OPQRST. When confirming, it is first necessary to confirm the existence of this previous transaction, and at the same time, check that HIJKLMN did not pay these 10 bitcoins to someone else before that. After all these confirmations, the validity of this transaction is confirmed.
The first transaction is the 50 units awarded by the system to the group that generated this ledger page, which is universally recognized. Following this, transactions can be traced back according to the aforementioned method to confirm whether there are indeed 10 bitcoins paid to ABCDEFGH.
If all the above validations are completed and passed, this group will recognize the validity of the above ledger paper, then integrate this ledger paper into the group’s main ledger, abandon the current ongoing work, and the subsequent mining work will be based on this updated main ledger.
For mining groups, after sending out ledger papers, if they receive ledger papers from other groups later, and the ‘previous ledger paper number’ is that of the ledger paper they sent out earlier, it means that their work has been recognized by other groups, because other groups have continued to work based on their ledger papers. At this point, it can be roughly said that they have received 50 bitcoins.
In addition, any group that generates a valid ledger paper or confirms another group’s ledger paper will write the latest transactions recognized by this group to the bulletin board. Once the payer finds that the relevant transactions have been recognized by various groups, it can be considered that the money has reached their account. After that, they can point to this transaction as the source of money when making payments.
That is the entire payment system of Bitcoin. Next, let’s analyze why this system can work and what risks it may face.
Although the basic operation rules of Bitcoin have been explained above, the villagers still have many doubts. Therefore, Satoshi Nakamoto specially held a Q&A session to answer common questions. Below is a summary of the most concerned issues by the villagers.
What should be done if two legally valid ledger pages are received at the same time?
Note that in the above operation mechanism, various mining groups work in parallel, so it is possible to have such a situation: a group receives two different ledger pages, both based on the last page of the current group’s main ledger, and both are completely legal. What should be done?
Regarding this issue, Satoshi Nakamoto said that the group should not organize the ledger in a linear manner, but should organize it in a tree-like manner. At any moment, the current longest branch should be the main ledger, but other branches should be retained. For example, if a group receives two ledger pages, A and B, which are both legally valid, the group should organize the two pages in a forked form, as shown in the following figure:
Black represents the current ledger main branch. At this time, you can arbitrarily choose a page as the current main branch, for example, choosing A:
At this point, if there is a new ledger page based on A, then this main branch will continue:
If this main branch continues to exist, it means that everyone basically takes A as the main branch, and B will be forgotten. However, it is also possible that B suddenly becomes longer:
So we need to take the B branch as the current main branch and proceed with subsequent work based on this branch.
From a local perspective, although the main branches of various groups’ ledgers may be inconsistent at a certain moment, the general direction is consistent. Those occasional small branches that arise due to different synchronization will quickly be submerged in history.
What if someone in the mining team forges the ledger?
Regarding this issue, Satoshi Nakamoto said that as long as most of the miners in the mining organization are honest, the system is reliable, and gave specific answers in several aspects.
Firstly, based on the confidentiality seal mechanism, no one can forge another person’s identity to make a payment, because the encoding generator will check all transaction receipts during the printing of the encoding, and if the seal and the payer are inconsistent, it will refuse to print.
And honest miners will not recognize illegal transactions (such as a transaction where the payer’s balance is insufficient).
So there is only one possible attack behavior, that is, to establish another transaction from another branch after the recipient confirms the receipt, cancel the previous payment, and pay the same amount of money to another person (that is, the so-called double-spending problem). The following example is used to illustrate this problem.
Firstly, let’s assume that there is an attacker who has 10 bitcoins, he is preparing to pay this money to two victims A and B at the same time, and both are recognized.
The first step is that the attacker is preparing to buy 10 bitcoins of gold from victim A, he signs the transaction to victim A, and transfers 10 bitcoins to victim A.
The second step is that this transaction is confirmed on the latest ledger page and announced by each mining team. Victim A sees the announcement, confirms that the bitcoin has been received, and gives the attacker gold equivalent to 10 bitcoins.
The third step is that the attacker finds the ledger, makes a branch from the previous page of the ledger page containing the just completed transaction, generates more ledger pages, exceeding the just completed branch. Since at this point the branch just created by the attacker has become the main branch, and the branch containing victim A receiving the money has become a side branch, the mining organization no longer recognizes the just completed transfer, and the 10 bitcoins received by victim A are canceled.
The fourth step is that the attacker can sign the transaction again and pay the same amount of money to victim B. After victim B confirms that the money has been received, he pays the attacker gold equivalent to 10 bitcoins.
By this time, the attacker has spent 10 bitcoins twice, buying equivalent gold from two victims. The attacker can also do the same, cancel the transfer with victim B, and pay the same amount of money to another person…
Regarding this attack, Satoshi Nakamoto’s solution is to suggest that the recipient should not confirm the completion of the transaction immediately when the announcement is posted, but should wait for a while, wait for each mining team to post another 6 confirmation ledger pages, and the previous ledger pages have not been canceled, then confirm that the money has been received.
Satoshi Nakamoto explained that the previously set abnormal numbering rules were exactly for the purpose of defense. According to the previous description, generating a valid ledger page is not that simple, it requires a lot of manpower to repeatedly try different lucky numbers, and the process is completely a matter of luck. If a ledger page contains the confirmation of the money you received and is followed by another 6, it is very difficult for an attacker to catch up with the current main branch from another branch 6 pages behind, unless the attacker has a lot of manpower, exceeding the sum of the manpower of all honest miners.
而且,如果攻击者有如此多人力,与其花这么大力气搞这种攻击,还不如做良民挖矿来的收益大。这就从动机上杜绝了攻击的形成。
比特币会一直增加下去,岂不是会严重通货膨胀
中本聪说,这一点我也想到了。前面忘了说了,我给矿工组织的操作细则手册会说明,刚开始我们协议每生成一页账簿,奖励小组50个比特币,后面,每当账簿增加21,000页,奖励就减半,例如当达到210,000页后,每生成一页账簿奖励25个比特币,420,000页后,每生成一页奖励12.5个,依次类推,等账簿达到6,930,000页后,新生成账簿页就没有奖励了。此时比特币全量约为21,000,000个,这就是比特币的总量,所以不会无限增加下去。
没有奖励后,就没人做矿工了,岂不是没人帮忙确认交易了
到时,矿工的收益会由挖矿所得变为收取手续费。例如,你在转账时可以指定其中1%作为手续费支付给生成账簿页的小组,各个小组会挑选手续费高的交易单优先确认。
矿工如果越来越多,比特币生成速度会变快吗
不会。中本聪解释,虽然可以任意加入和退出矿工组织,导致矿工人数变化,每个矿工也会拿到一个编码生成器,不过我已经在编码生成器中加入了调控机制,当前工作的编码生成器越多,每个机器的效率就越低,保证新账簿页生成速率不变。
虽然每个人的代号是匿名的,但如果泄露了某个人的代号,账簿又是公开的,岂不是他的所有账目都查出来了
确实是这样的。例如你要和某人交易,必然要要到他的代号才能填写交易单。因为收款人一栏要填入那人的代号。不过中本聪说可以提供无限制的保密印章,建议每一次交易用不同的保密印章,这样查账簿就追查不到同一个人的所有账目了。
答疑完毕。
本文用通俗比喻的方式讲解了比特币的运行机制。有几点需要说明:
为了便于理解,做了很多简化,因此有些机制细节和实际的比特币可能不完全相同。但总体思想和关键原理是一致的。
由于很多计算机世界的东西(如公钥体系、网络传输)在现实世界中并没有特别好的对等物,所以故事里难免有一些生硬和不合常理的细节。
本文描述的是比特币网络本身的技术原理和运作机制,当在如Mtgox这种买卖市场中进行比特币交易时,市场做了中间代理,并不遵从上述机制