Teacher Xiao Zhen from Peking University's "Blockchain Technology and Application" series of course study notes [20] Ethereum - Proof of Equity

Table of contents

1. Why transfer to Proof of Stake

        1. Relevant data of Bitcoin system 

        2. Statistics of Ethereum

        3. Bitcoin and Ethereum as a country

Two, thinking

        1. Why do miners mine?

        2. Why should miners be given these benefits and block rewards?

        3. How does the mining tool body mine?

        4. What determines the mining income?

3. Proof of Equity

        1. Features of Proof of Stake

        2. Advantages of Proof of Stake over Proof of Work

        3. Hybrid model of Proof of Stake and Proof of Work        

        4.Proof of Stake

        5. The proof-of-stake protocol to be adopted in Ethereum

        6. Think

1. Why transfer to Proof of Stake

1. Relevant data of Bitcoin system 

        Proof of Stake (Proof of Stake), Bitcoin and Ethereum are currently based on proof of work . A typical disadvantage of this consensus mechanism is the waste of electricity. The following figure 1-1 shows the change of Bitcoin energy consumption over time. The y-axis is TWh (TeraWatt Hours: 10^{12}), KWh (Kilowatt hours: 10^{3}, which means kilowatt-hours, one kilowatt-hour). It can be seen from the figure that, Bitcoin's energy consumption is increasing over time.

Picture 1-1

        The specific statistics are shown in the figure below:

Figure 1-2

2. Statistics of Ethereum

        The energy consumption of Ethereum also increases with time, and there are some fluctuations in the middle, as shown in Figure 1-3 below.

Figure 1-3

        The specific data are shown in Figure 1-4 below. 

Figure 1-4

        In theory, bitcoin transactions are relatively simple, with only some simple transfer transactions, and Ethereum transactions may include calls to smart contracts, but in fact, the energy consumption of Ethereum is much lower than that of bitcoin. Because the block generation time of Bitcoin is long, the average block generation time of Bitcoin is 10 minutes, and that of Ethereum is 15s, so the mining time of Ethereum is short, and the average energy consumption of each transaction is small. Of course, the transaction of Ethereum Energy consumption is still much higher than credit card companies.

3. Bitcoin and Ethereum as a country

        If the energy consumption of Bitcoin and Ethereum is combined as a country, its ranking in the country is shown in Figure 1-5 below.

Figure 1-5

Two, thinking

1. Why do miners mine?

        In order to obtain block rewards, in order to obtain income.

2. Why should miners be given these benefits and block rewards?

        In order to motivate miners to participate in the maintenance of the blockchain.

3. How does the mining tool body mine?

        You need to find a mining fund, then buy mining equipment, such as mining machines, GPUs, etc., and start mining.

4. What determines the mining income?

        Depends on the funds invested. The income is determined by the amount of mining, the amount of mining is determined by the computing power, the computing power is determined by the mining machine, and the mining machine is determined by the investment funds. Since it is ultimately a fight for money, it is enough to just take out the money and compare it. Miners use competitive computing power to determine how to distribute the mining revenue. Can it be changed to directly relying on the amount of money to determine the revenue? Invest in blockchain development and determine the distribution of income according to the amount of money invested by each person. This is a basic idea of ​​proof of equity . This method is also called Virtual Mining.

3. Proof of Equity

1. Features of Proof of Stake

        For cryptocurrencies using Proof of Stake, generally before the official release, part of the currency will be reserved for developers, and part of the currency will also be sold in exchange for the funds needed to develop the cryptocurrency. According to the consensus mechanism of Proof of Stake , everyone is Voting is done according to the amount of currency held.

2. Advantages of Proof of Stake over Proof of Work

(1) Eliminate the mining process, avoid the resulting energy consumption and impact on the environment, and reduce greenhouse gas emissions.

(2) The resources to launch an attack can only be obtained from within the cryptocurrency system.

        Consensus system based on workload proof In a sense, the resources to maintain blockchain security are not a closed loop . Blockchain is secured by mining. Mining machines can be purchased with US dollars and then participate in mining. Resources can be obtained from cryptocurrency obtained from outside the system . Although the market value of cryptocurrencies has grown a lot in recent years, it is still insignificant compared with the world's total economic volume. Therefore, if an organization wants to launch a malicious attack, it only needs to use enough funds to purchase mining equipment, and then gather more than half of the total computing power of cryptocurrencies. External resources can be converted into mining computing power and into the ability to attack this cryptocurrency. For mainstream cryptocurrencies like Bitcoin, the ability to resist attacks is relatively strong, because the total computing power of the system is still relatively large. If it is these small currencies that have just been issued, such an attack may be fatal. sexual. If this small currency encounters this kind of attack not long after its release, it is very likely that the price of the currency will plummet or even return to zero. For the developer and early miners, the losses suffered may be catastrophic. AltCoin Infanticide, AltCoin: Small Coin, Infant: Baby, Infanticide: Killed in the Cradle. Before this cryptocurrency grows up, kill it first.

        Proof of equity is similar to a joint-stock company voting according to the shares held by each person . Proof of equity votes according to how many coins of the currency you have , so if someone wants to launch a malicious attack, such as a 51% attack, you must first It is necessary to obtain more than half of the currency’s circulation, which means that the resources to launch attacks can only be obtained from within the cryptocurrency system, which is why it is said to be a closed loop. Attacks can only be launched by buying enough coins, and once someone buys a large amount of cryptocurrencies, the price will rise sharply, which is a bit similar to a joint-stock company suffering a hostile takeover, so the workload proof system maintains secure resources. It is not a closed loop, rights and interests The proof is a closed loop.

3. Hybrid model of Proof of Stake and Proof of Work        

        Proof of Stake and Proof of Work are not mutually exclusive . Some cryptocurrencies use a hybrid model. They still need to be mined, but the difficulty of mining is related to the rights and interests you own and the number of coins you hold. That is to say, the more coins you hold, the less difficult it is to mine. Adjust your mining difficulty according to the decrease in the rights and interests of the coin you hold. Of course, this actually has certain problems. In this case, the person who holds the most coins in the system is the easiest to mine every time. Therefore, some cryptocurrencies require that the coins you invest will be locked for a period of time and cannot be reused. This situation is called Proof of Deposit.

4.Proof of Stake

        As shown in Figure 3-1 below, we have learned before that there is a fork. According to the previous situation, we either dig according to the upper chain or the lower chain. Generally, we dig along the upper chain because it is the longest The legal chain, but the following chain may also become the longest legal chain, but it is generally not dug on both sides, because the computing power is dispersed in this way, and the probability of mining is small.

Figure 3-1

        If you use proof of equity , you can bet on both sides. If the upper chain becomes the longest legal chain, the coins locked in the lower chain will have no effect. The coins invested in the lower block are only recorded on the lower fork, and will not affect your use of the upper fork. This situation is called nothing at stake, which is a problem encountered in the early days based on proof of stake.

5. The proof-of-stake protocol to be adopted in Ethereum

(1) Transition stage

        The Proof-of-Stake protocol to be adopted in Ethereum is called Casper the Friendly Finality Gadget (FFG), which is mixed with Proof-of-Work in the transitional stage to provide Finality for Proof-of-Work. Finality is a final state, and transactions included in Finality It will not be cancelled. Transactions purely based on proof-of-work may be rolled back. Bitcoin stipulates to wait for six confirmed blocks, which means that after waiting for six confirmed blocks, the possibility of rollback has already It is very small, but there is a malicious attacker who starts to fork from the front. As long as his computing power is strong enough to account for more than half of the computing power, it is still possible to make this forked chain more powerful than the original chain. Long, so purely based on mining is the lack of this Finality.

(2) The Casper protocol
        introduces a concept called a Validator. To become a Validator, a certain amount of Ethereum must be invested as a deposit, which will be locked in the system. The role of the Validator is to promote the system to reach a consensus, vote to determine which chain is the longest legal chain, and the rights and interests of voting are determined by the size of the security deposit. The specific method is similar to the Two-phase commit in the database.

        When it is mixed, someone still mines. Every time 100 blocks are dug out, it is regarded as an epoch, and then it is decided whether it can become Finality. Some voting is required. The first round of voting is Prepare Message, and the second round is Commit Message. , Casper stipulates that each round of voting must get 2/3 of the verifiers to pass (calculated according to the amount of the deposit). In the actual system, these two messages are no longer distinguished, and the epoch is reduced from the original 100 blocks to 50 blocks, so that every 50 blocks is an epoch, and each epoch only uses one round of voting That's it. This round of voting is a Commit Message for the previous epoch, and a Prepare Message for the next one. Two consecutive rounds of voting are required. Only when both epochs get a majority of 2/3 or more can it be considered valid, as follows As shown in Figure 3-2.

Figure 3-2

        What are the benefits of validator participation?
        If the verifier fulfills his duties, he can get corresponding rewards, just like miners can get block rewards for mining, so the verifier can also get this reward for doing this work. However, if the verifier is found to have bad behavior, he will be punished accordingly. For example, if a verifier does not act administratively and does not vote when it is time to vote, causing the system to fail to reach a consensus, in this case he will be deducted. part of the security deposit. If a validator behaves indiscriminately (voting randomly), votes for both conflicting forks, and bets on both sides. If this situation is discovered, all deposits will be confiscated. Reduces the total supply of Ether in the system. Each verifier has a certain term of office (even if you pay a deposit, you cannot be a verifier forever), and after the term expires, there will be a waiting period for a certain period of time. The waiting period is for other verifiers to report whether the verifier has Any bad behavior will be punished. If the waiting period has passed and there is no problem, the verifier can get back the original deposit and get the reward.

6. Think

(1) The Casper protocol can make a checkpoint for a certain state of a blockchain after mining, and make a checkpoint. Is this checkpoint absolutely safe? Is it possible that the Finality reached through this validator vote can be overturned?

        The transactions included in Finality will not be overturned. Is this absolute? Suppose a malicious organization wants to launch an attack. If this organization is only a miner, he has no way to overturn the finality that has been reached, because Finality is voted by the verifiers. It is purely a malicious miner, no matter how powerful his computing power is, it is impossible to overthrow it without the verifier as an accomplice .

        Successful attack : There are a large number of validators who are hedging their bets. The Casper protocol requires the support of 2/3 of the verifiers in each round of voting to pass. In this case, at least 1/3 of the verifiers voted on both sides. Once found, the deposit of 1/3 of the verifiers will be It was confiscated, so we can see that the consensus mechanism based on proof of stake is very different from the consensus mechanism based on proof of work.

(2) Ethereum is going to gradually transition from proof of work to proof of equity. As time goes by, the rewards for mining are getting less and less, and the rewards for proof of equity are getting more and more, and finally reach the realm of no mining at all. Why didn't Ethereum use Proof of Stake from the beginning?

        Because proof of equity is not mature enough, proof of work is relatively mature and has passed the test of time. The mining algorithms of Bitcoin and Ethereum have both been tested by Bug Bounty , and no one has found any loopholes. Many people think that Proof of Stake is the future direction, but the current mainstream cryptocurrency still uses Proof of Work. There is a cryptocurrency called EOS, commonly known as pomelo, which was once favored by many people. It uses proof of equity and does not need mining at all, but it does not use the Casper protocol, but uses DPOS (Delegated Proof of Stake). Protocol: First use a voting method to select a super node, and then use this super node to generate blocks.

(3) Some people have different views on the view that "mining consumes a lot of electricity".
        They think that the proportion of electricity consumed by it is not large, and its impact on the environment is limited. One benefit of mining is that it provides a means of converting electricity into money. However, electricity itself is difficult to transmit and store. Bitcoin mines are built in places with abundant electricity, so some people think that mining electricity consumption is not a bad thing. It can effectively resolve excess capacity and drive the development of the local economy. Provides an idea to transfer electricity to cryptocurrency.

Guess you like

Origin blog.csdn.net/YSL_Lsy_/article/details/126525276