Popular Science | Eth 2.0 Staking Logic

Translation: Unitimes_David

Source: Unitimes

Summary

Proof of Stake (PoS) represents a type of consensus algorithm in which validators vote on the next block, and the weight of the vote depends on the voter's equity. Due to lower energy consumption, less centralization risk, security against different types of 51% attacks, etc., Proof-of-Stake is considered an improvement on Proof-of-Work (PoW).

PoS algorithms can be classified into two broad categories:

  • Chain-based PoS: relies on network synchronization;
  • BFT (Byzantine Fault Tolerance) -based PoS: prioritize node consistency over availability.

In Ethereum 2.0, in order to participate in voting (i.e. become a validator), you need to pledge ETH. To this end, you will receive additional ETH rewards based on a certain interest rate (yield rate) and some online transaction fees.

Source: EthHub

What is Proof of Stake (PoS)?

Proof-of-stake (PoS) is a public-chain consensus algorithm that relies on economic rights and interests in the validator network. In public chains based on Proof-of-Work (PoW) (such as Bitcoin and current Ethereum), the PoW algorithm rewards participants who solve cryptographic challenges to verify transactions and create new blocks (i.e. mining). In a PoS-based public chain (such as the upcoming Casper implementation of Ethereum), a group of validators take turns to propose and vote on the next block, and the weight of each validator's vote depends on the size of its deposit (that is, equity). The significant advantages of PoS include security, reduced centralization risks, and energy savings.

In general, the PoS algorithm looks like this: The blockchain will track a set of validators, and anyone who holds the blockchain's underlying cryptocurrency (ETH in the case of Ethereum) can send a A special type of transaction to become a validator, which locks their ETH as a deposit. Then, the process of creating a new block and reaching a consensus on the block is done through a consensus algorithm, and all current validators can and should participate in it.

There are many types of consensus algorithms, and there are many ways to assign rewards to validators participating in the consensus algorithm, so there are many "style" PoSs. From an algorithm perspective, there are two main categories: chain-based and BFT (Byzantine Fault Tolerant) PoS.

In a chain-based PoS, the algorithm pseudo-randomly selects a validator during each slot (for example, every 10-second cycle may be a slot), assigns the right of the validator to create a single block, and the block Must point to a previous block (usually the block at the end of the longest chain in the front). Therefore, over time, most of the blocks form a single, continuously growing chain.

In BFT (Byzantine Fault Tolerance) -based PoS, validators are randomly assigned the right to propose blocks, but they will reach a consensus on which block is the authoritative and standardized block through a multi-round process. In this process, Each validator will "vote" on a specific block of each round, and at the end of this process, all (honest and online) validators will decide whether any given block is part of the blockchain Reach a permanent consensus. Please note that blocks may still be linked together, but the key difference is that in BFT-based PoS, the consensus of the block is reached within a block, without relying on the length or size of the chain behind it.

What are the advantages of PoS compared to PoW?

  • There is no need to consume a lot of energy to ensure the security of the blockchain. (It is understood that Bitcoin and Ethereum consume more than $ 1 million in power and hardware costs per day as part of their consensus mechanism.)
  • Due to the lack of high energy consumption requirements, PoS does not need to issue so many new coins in order to motivate participants to continue to participate in the network. In theory, PoS may even have a negative net issue. In this case, a certain percentage of transaction fees are "destroyed", thereby reducing the supply over time.
  • PoS opens the door to a wider range of technologies designed using game theory mechanisms to effectively prevent the formation of centralized monopolies, and if these technologies take shape, they can also prevent acts that cause damage to the network (such as selfish mining in PoW) .
  • Reduce the risk of centralization because there are few issues of economies of scale. In the PoW mechanism, a $ 10 million investment will give you 10 times the return of a $ 1 million investment, without any additional disproportionate benefits, because at a higher level, you can Affording better large-scale mining equipment is a kind of "advantage" in PoW.
  • Being able to use financial penalties to make various types of 51% attacks is much more expensive than implementing them in PoW. To paraphrase Vlad Zamfir, "If you participate in a 51% attack, your ASIC mine will be destroyed."

What about a 51% attack on Casper's Proof of Stake?

There are four basic types of 51% attacks:

  • Finality reversion: The verifier who has finalized block A subsequently finalizes conflicting block A, thereby breaking the finality guarantee of the blockchain.
  • Finalize invalid block: The validator has finalized an invalid (or unavailable) block.
  • Live rejection attack: The verifier stops finalizing the block.
  • Review: Validators prevent some or all transactions / blocks from being included in the blockchain.

In the first case, users can negotiate out-of-band in a social way, reach consensus on which finalized block appears first, and support the block. The second case can be solved with proof of fraud and proof of data availability. The third case can be solved by modifying the PoS algorithm, that is, if the nodes do not participate in the consensus, the algorithm will gradually reduce ("leak") the weight of the non-participating nodes in the set of validators. Casper FFG's paper contains a description of this situation.

The fourth case is the most difficult to resolve. The fourth case can be fixed by a "minority soft fork" approach, in which a few honest validators reach a consensus that most validators are reviewing them and stop continuing to create blocks on the current chain; instead , These honest minority validators will continue to build their own chains, and finally through the above-mentioned "leak" mechanism to ensure that these honest minority validators will become 2/3 absolute majority validators in the new chain. At that time, the market will tend to support new chains controlled by these honest validators, rather than old chains controlled by dishonest nodes.

Staking logic in ETH2.0

01. Why would I want to pledge my ETH?

Because you stake your ETH and testify to the correct block, you will get ETH rewards in the form of network interest rates (that is, the rate of return of the verifier) ​​and some network transaction fees. See here for details. The following figure is the currently proposed maximum annual increase of ETH and the maximum annual rate of return of the verifier:

Source: EthHub

It should be noted that according to Vitalik Buterin, these are the largest figures in the above figure, and there are many factors that may reduce the total issuance of ETH. These factors include:

  • The certifier is offline. Combining individual punishment and collective punishment, each 1% of validators offline will reduce the total issuance by about 3%. If more than 33% of validators go offline at the same time, many ETH will be destroyed quickly (due to punishment). .
  • The verifier is slashed. This situation may rarely occur in practice.
  • ETH transaction fee was destroyed due to EIP 1559. According to this proposal, when the utilization rate of the ETH2.0 network is low in the early stage, about 10,000 ETH / year of transaction fees will be destroyed; eventually it may rise to hundreds of thousands of ETH transaction fees per year.
  • Transaction costs are destroyed upon payment of state rent. This mechanism may be integrated into the ETH2.0 gas mechanism, so it was destroyed based on EIP 1559.

According to Justin Drake, based on the above factors, the possible result is that if about 30,000,000 ETH is pledged in ETH2.0, the annual inflation rate (increase rate) of the network will only be about 0.5%, and the corresponding validator's annual income The rate will be about 5%.

02. What are the minimum requirements for staking?

  • At least 32 ETH pledged by each validator
  • Computer with sufficient hardware specifications
  • Internet connection

03. What software do I need to run to participate in Staking?

When considering a pledge on Ethereum, you need to understand two main types of software:

  • Beacon nodes: this is the hub for validators
    • Stores canonical status, processes peer-to-peer and incoming synchronization requests, broadcasts blocks, and performs block certification.
    • Have a gRPC server to which clients can connect and provide a public API.
  • Verifier client: communicates with the beacon node and signs the block. You can pledge 32 ETH on each client.
    • Stores important secret information such as RANDAO reveals, escrow certificates for shared data, and BLS private keys.
    • Can effectively switch the underlying beacon nodes
    • Track shared state execution data and data blocks that the verifier has signed.

This means that there may be three software combinations that need to be run:

  1. Run only beacon nodes
  2. Run beacon node + validator client
  3. Run a beacon node + multiple validator clients

04. What are the hardware requirements for running the software?

Still to be determined. Ideally, we only need to meet the minimum requirements for the three settings mentioned above. (Note: According to previous Ethereum 2.0 researcher Justin Drake, it is expected that the validator client will be able to run "easily" on Raspberry Pi hardware (4GB RAM).)

05. What happens if I do not connect to the Internet while participating in Staking?

The key to becoming a validator is to ensure that you can always vote for the block (that is, to prove the block), thereby ensuring the security of the network. Therefore, if your validator client is offline at any time, in order to stimulate the availability of validators, there will be corresponding penalties, the size of which depends on the situation. This happens in two scenarios:

  1. If the block is being finalized and you are offline, then you will lose x% of the deposit within one year, where x% is the current validator annual interest rate. For example, if the current validator's annual interest rate is 5%, then you will lose a deposit of 0.0137% per day (Note: 5% / 365 = 0.0137%), but you will get these rewards every day when you are online.
  2. If the block cannot be finalized (that is, more than 33% of the validators are offline) and you are offline, then you will lose 60% of the deposit in 18 days.

If your deposit drops to 16ETH at any time, you will be completely removed from the validator set.

06. If I participate in Staking, how long will my ETH be locked?

When you want to retrieve ETH from a validator, you will be put into a withdrawal queue. If there is no queue, then the shortest redemption time is 18 hours, and the time will be dynamically adjusted according to the number of people being withdrawn at the time.

Proof of Stake FAQ CBC Casper Resources Beacon and Validator explanations Some details around staking from Vitalik