From 794af2cd355801ec2515fed0764246326934348d Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 18 Jul 2022 14:29:04 +0100 Subject: [PATCH 1/5] update pos page --- .../docs/consensus-mechanisms/pos/index.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/content/developers/docs/consensus-mechanisms/pos/index.md b/src/content/developers/docs/consensus-mechanisms/pos/index.md index a54dbc96483..f8ee157dccd 100644 --- a/src/content/developers/docs/consensus-mechanisms/pos/index.md +++ b/src/content/developers/docs/consensus-mechanisms/pos/index.md @@ -5,7 +5,7 @@ lang: en sidebar: true --- -Proof-of-stake (PoS) is the [consensus mechanism](/developers/docs/consensus-mechanisms/) that Ethereum will use after [The Merge](/upgrades/merge). Ethereum is moving off of [proof-of-work (PoW)](/developers/docs/consensus-mechanisms/pow/) to proof-of-stake because it is more secure, less energy-intensive, and better for implementing new scaling solutions. While it has always been the plan to transition to proof-of-stake, it is also more complex than proof-of-work, and refining the mechanism has taken years of research and development. The challenge now is to implement proof-of-stake on Ethereum Mainnet. This process is called ["The Merge"](/upgrades/merge/). +Proof-of-stake (PoS) is Ethereum's [consensus mechanism](/developers/docs/consensus-mechanisms/). Ethereum switched on its proof-of-stake mechanism in 2022 because it is more secure, less energy-intensive, and better for implementing new scaling solutions compared to the previous consensus mechanism, [proof-of-work](/developers/docs/consensus-mechanisms/pow). ## Prerequisites {#prerequisites} @@ -13,9 +13,9 @@ To better understand this page, we recommend you first read up on [consensus mec ## What is proof-of-stake (PoS)? {#what-is-pos} -Proof-of-stake is a type of [consensus mechanism](/developers/docs/consensus-mechanisms/) used by blockchains to achieve distributed consensus. In proof-of-work, miners prove they have capital at risk by expending energy. In proof-of-stake, validators explicitly stake capital in the form of ether into a smart contract on Ethereum. This staked ether then acts as collateral that can be destroyed if the validator behaves dishonestly or lazily. The validator is then responsible for checking that new blocks propagated over the network are valid and occasionally creating and propagating new blocks themselves. +Proof-of-stake is a type of [consensus mechanism](/developers/docs/consensus-mechanisms/) used by blockchains to achieve distributed consensus. In proof-of-work, miners prove they have capital at risk by expending energy. In proof-of-stake, validators explicitly stake capital in the form of ETH into a smart contract on Ethereum. This staked ETH then acts as collateral that can be destroyed if the validator behaves dishonestly or lazily. The validator is then responsible for checking that new blocks propagated over the network are valid and occasionally creating and propagating new blocks themselves. -Proof-of-stake comes with a number of improvements to the proof-of-work system: +Proof-of-stake comes with a number of improvements to the now-deprecated proof-of-work system: - better energy efficiency – there is no need to use lots of energy on proof-of-work computations - lower barriers to entry, reduced hardware requirements – there is no need for elite hardware to stand a chance of creating new blocks @@ -26,17 +26,17 @@ Proof-of-stake comes with a number of improvements to the proof-of-work system: ## Validators {#validators} -To participate as a validator, a user must deposit 32 ETH into the deposit contract and run three separate pieces of software: an execution client, a consensus client, and a validator. On depositing their ether, the user joins an activation queue that limits the rate of new validators joining the network. Once activated, validators receive new blocks from peers on the Ethereum network. The transactions delivered in the block are re-executed, and the block signature is checked to ensure the block is valid. The validator then sends a vote (called an attestation) in favor of that block across the network. +To participate as a validator, a user must deposit 32 ETH into the deposit contract and run three separate pieces of software: an execution client, a consensus client, and a validator. On depositing their ETH, the user joins an activation queue that limits the rate of new validators joining the network. Once activated, validators receive new blocks from peers on the Ethereum network. The transactions delivered in the block are re-executed, and the block signature is checked to ensure the block is valid. The validator then sends a vote (called an attestation) in favor of that block across the network. Whereas under proof-of-work, the timing of blocks is determined by the mining difficulty, in proof-of-stake, the tempo is fixed. Time in proof-of-stake Ethereum is divided into slots (12 seconds) and epochs (32 slots). One validator is randomly selected to be a block proposer in every slot. This validator is responsible for creating a new block and sending it out to other nodes on the network. Also in every slot, a committee of validators is randomly chosen, whose votes are used to determine the validity of the block being proposed. ## Finality {#finality} -A transaction has "finality" in distributed networks when it's part of a block that can't change without a significant amount of ether getting burned. On proof-of-stake Ethereum, this is managed using "checkpoint" blocks. The first block in each epoch is a checkpoint. Validators vote for pairs of checkpoints that it considers to be valid. If a pair of checkpoints attracts votes representing at least two-thirds of the total staked ether, the checkpoints are upgraded. The more recent of the two (target) becomes "justified". The earlier of the two is already justified because it was the "target" in the previous epoch. Now it is upgraded to "finalized". To revert a finalized block, an attacker would commit to losing at least one-third of the total supply of staked ether (currently around $10,000,000,000). The exact reason for this is explained [in this Ethereum Foundation blog post](https://blog.ethereum.org/2016/05/09/on-settlement-finality/). Since finality requires a two-thirds majority, an attacker could prevent the network from reaching finality by voting with one-third of the total stake. There is a mechanism to defend against this: the [inactivity leak](https://arxiv.org/pdf/2003.03052.pdf). This activates whenever the chain fails to finalize for more than four epochs. The inactivity leak bleeds away the staked ether from validators voting against the majority, allowing the majority to regain a two-thirds majority and finalize the chain. +A transaction has "finality" in distributed networks when it's part of a block that can't change without a significant amount of ETH getting burned. On proof-of-stake Ethereum, this is managed using "checkpoint" blocks. The first block in each epoch is a checkpoint. Validators vote for pairs of checkpoints that it considers to be valid. If a pair of checkpoints attracts votes representing at least two-thirds of the total staked ETH, the checkpoints are upgraded. The more recent of the two (target) becomes "justified". The earlier of the two is already justified because it was the "target" in the previous epoch. Now it is upgraded to "finalized". To revert a finalized block, an attacker would commit to losing at least one-third of the total supply of staked ETH. The exact reason for this is explained in this [Ethereum Foundation blog post](https://blog.ethereum.org/2016/05/09/on-settlement-finality/). Since finality requires a two-thirds majority, an attacker could prevent the network from reaching finality by voting with one-third of the total stake. There is a mechanism to defend against this: the [inactivity leak](https://arxiv.org/pdf/2003.03052.pdf). This activates whenever the chain fails to finalize for more than four epochs. The inactivity leak bleeds away the staked ETH from validators voting against the majority, allowing the majority to regain a two-thirds majority and finalize the chain. ## Crypto-economic security {#crypto-economic-security} -Running a validator is a commitment. The validator is expected to maintain sufficient hardware and connectivity to participate in block validation and proposal. In return, the validator is paid in ether (their staked balance increases). On the other hand, participating as a validator also opens new avenues for users to attack the network for personal gain or sabotage. To prevent this, validators miss out on ether rewards if they fail to participate when called upon, and their existing stake can be destroyed if they behave dishonestly. There are two primary behaviors that can be considered dishonest: proposing multiple blocks in a single slot (equivocating) and submitting contradictory attestations. The amount of ether slashed depends on how many validators are also being slashed at around the same time. This is known as the ["correlation penalty"](https://arxiv.org/pdf/2003.03052.pdf), and it can be minor (~1% stake for a single validator slashed on their own) or can result in 100% of the validator's stake getting destroyed (mass slashing event). It is imposed halfway through a forced exit period that begins with an immediate penalty (up to 0.5 ETH) on Day 1, the correlation penalty on Day 18, and finally, ejection from the network on Day 36. They receive minor attestation penalties every day because they are present on the network but not submitting votes. This all means a coordinated attack would be very costly for the attacker. +Running a validator is a commitment. The validator is expected to maintain sufficient hardware and connectivity to participate in block validation and proposal. In return, the validator is paid in ETH (their staked balance increases). On the other hand, participating as a validator also opens new avenues for users to attack the network for personal gain or sabotage. To prevent this, validators miss out on ETH rewards if they fail to participate when called upon, and their existing stake can be destroyed if they behave dishonestly. There are two primary behaviors that can be considered dishonest: proposing multiple blocks in a single slot (equivocating) and submitting contradictory attestations. The amount of ETH slashed depends on how many validators are also being slashed at around the same time. This is known as the ["correlation penalty"](https://arxiv.org/pdf/2003.03052.pdf), and it can be minor (~1% stake for a single validator slashed on their own) or can result in 100% of the validator's stake getting destroyed (mass slashing event). It is imposed halfway through a forced exit period that begins with an immediate penalty (up to 0.5 ETH) on Day 1, the correlation penalty on Day 18, and finally, ejection from the network on Day 36. They receive minor attestation penalties every day because they are present on the network but not submitting votes. This all means a coordinated attack would be very costly for the attacker. ## Fork choice {#fork-choice} @@ -44,7 +44,7 @@ When the network performs optimally and honestly, there is only ever one new blo ## Proof-of-stake and security {#pos-and-security} -The threat of a [51% attack](https://www.investopedia.com/terms/1/51-attack.asp) still exists on proof-of-stake as it does on proof-of-work, but it's even riskier for the attackers. A attacker would need 51% of the staked ETH (about $15,000,000,000 USD). They could then use their own attestations to ensure their preferred fork was the one with the most accumulated attestations. The 'weight' of accumulated attestations is what consensus clients use to determine the correct chain, so this attacker would be able to make their fork the canonical one. However, a strength of proof-of-stake over proof-of-work is that the community has flexibility in mounting a counter-attack. For example, the honest validators could decide to keep building on the minority chain and ignore the attacker's fork while encouraging apps, exchanges, and pools to do the same. They could also decide to forcibly remove the attacker from the network and destroy their staked ether. These are strong economic defenses against a 51% attack. +The threat of a [51% attack](https://www.investopedia.com/terms/1/51-attack.asp) still exists on proof-of-stake as it does on proof-of-work, but it's even riskier for the attackers. A attacker would need 51% of the staked ETH. They could then use their own attestations to ensure their preferred fork was the one with the most accumulated attestations. The 'weight' of accumulated attestations is what consensus clients use to determine the correct chain, so this attacker would be able to make their fork the canonical one. However, a strength of proof-of-stake over proof-of-work is that the community has flexibility in mounting a counter-attack. For example, the honest validators could decide to keep building on the minority chain and ignore the attacker's fork while encouraging apps, exchanges, and pools to do the same. They could also decide to forcibly remove the attacker from the network and destroy their staked ETH. These are strong economic defenses against a 51% attack. 51% attacks are just one flavor of malicious activity. Bad actors could attempt long-range attacks (although the finality gadget neutralizes this attack vector), short range 'reorgs' (although proposer boosting and attestation deadlines mitigate this), bouncing and balancing attacks (also mitigated by proposer boosting, and these attacks have anyway only been demonstrated under idealized network conditions) or avalanche attacks (neutralized by the fork choice algorithms rule of only considering the latest message). @@ -57,7 +57,7 @@ Overall, proof-of-stake, as it is implemented on Ethereum, has been demonstrated | Staking makes it easier for individuals to participate in securing the network, promoting decentralization. validator node can be run on a normal laptop. Staking pools allow users to stake without having 32 ETH. | Proof-of-stake is younger and less battle-tested compared to proof-of-work | | Staking is more decentralized. Economies of scale do not apply in the same way that they do for PoW mining. | Proof-of-stake is more complex to implement than proof-of-work | | Proof-of-stake offers greater crypto-economic security than proof-of-work | Users need to run three pieces of software to participate in Ethereum's proof-of-stake. | -| Less issuance of new ether is required to incentivize network participants | | +| Less issuance of new ETH is required to incentivize network participants | | ## Further reading {#further-reading} @@ -67,6 +67,7 @@ Overall, proof-of-stake, as it is implemented on Ethereum, has been demonstrated - [The Beacon Chain Ethereum 2.0 explainer you need to read first](https://ethos.dev/beacon-chain/) _Ethos.dev_ - [Why Proof of Stake (Nov 2020)](https://vitalik.ca/general/2020/11/06/pos2020.html) _Vitalik Buterin_ - [Proof of Stake: How I Learned to Love Weak Subjectivity](https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/) _Vitalik Buterin_ +- [PoS Ethereum attack and defense](https://mirror.xyz/jmcook.eth/YqHargbVWVNRQqQpVpzrqEQ8IqwNUJDIpwRP7SS5FXs) - [A Proof of Stake Design Philosophy](https://medium.com/@VitalikButerin/a-proof-of-stake-design-philosophy-506585978d51) _Vitalik Buterin_ ## Related topics {#related-topics} From a37abcb109e4e769912da719691e0b72e5562ab4 Mon Sep 17 00:00:00 2001 From: Joshua <62268199+minimalsm@users.noreply.github.com> Date: Mon, 18 Jul 2022 16:31:03 +0100 Subject: [PATCH 2/5] Update src/content/developers/docs/consensus-mechanisms/pos/index.md --- src/content/developers/docs/consensus-mechanisms/pos/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/developers/docs/consensus-mechanisms/pos/index.md b/src/content/developers/docs/consensus-mechanisms/pos/index.md index f8ee157dccd..106d7090331 100644 --- a/src/content/developers/docs/consensus-mechanisms/pos/index.md +++ b/src/content/developers/docs/consensus-mechanisms/pos/index.md @@ -5,6 +5,7 @@ lang: en sidebar: true --- + Proof-of-stake (PoS) is Ethereum's [consensus mechanism](/developers/docs/consensus-mechanisms/). Ethereum switched on its proof-of-stake mechanism in 2022 because it is more secure, less energy-intensive, and better for implementing new scaling solutions compared to the previous consensus mechanism, [proof-of-work](/developers/docs/consensus-mechanisms/pow). ## Prerequisites {#prerequisites} From e74c8b6ec7949cf9216fab6d411069b67ae882e5 Mon Sep 17 00:00:00 2001 From: Joshua <62268199+minimalsm@users.noreply.github.com> Date: Mon, 18 Jul 2022 16:31:23 +0100 Subject: [PATCH 3/5] Update src/content/developers/docs/consensus-mechanisms/pos/index.md --- src/content/developers/docs/consensus-mechanisms/pos/index.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/content/developers/docs/consensus-mechanisms/pos/index.md b/src/content/developers/docs/consensus-mechanisms/pos/index.md index 106d7090331..f8ee157dccd 100644 --- a/src/content/developers/docs/consensus-mechanisms/pos/index.md +++ b/src/content/developers/docs/consensus-mechanisms/pos/index.md @@ -5,7 +5,6 @@ lang: en sidebar: true --- - Proof-of-stake (PoS) is Ethereum's [consensus mechanism](/developers/docs/consensus-mechanisms/). Ethereum switched on its proof-of-stake mechanism in 2022 because it is more secure, less energy-intensive, and better for implementing new scaling solutions compared to the previous consensus mechanism, [proof-of-work](/developers/docs/consensus-mechanisms/pow). ## Prerequisites {#prerequisites} From 6e96ee262d297233995d279a2eb3787c0e5e6fd5 Mon Sep 17 00:00:00 2001 From: Joseph Cook <33655003+jmcook1186@users.noreply.github.com> Date: Mon, 25 Jul 2022 15:46:22 +0100 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com> --- src/content/developers/docs/consensus-mechanisms/pos/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/developers/docs/consensus-mechanisms/pos/index.md b/src/content/developers/docs/consensus-mechanisms/pos/index.md index f8ee157dccd..2d29321ad7f 100644 --- a/src/content/developers/docs/consensus-mechanisms/pos/index.md +++ b/src/content/developers/docs/consensus-mechanisms/pos/index.md @@ -5,7 +5,7 @@ lang: en sidebar: true --- -Proof-of-stake (PoS) is Ethereum's [consensus mechanism](/developers/docs/consensus-mechanisms/). Ethereum switched on its proof-of-stake mechanism in 2022 because it is more secure, less energy-intensive, and better for implementing new scaling solutions compared to the previous consensus mechanism, [proof-of-work](/developers/docs/consensus-mechanisms/pow). +Proof-of-stake (PoS) underlies Ethereum's [consensus mechanism](/developers/docs/consensus-mechanisms/). Ethereum switched on its proof-of-stake mechanism in 2022 because it is more secure, less energy-intensive, and better for implementing new scaling solutions compared to the previous [proof-of-work](/developers/docs/consensus-mechanisms/pow) architecture. ## Prerequisites {#prerequisites} @@ -13,7 +13,7 @@ To better understand this page, we recommend you first read up on [consensus mec ## What is proof-of-stake (PoS)? {#what-is-pos} -Proof-of-stake is a type of [consensus mechanism](/developers/docs/consensus-mechanisms/) used by blockchains to achieve distributed consensus. In proof-of-work, miners prove they have capital at risk by expending energy. In proof-of-stake, validators explicitly stake capital in the form of ETH into a smart contract on Ethereum. This staked ETH then acts as collateral that can be destroyed if the validator behaves dishonestly or lazily. The validator is then responsible for checking that new blocks propagated over the network are valid and occasionally creating and propagating new blocks themselves. +Proof-of-stake underlies certain [consensus mechanisms](/developers/docs/consensus-mechanisms/) used by blockchains to achieve distributed consensus. In proof-of-work, miners prove they have capital at risk by expending energy. Ethereum uses proof-of-stake, where validators explicitly stake capital in the form of ETH into a smart contract on Ethereum. This staked ETH then acts as collateral that can be destroyed if the validator behaves dishonestly or lazily. The validator is then responsible for checking that new blocks propagated over the network are valid and occasionally creating and propagating new blocks themselves. Proof-of-stake comes with a number of improvements to the now-deprecated proof-of-work system: From 48febd73b4cfa7cf3396cbbf0e205392129a6764 Mon Sep 17 00:00:00 2001 From: Joshua <62268199+minimalsm@users.noreply.github.com> Date: Mon, 8 Aug 2022 13:21:47 +0100 Subject: [PATCH 5/5] Update src/content/developers/docs/consensus-mechanisms/pos/index.md --- src/content/developers/docs/consensus-mechanisms/pos/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/developers/docs/consensus-mechanisms/pos/index.md b/src/content/developers/docs/consensus-mechanisms/pos/index.md index 2d29321ad7f..4cc9b880e5b 100644 --- a/src/content/developers/docs/consensus-mechanisms/pos/index.md +++ b/src/content/developers/docs/consensus-mechanisms/pos/index.md @@ -67,7 +67,7 @@ Overall, proof-of-stake, as it is implemented on Ethereum, has been demonstrated - [The Beacon Chain Ethereum 2.0 explainer you need to read first](https://ethos.dev/beacon-chain/) _Ethos.dev_ - [Why Proof of Stake (Nov 2020)](https://vitalik.ca/general/2020/11/06/pos2020.html) _Vitalik Buterin_ - [Proof of Stake: How I Learned to Love Weak Subjectivity](https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/) _Vitalik Buterin_ -- [PoS Ethereum attack and defense](https://mirror.xyz/jmcook.eth/YqHargbVWVNRQqQpVpzrqEQ8IqwNUJDIpwRP7SS5FXs) +- [Proof-of-stake Ethereum attack and defense](https://mirror.xyz/jmcook.eth/YqHargbVWVNRQqQpVpzrqEQ8IqwNUJDIpwRP7SS5FXs) - [A Proof of Stake Design Philosophy](https://medium.com/@VitalikButerin/a-proof-of-stake-design-philosophy-506585978d51) _Vitalik Buterin_ ## Related topics {#related-topics}