15 minutes into Bitcoin and blockchain

Original source: https://mp.weixin.qq.com/s/JEkjYdvRw2x3PzxKDR7FQQ

 

The blockchain is the ledger of this village in the Bitcoin world. Whoever digs mines has the right to open a new page in this ledger, and write down on the new page "X year X day, this village XX mining. Get a bitcoin and get a reward for a fee."

 

Bitcoin is on fire again. Why say it again? Because Bitcoin has already caught fire once in 2013. This time, the same as in 2013, the price of Bitcoin has skyrocketed, making people stutter. Unlike in 2013, this time people not only pay attention to the price of bitcoin, but also start to pay attention to the technology behind bitcoin - blockchain .

Overnight, the blockchain stood in the spotlight from behind the stage and became a hot spot that people sought after. Logistics, medicine, copyright... It seems that everything can be reborn with the help of blockchain. So, what's going on with such a miraculous technology?

This article will introduce Bitcoin and the blockchain system in the most common language without involving any advanced mathematics and computer knowledge.

When it comes to blockchain, we have to say Bitcoin. Bitcoin is the best carrier of blockchain technology, so this article takes Bitcoin as an example to introduce blockchain.

Bitcoin is very good, and it has two characteristics: decentralization and electronic currency .

Don't underestimate these two points, it is not easy to have both of them at the same time.

First of all, let’s talk about decentralization. Generally, decentralized currencies can be traced back to a long time ago. In ancient times, people spontaneously used shells and stones as prototype currencies for transactions. The currency at this time can be regarded as decentralized. currency - without the need for a central bank to organize issuance and confirm the legitimacy of transactions.

But I don’t need to say more about the disadvantages of using this type of currency. The money supply is unstable and depends on the annual production of shellfish; the quality of the currency varies, some are large, some are small, some are clams and some are clams; transactions are very cumbersome, large transactions There are several carts of shells at every turn, and so much currency is easily robbed.

So currency has evolved, the era of credit currency has come, and currency has become a number in bank accounts. The above problems have been solved, but we must need banks to control the issuance of currency, prevent counterfeiting, and conduct transaction settlement. Our property rights are fully in our hands in the hands of the bank. Banks like to do some QE at every turn, and the money in our bank cards is depreciating more and more.

At this time, we hope to have a currency that not only requires no bank intervention like using shells, but also meets the needs of currency functions in the current information age. Thus, Bitcoin, which combines these two characteristics, was born.

Fundamentals of Bitcoin

As a currency, it usually has to meet several characteristics: someone has to issue it, it has to be held , and people can exchange it with each other.

hold

Holding bitcoins is very simple, as long as you have a receiving address , you can hold bitcoins and receive bitcoins. The amount of bitcoin held is just a number under this address.

Some people will ask, is this not the same as a bank account, it is very similar, but the substance is very different. The banking system is a centralized system. The balance of the account is determined by the bank. When the banking system makes an error and the balance becomes 0, then you really cannot withdraw money from the ATM machine.

Bitcoin does not use such an authoritative central organization, and needs a stable accounting system, so the solution is that each "miner" saves all transaction records that have occurred in the Bitcoin world on its own hard drive. With all the transaction records, it is easy to calculate how much balance each person has. This transaction record, which is stored in everyone's computer, is scientifically called the blockchain . A hacker can hack the blockchains saved by some people, but he cannot hack most people in the world. As long as most of them still have the correct blockchains, the whole system can be restored to normal through error correction.

Just like when playing mahjong, we sometimes use bookkeeping to record the receivables and payables of each round. The Bitcoin world also conducts transactions through bookkeeping. Every transaction that occurs will be made public, and then everyone will record the transaction in their own In the small account book, everyone can check how much money each family has in their own small account book. It's just that when the bookkeeping is changed from 4 people to villagers in the entire Bitcoin world, this requires a slightly more complicated system.

issued

Let's look at the release again. Let's first look at how banknotes are issued. It's very simple. The central bank started the printing press, and a lot of "Grandpa Mao" appeared in an instant. As a decentralized electronic currency, Bitcoin does not have a central bank, so how can it be issued?

Bitcoin stipulates that people can answer a difficult question, and whoever answers it first can issue a piece of Bitcoin, which is what we call "mining".

What is this difficult question? It's a matter of hashing. A hash is a function F that performs some operation on an input X to get a hash value Y . It is Y = F(X) that we have learned in high school . The question Bitcoin asks you to answer is, to tell you the hashes Y and F , find X.

At this time, you will say, isn't this an inverse function. Sorry, the hash function is a special function, and I can't find a suitable inverse function. The only way to find X is to try the numbers one by one, and substitute each number into F to see if the result is Y , if it happens to be right, then the question is answered.

Therefore, the so-called currency issuance and mining are actually a group of people using the best computer to hit the number of the Universiade. When a miner is confronted with X , that is, after mining, he has the right to create a new transaction block at the end of the original blockchain . On this newly created transaction block, the miner It can be accompanied by a transaction made by the Bitcoin world as the payer, and the payee is anyone, so that he can create and issue a Bitcoin through this transaction.

A blockchain consists of a series of transaction blocks. Let's see what is included on the transaction block.

A transaction block shows who is its parent block, contains the transaction records on this block, and the hash value of this block.

 

In this way, as miners continue to mine to create new transaction blocks, one block after another becomes a chain, becoming a veritable blockchain! In the bitcoin world, for some reason, the blockchain will fork (why will be mentioned below), so the bitcoin world stipulates that the only legal blockchain is the current longest blockchain.

The blockchain is the ledger of this village in the Bitcoin world. Whoever digs mines has the right to open a new page in this ledger, and write down on the new page "X year X day, this village XX mining. Get a bitcoin and get a reward for a fee." This ledger is very special. It is not managed by the party secretary of the village, but all the villagers have one copy. After digging the mine, they can turn the page and keep the book by themselves, and let the whole village do it in the same way to ensure that the whole village Everyone's ledger is the same. When there is an inconsistency in the accounts of the whole village, it is stipulated that whoever has the longest account book will listen.

issued

The key to Bitcoin is transactions. For a decentralized electronic currency system, transactions are very risky. Imagine that your e-money transaction with another person is like an IOU without a third-party notary. If one of the parties suddenly turns over, the validity of the IOU is difficult to guarantee.

Since a third-party notary such as a bank settlement center cannot be used (the centralized system is used), Bitcoin simply uses people all over the world as notaries.

All Bitcoin transactions can’t be done sneakily, they need to be broadcast to the world over the internet. If C wants to give B 0.5 bitcoins, it will broadcast to the world "C gave B 0.5 bitcoins!" At this time, all mining miners will add this transaction record to the transaction they are mining. in the block.

Why would they add it? Because when a miner mines a mine, in addition to the specified reward of one bitcoin, for each additional transaction record, there will be a little extra handling fee. Mosquito meat is also meat, and hard-working miners have nothing to dislike.

In the process of adding the transaction record to the block, the miners will first verify whether the transaction is legal or not, that is, check the ledger in the village. When the currency in the name of C is less than 0.5, the transaction record will be deleted. Refused to join the block.

Adding to the block does not mean that the transaction has been successful. Only when the random number X of the block containing this transaction record is discovered by a miner and a new transaction block is created and linked to the current block, it can be considered as a block. A legal transaction, this transaction record becomes a verified transaction.

B may ask, which means that after C sends the broadcast of the money to me, I can't immediately determine whether I have received the money or not?

That's right, when C broadcasts the broadcast, it is only equivalent to C standing at the entrance of the village and shouting at the whole village "I'll give B five cents!", only when the whole village hears it and records it in a self-ledger After the miners turned over the page that wrote down this incident, the fact that B's account had an extra 50 cents was truly recognized by the villagers. Due to the large number of miners participating in Bitcoin mining, the verification time required for each transaction is usually very short, which will not bring a sense of delay to the transaction.

As a result, the issuance and transaction of Bitcoin are linked end-to-end. Transactions are carried out in the form of broadcasting, and miners write the transaction in the transaction block after hearing the broadcast; miners confirm the completion of historical transactions through mining, and thus create new blocks, extend the blockchain, and issue new bitcoin.

Forks of the blockchain

Forks of the blockchain were mentioned earlier . Why do blockchains fork occur? The reason is decentralization .

Without a center, everyone maintains the ledger independently. Therefore, due to the delay of the network and insufficient communication, it is inevitable that there will be disagreements.

To give two examples, one is a problem that is prone to occur during mining: Miner B gets the random number right, mining is successful, and the blockchain is extended. Note that at this time, the extended blockchain of Miner B is only his own. No one else knows about it yet. Of course, Miner B immediately announced the successful mining news to the world, and asked everyone to extend the blockchain in his way.

But at this time, another miner C also got the random number right. He either hadn't heard B's broadcast because of the network speed delay, or he heard the broadcast but was not reconciled and wanted to break the rules, so he also put his own area The blockchain extended and started broadcasting to the world.

Because of the delay of the network speed, not everyone hears B's broadcast first. At this time, some people will update the blockchain according to B's instructions, and some people will update the blockchain according to C's instructions. Due to the delay, there is no way to determine whether B or C published the broadcast first, causing the blockchain to fork.

It’s like two miners B and C in the village live in the east and west of the village respectively. B and C succeeded in mining at about the same time. They turned the pages of their account books and wrote their own declaration on a new page “X year X month , B(C) in this village got one bitcoin by mining”, and started shouting to the whole village to turn the page and write this sentence. Since they lived at two ends of the village, the people at the east end of the village heard B shouting first, so they recorded the account according to B's words, while the people at the west end of the village heard C shouting first and recorded according to C's words. There are two versions of the ledger at this time.

The second case is a double transaction . B conducts a transaction with C, and announces to pay C a bitcoin by broadcasting, but B also hooks up with D at the same time, and at the same time broadcasts an announcement to pay D a bitcoin, even worse. Yes, B announced that he paid the same one.

As in the first case, due to the network speed problem, some miners first heard the broadcast of the transaction between B and C, and included this transaction record in the current transaction block, and then heard the transaction of B and D, and decided that It is illegal and will not be added to the transaction block. On the other hand, some miners do the opposite, adding only the transactions of B and D to the transaction block.

These two situations are not uncommon. Since the Bitcoin world is participated by people from all over the world, some areas use 100M optical broadband, and some areas use 56K dial-up Internet access. The network speed varies widely, and there are many people. With bad intentions and malicious intentions, blockchain forks happen almost all the time. At this point, the supreme principle of the Bitcoin world comes into play: the only legitimate blockchain is the longest currently in existence.

But in the case of the above two forks, the two forked blockchains are the same length? It doesn't matter, both of these are legal, and neither is legal. Let's put aside the disputes and continue to dig to see who can dig faster, who will get the new X first, and let their blockchain go further, whose blockchain It becomes the longest, and it becomes the only legal one. After hearing this, why do you feel that this blockchain system is so random and unreliable? If everyone does not follow the rules and forks at will, the world will not be in chaos.

Don't worry, we will find out through analysis that the blockchain will definitely return to a stable one.

Let's go back to the first case of the disagreement between miner B and miner C. Suppose that B's chain goes further and becomes the longest chain, and this chain becomes the legal chain recognized by the Bitcoin world. At this point, C has two choices. One is to give up his efforts, obediently throw away his own blockchain, and use B's. Another option is to not be reconciled to failure and stick to your own blockchain, hoping that you will soon continue to tie B and overtake.

Everyone is happy to choose the former, and the blockchain in the Bitcoin world will be unified from now on. Choosing the latter will actually continue to keep the blockchain in a forked state. So from a rational point of view, what should C do? In fact, C should decisively give up his chain at this time.

We can analyze that when the chains of B and C are forked, there are four types of miners and two forces in the Bitcoin world at this time, B and the melon-eating miners who support B, and C and the melon-eating miners who support C. At this time, B forces and C forces are roughly equal, so everyone digs their own.

When the B force first extends the chain of B, the force of C will divide at this time. Most of the melon eaters who support C will immediately switch to the B chain as soon as they hear the news of the extension of the B chain, because at this time The B chain is longer, and it is obviously more promising to continue mining on a longer chain. The forces immediately reversed, and C would be embarrassed to find that the whole world was against him (crying). So C had to give up.

Of course, assuming that C's power extends the blockchain first, then the situation is just the opposite, and miners all over the world will immediately fall into C's arms. Although it may indeed be the mine that B dug first, at this time, B also has to choose to give up his own blockchain that no one cares about. According to this rational assumption, most miners around the world will choose to work on the longest chain, so the occasional fork is not a big deal.

Of course, there is still an extreme situation, that is, the computing power of B or C alone exceeds 50% of the world's computing power. At this time, they may overtake by themselves. But in fact, due to the participation of the whole world, it is difficult for someone or an organization to have such a strong computing power. Secondly, even if C has such a strong computing power, it would be fine if he honestly mines on the longest chain, and there is no problem. It is necessary to be hard on the world, and insisting on showing hegemony will only make the world stop playing with him. In the end, Bitcoin loses its value, and C loses even more.

The solution to the second case of fork mentioned above is the same as the first case. Adhering to the principle of "the only legal blockchain is the longest blockchain at present" will not be shaken. In the end, a legal blockchain is only One of the transactions between B and C or between B and D will be recorded. Readers can think about the specific reasons.

 

Having said so much, you can find that with the ingenious design of the blockchain, Bitcoin makes transactions and issuances in a very stable state, and what is the core force for maintaining stability? It is the computing power provided by countless miners.

As long as there are enough miners, the computing power is large enough, and the verification speed is fast enough, Bitcoin transactions can be quickly verified, and the accidental blockchain fork state can end quickly, ensuring the stable operation of the entire system. Therefore, mining is not just electricity consumption, but the electricity is actually converted into energy to maintain the stability of the entire system!

This also tells us why Bitcoin can be worth tens of thousands of coins, and some newly issued coins are worthless, because Bitcoin, as the electronic currency with the longest history and the widest audience, also has the largest number and the most widely distributed miners and computing power, is the most stable electronic currency.

However, the number of newly issued currency miners is very small, and the participating computing power is low, which cannot stabilize the entire system at all. Low computing power also means that the verification time of each transaction will be longer, thereby reducing the availability of the currency, so this Emerging currencies are worthless.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325079933&siteId=291194637