Original link: http://catcoding.me/p/bitcoin/
Recently I read some materials related to blockchain, Ethereum and Web3, not because I want to work in this field, but I want to know a little about technical hotspots.
Write an article to exercise Feynman’s learning method by the way, I want to use plain language to explain my understanding. If I can make a person who doesn’t understand computers also roughly understand what blockchain is about, then I will succeed. In order to make this article complete, I will also add specific explanations for technicians to identify whether my understanding is wrong.
trade in the village
Bitcoin is nothing new, it is not difficult for people with technical background to understand, but it is not easy to understand for people who do not know much about computers. So how does money and transactions work in reality, assuming there are no computers?
The emergence of money is essentially for transaction, the exchange of value . It is obviously inconvenient for two people to trade, from ancient times to barter. Later, the exchange of shells, etc. appeared, and gradually people began to use precious metals, such as gold as a standard exchange. As a result, things like gold became standard currency, but gold was obviously not portable, so paper money appeared.
At present, we must conduct currency transactions through a central node, which is the bank. We only need to understand that any transaction is recorded in a huge center.
An essential problem that needs to be solved is that every cent of my money cannot be spent twice.
Now suppose a village, in order to conduct transactions, the village has a transaction recorder, and all the villagers have to use this person to record the transactions. So what’s the problem?
Suppose two farmers, A and B, want to conduct a transaction, C is the transaction recorder, and A and C have a good personal relationship, so even if A transfers a sum of money to B, C does not deduct the money from A’s account, so A may create an extra sum of money out of thin air.
C is unreliable as a central point, no single person can be trusted, and a central node means corruption and abuse of power . While oversight may play a role, there is no question of who is in charge of the oversight body. So how can we break the center point?
There was a smart guy named Satoshi Nakamoto in the village who came up with this idea:
Since one trader is unreliable, we need multiple traders, anyone can become this role, the number can be increased indefinitely, and their status is equal.
Based on this premise, if there are enough traders, then theoretically we can trust this trading mechanism. Because anyone can be a trader, transaction records are not only stored in one person’s hands, but can also be reviewed by others.
How to achieve it?
He invented a virtual currency, and if a villager wanted to own this currency, he became a virtual currency trader. Each trader holds a book in his hand, which records the transactions of all virtual coins in the village. These traders synchronize transaction records with each other. For example, Trader A has recorded 99 pages so far. Trader B has recorded 101 pages, so A will copy two new pages of transaction records from B, and the latest transaction record will be in the page with the longest page number.
It can be seen that there is a lot of repeated communication, but for the sake of safety and efficiency, we will not consider it. So how to prevent transaction records from being maliciously altered? Satoshi Nakamoto invented a lottery machine. If a trader enters a page into the lottery machine, the lottery machine will calculate a ciphertext based on the content of the page.
This ciphertext is attached to each page of the transaction book, and each page is also attached to the ciphertext of the previous page, so that if a malicious trader modifies the record, he must also obtain the corresponding ciphertext again. But this can’t be linked to the next page, so he has to revise the next page too, and get the majority of the village to approve the change.
Well, then the next question is who is responsible for the first new page. If it is a fixed person every time, there will inevitably be a central node problem. Therefore, Satoshi Nakamoto stipulated that every Sunday is a trading day, and then within a week, traders try to collect the transaction records that occurred in the village during this period in their new page.
If there are multiple traders whose records fill a page, how to decide which trader’s page is the new page recognized by the system?
Satoshi Nakamoto still uses the lottery machine. Every time the trader enters his page into the lottery machine, and then presses the button to shake the dice, a number will appear after pressing it, and only if the number 1 appears 5 times in a row. The corresponding ciphertext will be generated. So he can add this new page to the trading book and inform other traders.
Predictably, traders felt that the game of shaking dice was mindless and boring, so Satoshi Nakamoto said that every time the trader who successfully joined the new page would get a virtual currency.
At the beginning, only a few people were playing this virtual currency game, but as time went on, more and more villagers recognized this currency, and some people bought virtual currency with money even if they did not become traders. Have some virtual currency.
Every day, many people collect everyone’s transactions at the head of the village, and then go to the lottery machine to shake the dice. Because the competition was too fierce, Satoshi Nakamoto increased the difficulty in the second month, requiring 10 consecutive rolls of the number 1 to add a new page, and it increased every month thereafter, and the number of virtual coins obtained was halved.
bitcoin
That’s one absurd metaphor I can think of to describe Bitcoin, because from a technical point of view, Bitcoin is really kind of absurd. There are countless high-performance computers doing such riddle-like calculations every day just to decide who records new transactions.
Security, efficiency, and decentralization cannot be achieved at the same time , and it is clear that Bitcoin sacrifices efficiency for decentralization and security. Bitcoin will add a new block every 10 minutes or so, and the size of each block is limited by Satoshi Nakamoto to a maximum of 1 megabyte, and a block can accommodate up to 4096 (1024000/250) transactions, which can be said to be extremely inefficient.
Let’s see that a block in Bitcoin contains the following main contents, the Header can be used to verify whether the block is legal, and the transaction records contained in the block:
The essence of mining is to guess the number, guess a number (called nonce in the header) and the transaction content of the block after sha256 calculation, the first N bits of the hash are 0, and the block is also concatenated with this hash value.
Of course, the meaning of this guessing number is not limited to deciding who will record the new block, but also to prove the workload (Proof of Work) . It takes so many computing resources to calculate a compliant block, it can be said that every block is digital gold.
In addition, this workload proof has another feature, that is, it is easy to verify, because as long as the content of the nonce and block is known, a hash calculation is performed to know whether it is legal, so that other nodes can quickly verify it.
If a malicious attacker wants to tamper with the content of the block, he also has to generate a compliant block according to such rules, so it also requires a lot of computation and must be approved by most nodes, which makes the probability of malicious tampering almost impossible. .
And over time, this N will become larger, so the probability of each guess will be lower, and the mining difficulty will be higher. When Bitcoin was initialized, a set total amount of about 21 million was said to have been mined 90%, and it is expected to be mined in 2140. If after mining, the reward for mining can only be the handling fee, but at that time whether the handling fee can still make people want to mine, then no one knows.
From the current point of view, Bitcoin mining consumes a huge amount of energy every year:
With the policy of banning mining that came out some time ago in China, it can be seen that the majority of network hashrate has been transferred to the United States:
For the specific details of Bitcoin, you can check out Satoshi Nakamoto’s original paper Bitcoin, A Peer-to-Peer Electronic Cash System
decentralization
Bitcoin is the practice of Satoshi Nakamoto’s utopian feelings, and it can successfully break the circle. However, the possibility of Bitcoin becoming a world currency is extremely low, and the low transaction efficiency is one reason. On the other hand, the government, as the center of the real world, does not want virtual currency to replace legal currency. For example, the United States hopes to continue to defend the credit of the dollar so that it can continue to harvest, while China believes that this virtual currency cannot be regulated.
Even so, in recent years, more and more people have begun to pay attention to the blockchain, and decentralization has become people’s expectations for the future.
If you throw away your paranoia about specific concepts, the biggest blockchain practice in reality should be Git. All Git commits are traceable and distributed. We submit new records through the Git client (or Modify the history node), but in practice Git usually has a central node, such as the Linux kernel needs the kernel team to maintain the only recognized branch in the world.
I think what is more important is equality and freedom based on consensus. Blockchain, decentralization, and smart contracts are all means.
Both centralization and decentralization are two basic ways of organizing nature. In nature, centralized organization methods include monkeys, wolves, bees, etc. These organizations have hierarchies and division of labor. Human society usually adopts a centralized organization method. A country, a company, and a social platform on the Internet all have a center.
However, there are organizational forms in nature, such as flocks of birds and fish, which are not centerless. They can also deftly avoid predators.
There is no specific leader among these fish, but each fish follows the same rules: don’t get too far from your fellows, but don’t get too close, swim all the time, that’s their consensus and autonomy.
You can check out the interesting explanation in these two videos:
Although there are many problems in the fields of blockchain and Web3 that have not yet been solved, and many people rush in to make money, some people package some current businesses a little to look like Web3, but I am not interested in future collaboration, Social changes remain optimistic, as we can see the downsides of centralization.
We already have a lot of beautiful gardens surrounded by walls, what is needed now is a big forest where anyone can play freely, and the Internet in the future should be more fair and free.
This article is reproduced from: http://catcoding.me/p/bitcoin/
This site is for inclusion only, and the copyright belongs to the original author.