Blockchain is a concept that has been proposed by academic circles for a long time but has only become popular with Bitcoin in recent years. Bitcoin is an implementation based on blockchain technology. Bitcoin is a cryptocurrency, or a digital currency. Let’s start with Bitcoin and talk about how Bitcoin uses blockchain technology.
Suppose that during the 2006 World Cup finals, two football fans who did not know each other met. Italy played France. The French fans said that France will definitely beat Italy with Zidane. The Italian fans were unconvinced and said that Italy It's invincible. If you don't believe it, let's bet 100 euros. In the real world, what should we do?
I have said before that we who work on computers spend more than 90% of our time dealing with abnormal situations. If humans were very trustworthy, the world might not be what it is now. The 600 miles that Qin promised King Huai of Chu were no longer 6 miles. Maybe it would be Chu who unified China. If you hand over the money to a third party, what if the third party also runs away? He stole the money. Therefore, in the real strange world, relying solely on a kind heart is unreliable. There must be means to firmly guarantee this commitment, legal contract, etc. Nowadays, a very common approach is for the third party to find an authoritative institution, such as the government, a bank, etc., or to find a reputable person or organization. In the final analysis, it is still to find an institution or person with credibility. But under normal circumstances, this third party will definitely "pluck out hair" and charge a certain percentage of handling fees.
So is there any way to solve this problem? This is one of the original intentions of Bitcoin's original design, to solve the trust problem between two strangers.
Encryption algorithm + multi-person accounting
Let’s talk about the encryption algorithm first. Here we need the asymmetric encryption I mentioned before, that is, the public key and private key. Everyone can have one or more pairs of public and private keys, but a public key can only have a corresponding private key, and vice versa. The principle is that two very large prime numbers (p and q) are multiplied to get a number (n). If you want to crack the private key based on the public key, you must theoretically crack it violently and figure out which two large prime numbers the number is multiplied by. Got it. Currently, there is no published private key in the world that can crack more than 1024 bits, so it is very safe to use a private key of 1024 or 2048 or even longer.
Then with the public key and private key, I as an individual can encrypt with the private key, and then publish the public key. Anyone can use my public key to decrypt to determine that this is what I published. In the same way, when someone transfers money to me, I can also use his or her public key to decrypt it and determine that this is someone's identity. This is also called a digital signature. The principles are the same, they are all encryption algorithms, obtained by using mathematical Euler's formula, prime number multiplication and other principles. This is a very great algorithm called RSA, proposed by three mathematicians. As long as we ordinary people understand the concept and use of public keys and private keys.
In the previous traditional model, banks or government agencies had their own separate ledgers. For example, if Zhang San transferred 100 yuan to Li Si, how would it be recorded in the ledger? 100 is deducted from Zhang San’s account and 100 is added to Li Si’s account, right?
The same is true for multi-person ledgers, except that the previous centralized institution has become a distributed, decentralized multiple institutions and even individuals. For example, Li Bai transferred 100 taels of silver to Du Fu. In the past, the Ministry of Finance kept accounts. In the blockchain, Tang Taizong, Yang Yuhuan, Zhang Xiaojing, He Zhizhang and many other people kept accounts together. It was recorded that Li Taibai transferred 100 taels of silver to Du Zimei. , as evidence, with Li Bai's seal attached at the back. In this way, with multiple ledgers, it would be extremely difficult to tamper with them. Li Bai could safely transfer them to Du Fu without worrying that he would tamper with the amount or deny it.
This can solve the problem of fan betting mentioned at the beginning, but there is another question, why should others help us keep accounts?
The answer is to be paid, which is in line with human nature. Otherwise, who would be willing to help keep an account that has nothing to do with them?
But in the end there is only one person who keeps accounts, otherwise everything will be in chaos.
On the premise that it is beneficial, how to ensure who will keep the accounts? There is a mathematical knowledge involved here. Everyone who wants to keep accounts, in fact, the so-called miners, must solve a mathematical problem when keeping money. There is no trick to this mathematical problem. The only way is to put the numbers into the formula. In hard calculation, the algorithm is a Hash algorithm, which is similar to calculating a string of numbers. Miners can only guess, but there is no other way. Moreover, the current probability of guessing this number in Bitcoin is one in a trillion. It would take an ordinary computer to guess this number continuously for about a year.
But there are thousands of computers in the world, and if they are calculated together, the speed will be much faster, because from a probability point of view, one computer will definitely calculate it, and this is indeed the case. Let’s look at a real-life example of Bitcoin.
In addition, you can also see who the Miner is and how many transactions (Number of Transactions) are included in this block.
What if this miner is a person with ulterior motives, and after calculating the calculation, he tampered with the transfer record and amount privately?
A. Tampering with transaction records/amount
We introduced the public and private key encryption technology earlier. The miner itself theoretically does not have the private key of the sender or payee, so he The tampered transaction record will make errors when decrypted with the correct public key, and will eventually be deemed illegal (the author is not sure at what point in time the identification was made, but he is sure that this record can be falsified).
B. Delete transaction records
Assume a scenario: Zhang San wants to buy a two-bedroom house in the 4th Ring Road of Beijing, but Zhang San does not want to pay for it and wants to keep it in vain House, I thought of a sneaky way to tamper with transaction records. Theoretically, after Zhang San pays, this record is generated but not confirmed. The record needs to wait until a miner who solves the puzzle is done. Assuming that the miner is one of his own, he asks the miner to erase this record. There is no problem. . But there are several ways to do it:
As we all know, Bitcoin mining takes a long time because of the troublesome math problems. The current cycle is about 10 minutes. This is based on how many people around the world have to do it. Under the premise that one hundred thousand mining machines are working at full capacity at the same time. In other words, tens of thousands of transactions will be uniformly confirmed and put into an immutable block every ten minutes, and these hundreds of thousands of mining machines will update their local records at the same time.
2.1 If the transaction has just been generated and the landlord sees it, and then transfers the property rights to Zhang San in the next second, then if Zhang San wants to tamper with the payment record, he must meet several conditions:
The difficulty of success depends on how many confirmed blocks follow the tampered record. If there is only one, it is too simple, because the blockchain algorithm defaults to miners using the first received longer block when publishing a new block. So after this modification, it will be done once and for all, because all the ledgers will be synchronized, but there is also a problem, that is, this synchronization will be recorded. If the landlord cannot check the account, Zhang San will eventually be arrested. If there are many, for example, after Zhang San transfers the money, the landlord only transfers the property rights 1 hour after confirming the transfer, then Zhang San must tamper with the previous block information of about 6 blocks, which is very troublesome, because every block All will point to the previous block, and each block will have a digest (Hash), which is a summary of all transaction records in the current block. So if you try to modify a block that was written a long time ago, the digests of subsequent blocks will be changed. This is the hash tree (MerkleTree). Other nodes can report information that the blockchain has been tampered with. This involves the most important point. The 51% computing power that is often mentioned means that if Zhang San owns more than 50% of the ledgers and acknowledges this modification, then other nodes will also acknowledge this modification according to the algorithm design. . However, let’s not talk about the fact that almost no one in the world can do the above two things at the same time. Even if you can do it, if someone has questions about this, you can still force the system to be repaired. Similar problems have occurred in Ethereum before, and the outcome is Ethereum Entire blocks were tampered with and stolen property was recovered. Ethereum fork event.
The above is only a superficial introduction to the characteristics of Bitcoin implemented by applying blockchain technology. It can achieve openness, fairness, neutrality and equality. Any two strangers in the world can rely on Bitcoin or other blockchain technologies to trust each other.