13th Lecture | In-depth blockchain technology (v): POS consensus mechanism

Source: Internet
Author: User

In the previous article we talked about the POW consensus mechanism, this one we will share another consensus mechanism, POS consensus mechanism.

POS Full name is proof of Stake, Chinese translation as proof of rights. This article will be a comparison between POS and POW to help you deepen your understanding.

The origin of Pos

  Pos first appeared in the White paper of Sunny King, the founder of the dot-coin, whose purpose was to solve the problem of massive resource waste using POW mining. Once the POS consensus mechanism was raised, the Sunny King also realized the first generation of POS blockchain based on the POW base framework: Point coin.

There are many versions of the POW implementations, but most of them are only improved on mining algorithms, and the main logic has not changed. POS contains multiple variants, each of which often involves changes in the blockchain token economy model, which can be said to be reaching.

These implementations are a bit of coin, black currency, future coins, Riddick coins, they all promote the development of POS mechanism, POS research Forefront and Ethereum Casper, as well as the Cardano Ouroboros.

What is the mechanism that causes POS to have such characteristics? Let's have a look.

What is POS?

  Before I talk about POS, I first say a concept called the Age of coins, the concept of currency age is actually very good understanding, its English is CoinAge, literally means the number of coins multiplied by the number of days.

For example, you have 100 coins, at an address for 9 days without moving, then the resulting currency age is 900, if you put this address on this 100 currency to any address, including your own address, then 900 currency age in the transfer process was spent, your currency number is 100, but the age of change to 0. Currency age is available on the data link and can be verified by anyone.

We look back at what the POS is, the first step of the blockchain consensus mechanism is to randomly screen a bookkeeper, the POW is the calculation ability to get the right to account, the more computing power, the probability of getting the right to book is greater.

POS will replace the computing power here as proof of property, that is, the more coins the node has, the greater the probability of getting the bookkeeping. This is a bit like the company's equity structure, the larger share of the partner's voice is heavier.

The above is a brief description of the concept of POS, in fact, the development of POS has undergone three versions, The first version of the PoS1.0 version of the coin is the token, this version is used in the currency age, the second version is represented by the black currency (BlackCoin), which is used for the PoS2.0 version, corresponding to this version of the use of the amount of money, equivalent to the proof of property, the back of the black currency and upgrade to PoS3.0, this version back to the

The POW was already in use before Bitcoin appeared, and POS was the concept created in the real sense for the blockchain.

The implementation principle of POS

  Okay, now let's start with the specifics of how POS is implemented. This part of the formula is more, if you are listening to audio, you can click on the document view.

Through the previous article we know the basic logic and steps of POW mining, we first seek a nonce less than the target value, this step is expressed as a formula:

Hash (Block_header) < Target

  From the formula we can see that all miners under the POW target value is the same, as long as the result hash is less than the target value can be simplified to see the number of leading 0.

In the POS system, this formula is changed to:

Hash (Block_header) < Target * CoinAge

  We can see that the introduction of a variable called coinage, which is the age of coins, is interesting here.

This variable is different from the target value that will be seen by each miner, and if your currency is older, it will mean that you get the answer easier. The target is consistent with the POW, which is inversely proportional to the difficulty of the whole network and is used to control the speed of the block.

For example, the target of the current network is the 4369,a miner's input currency age is 15, then a miner's target value is 65535, converted to 16 binary is 0xFFFF, the full hash length is assumed to be 8 bits, that is, 0x0000ffff.

and b miners more money, he entered the currency age is 240, then the target value of B miner is 0x000fffff. If you look closely, you will find that B is less than a zero for the target value of a miner. This is the following:

    • A miner Hash (block_header) < 0x0000ffff
    • B miner Hash (block_header) < 0X000FFFFF

So the probability that B miners get the right to account is certainly higher than a.

The specific code analysis here does not explain, here needs the currency age as input, if we write the sample code is only a simple parameter, POS need to put in the context of the blockchain to operate.

Issues related to POS

  Through the above introduction we know: Pos seems to perfectly solve the problem of the POW mining resources waste, and even in the incidentally solved the problem of 51% attacks, here can by the way 51% attack is what, it refers to the POW miners if accumulated more than 51% of the calculation, it can be some degree of tampering with the ledger.

Here by the way popular science, what is 51% attacks, we found that miners mining costs are no longer physical equipment and electricity, but virtual tokens, its marginal cost is almost zero, essentially POS let miners and users into one.

This also means that if the miner initiates 51% attacks, it will need to have a full network of 51% coins or currency age, which is almost impossible, even if you successfully implemented a 51% attack, it also means that as the largest large holder of the network you, the loss will be the largest.

Pos looks quite perfect, in fact not, POS has a lot of flaws.

The first issue that POS encounters is the issue of the currency issue. In the beginning, only the original block on the coin, meaning that only this node can be mined, so let the currency dispersed to allow the entire network to grow, then how to spread out is another problem.

So the early POS currency is basically used in a phased mining, some called mixed mining, in fact, I do not agree with mixed mining this argument, mixing means at the same time. Many currencies are in fact divided into stages, that is, the first stage is the POW mining, to the second stage is the POS mining.

With the advent of the standard contract tokens of the ERC20 type, this problem has been solved, eliminating the need to change the first phase to POW, or to scatter tokens.

The second problem is that the currency age is linked to time, which means that users can accumulate a certain amount of money, and so long after a one-time mining launch attack; So the solution is: the POS mechanism needs to introduce an upper limit to control the natural growth of the time factor.

The third problem is that although the time limit is introduced, the user is inclined to hoard tokens, which causes the currency to circulate inadequately; Based on this, the Riddick currency introduces the age-to-time decay, constructs the equity speed proof, encourages the user to flow tokens, rather than tends to hoard tokens.

The fourth problem is offline attacks, even if the time limit is introduced, the time is still natural flow, that is, the mining node can not be required for a long time online. Mining can be offline, this is simply a disaster, so any of the practical form of POS mechanism must avoid this problem, because the number of network nodes directly related to the robustness of the blockchain network.

Of course none of these problems are fatal, remember when we first mentioned that POS experienced three versions, while the second version of POS 2.0 used not currency age, but directly the number of coins.

This can result in completely different results, none of the above combined second problems, it seems that the direct use of the number of coins is better, but there is a whole POS mechanism of the fatal problem.

This problem is called "nothing" at Stake, which translates to a no-cost benefit issue. The general meaning of doing anything in the POS system has little cost, such as the fact that there is almost no cost to mine the POS system, which means that the fork is very convenient.

To what extent, each honest miner in the generation of solitary blocks can continue to dig down, anyway, there is no cost, anyway, the fork chain and the main chain can be dug at the same time, that is, any user with less money can try to fork, and the fork chain broadcast out.

This time if other honest miners see, the first reaction is also no cost, then we also come to dig, perhaps when the value, meaning that any profit-making miners will not make the system become stronger and more stable, but more chaotic.

No cost-benefit issues can be avoided regardless of the currency age or the number of coins as the POS parameters.

The POW does not have such a problem, we return to the POW system, because any fork will cause the cost of mining directly into negative income, so this will resist the generation of forks, miners tend to follow the "longest" chain.

Because the Ethereum part uses the POS consensus, its name is called Casper, it must solve the above-mentioned cost-free benefit problem attack. So the Casper agreement requires the POS miners to bet on the consensus result by means of a mortgage margin, and we still need to wait and see the actual results.

Summarize

  Finally, we summarize the POS consensus mechanism, the POS blockchain system does not need external physical input, so it is more environmentally friendly than POW, and miners are users, which will to a certain extent against the 51% attacks, so based on POS mechanism of digital currency is the ideal state of the digital currency.

The drawback of POS is the lack of industrial-grade blockchain applications, from a logical point of view, a little loop self-proof taste, is to use their own currency to maintain the security system, and the security of the currency is guaranteed by the system, so the current POS consensus mechanism is often not independent operation, but mixed with the POW run together, This can compensate for POS defects.

POS consensus mechanism is also present in the mining pool, may also appear the risk of central mining.

Although the POS consensus mechanism is still a lot of future variables, but its plasticity than POW good, technical exploration space, the current POS currency compared to the risk of the currency is higher.

So what blockchain projects use the POS consensus mechanism? You can give me a message, we discuss together, thank you for listening, we will see you next time.

13th Lecture | In-depth blockchain technology (v): POS consensus mechanism

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.