Skip to content

Commit

Permalink
Merge pull request #9687 from ethereum/withdrawals-pre-shanghai
Browse files Browse the repository at this point in the history
Withdrawals pre shanghai
  • Loading branch information
corwintines authored Mar 15, 2023
2 parents bcd22b1 + 14b6d02 commit 79f4c72
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 19 deletions.
4 changes: 4 additions & 0 deletions src/components/Staking/ShanghaiCapella.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "@chakra-ui/react"
// Components
import Card from "../Card"
import Link from "../Link"
import Translation from "../Translation"
import ButtonLink from "../ButtonLink"

Expand Down Expand Up @@ -62,6 +63,9 @@ const ShanghaiCapella: FC<IProps> = (props) => {
<Text>
<Translation id="comp-capella-p-2" />
</Text>
<Text>
<Translation id="subscribe-to-ef-blog" />
</Text>
<ButtonLink
to="https://launchpad.ethereum.org/withdrawals"
mt="auto"
Expand Down
16 changes: 9 additions & 7 deletions src/components/Staking/WithdrawalCredentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ const WithdrawalCredentials: FC<IProps> = () => {
const [validator, setValidator] = useState<Validator | null>(null)

const checkWithdrawalCredentials = async (isTestnet: boolean = false) => {
const network = isTestnet ? "Goerli" : "Mainnet"
const networkLowercase = network.toLowerCase()
trackCustomEvent({
eventCategory: `Validator index`,
eventAction: `Verify on ${isTestnet ? "Goerli" : "Mainnet"}`,
eventAction: `Verify on ${network}`,
eventName: `click`,
})
setHasError(false)
setIsLoading((prev) => ({
...prev,
[isTestnet ? "testnet" : "mainnet"]: true,
[networkLowercase]: true,
}))
const endpoint = `https://${
isTestnet ? "goerli." : ""
}beaconcha.in/api/v1/validator/${inputValue}`
const endpoint = `https://${networkLowercase}.beaconcha.in/api/v1/validator/${inputValue}`
try {
const response = await fetch(endpoint)
const { data } = await response.json()
const withdrawalCredentials = data.withdrawalcredentials
const withdrawalCredentials = data.length
? data[0].withdrawalcredentials
: data.withdrawalcredentials
setValidator({
validatorIndex: parseInt(inputValue),
withdrawalCredentials,
Expand All @@ -57,7 +59,7 @@ const WithdrawalCredentials: FC<IProps> = () => {
} finally {
setIsLoading((prev) => ({
...prev,
[isTestnet ? "testnet" : "mainnet"]: false,
[networkLowercase]: false,
}))
}
}
Expand Down
14 changes: 11 additions & 3 deletions src/content/developers/docs/consensus-mechanisms/pos/keys/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Ethereum's keys are generated using [elliptic-curve cryptography](https://en.wik

However, when Ethereum switched from [proof-of-work](/developers/docs/consensus-mechanisms/pow) to [proof-of-stake](/developers/docs/consensus-mechanisms/pos) a new type of key was added to Ethereum. The original keys still work exactly the same as before—there were no changes to the elliptic-curve-based keys securing accounts. However, users needed a new type of key for participating in proof-of-stake by staking ETH and running validators. This need arose from scalability challenges associated with many messages passing between large numbers of validators that required a cryptographic method that could easily be aggregated to reduce the amount of communication required for the network to come to consensus.

This new type of key uses the [Boneh-Lyn-Shacham (BLS) signature scheme](https://wikipedia.org/wiki/BLS_digital_signature). BLS enables a very efficient aggregation of signatures but also allows reverse engineering of aggregated individual validator keys and is ideal for managing actions between validators.
This new type of key uses the [**Boneh-Lyn-Shacham (BLS)** signature scheme](https://wikipedia.org/wiki/BLS_digital_signature). BLS enables a very efficient aggregation of signatures but also allows reverse engineering of aggregated individual validator keys and is ideal for managing actions between validators.

## The two types of validator keys {#two-types-of-keys}

Expand All @@ -35,14 +35,22 @@ This flexibility has the advantage of moving validator signing keys very quickly

The **validator public key** is included in the transaction data when a user deposits ETH to the staking deposit contract. This is known as the _deposit data_ and it allows Ethereum to identify the validator.

### Withdrawal credentials {#withdrawal-credentials}

Every validator has a property known as _withdrawal credentials_. This 32-byte field begins with either a `0x00`, representing BLS withdrawal credentials, or a `0x01`, representing credentials that point to an execution address.

Validators with `0x00` BLS keys must update these credentials to point to an execution address in order to activate excess balance payments or full withdrawal from staking. This can be done by providing an execution address in the deposit data during initial key generation, _OR_ by using the withdrawal key at a later time to sign and broadcast a `BLSToExecutionChange` message.

### The withdrawal key {#withdrawal-key}

The withdrawal key will be required to move the validator balance after this is enabled in the upcoming Shanghai upgrade. Just like the validator keys, the withdrawal keys also consist of two components:
The withdrawal key will be required to update withdrawal credentials to point to an execution address, if not set during initial deposit. This will enable excess balance payments to begin being processed (beginning with the Shanghai/Capella upgrade), and will also allow users to fully withdraw their staked ETH.

Just like the validator keys, the withdrawal keys also consist of two components:

- Withdrawal **private** key
- Withdrawal **public** key

Losing this key means losing access to the validator balance. However, the validator can still sign attestations and blocks since these actions require the validator's private key, but there is little to no incentive if the withdrawal keys are lost.
Losing this key before updating withdrawal credentials to `0x01` type means losing access to the validator balance. The validator can still sign attestations and blocks since these actions require the validator's private key, however there is little to no incentive if the withdrawal keys are lost.

Separating the validator keys from the Ethereum account keys enables multiple validators to be run by a single user.

Expand Down
2 changes: 1 addition & 1 deletion src/content/guides/how-to-swap-tokens/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Review the details of the transaction. Check the exchange rate and any other fee
You can view the progress of the transaction on any blockchain explorer. This process should not take longer than 10 minutes.

You will automatically receive the swapped tokens in your wallet once the transaction is processed.
<br />
<br />

<InfoBanner shouldSpaceBetween emoji=":eyes:">
<div>Want to learn more?</div>
Expand Down
2 changes: 1 addition & 1 deletion src/content/guides/how-to-use-a-bridge/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This process should not take more than 10 minutes.
## 7. Add the selected layer 2 network to your wallet (optional)

You can use [chainlist.org](http://chainlist.org) to find the network's RPC details. Once the network is added and transaction finished, you should see the tokens in your wallet.
<br />
<br />

<InfoBanner shouldSpaceBetween emoji=":eyes:">
<div>Want to learn more?</div>
Expand Down
2 changes: 1 addition & 1 deletion src/content/guides/how-to-use-a-wallet/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Your address represents you on all Ethereum projects. You will not need to regis

5. Confirm the signature request in your wallet to establish the connection. Do note that signing this message should not require spending any ETH.
6. That's it! Start using the app. You can find some interesting projects on our [dApps page](/dapps/#explore).
<br />
<br />

<InfoBanner shouldSpaceBetween emoji=":eyes:">
<div>Want to learn more?</div>
Expand Down
6 changes: 2 additions & 4 deletions src/content/staking/withdrawals/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,13 @@ eventName="read more">
<p>It is not possible to manually request specific amounts of ETH to be withdrawn.</p>
</ExpandableCard>

<!-- TODO: Switch link to Mainnet once available -->

<ExpandableCard
title="I operate a validator, where can I find more information on preparing?"
eventCategory="FAQ"
eventAction="I operate a validator, where can I find more information on preparing?"
eventName="read more">

<p>Validator operators are recommended to visit the <a href="https://zhejiang.launchpad.ethereum.org/withdrawals/">Staking Launchpad Withdrawals (Zhejiang Testnet)</a> page where you'll find more details about how to be prepared, timing of events, and more details about how withdrawals function.</p>
<p>Validator operators are recommended to visit the <a href="https://launchpad.ethereum.org/withdrawals/">Staking Launchpad Withdrawals</a> page where you'll find more details about how to be prepared, timing of events, and more details about how withdrawals function.</p>
</ExpandableCard>

<ExpandableCard
Expand All @@ -203,7 +201,7 @@ eventName="read more">

## Further reading {#further-reading}

- [Staking Launchpad Withdrawals - Zhejiang Testnet](https://zhejiang.launchpad.ethereum.org/withdrawals)
- [Staking Launchpad Withdrawals](https://launchpad.ethereum.org/withdrawals)
- [EIP-4895: Beacon chain push withdrawals as operations](https://eips.ethereum.org/EIPS/eip-4895)
- [Ethereum Cat Herders - Shanghai](https://www.ethereumcatherders.com/shanghai_upgrade/index.html)
- [PEEPanEIP #94: Staked ETH Withdrawal (Testing) with Potuz & Hsiao-Wei Wang](https://www.youtube.com/watch?v=G8UstwmGtyE)
Expand Down
2 changes: 1 addition & 1 deletion src/content/upgrades/merge/issuance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Consensus layer issuance continues today as before The Merge, with small rewards

When validator withdrawals are enabled, stakers will be incentivized to remove their _earnings/rewards (balance over 32 ETH)_ as these funds are otherwise not contributing to their stake weight (which maxes at 32).

After withdraw functionality is enabled, stakers may also choose to exit and withdraw their entire validator balance. To ensure Ethereum is stable, the number of validators leaving simultaneously is capped. Only six validators may exit in a given epoch (6.4 minute period) depending on the total ETH staked at the time. As more validators withdraw, the maximum number of exiting validators will gradually be reduced to four to intentionally prevent large destabilizing amounts of staked ETH from being withdrawed concurrently.
After withdraw functionality is enabled, stakers may also choose to exit and withdraw their entire validator balance. To ensure Ethereum is stable, the number of validators leaving simultaneously is capped. Only six validators may exit in a given epoch (6.4 minute period) depending on the total ETH staked at the time. As more validators withdraw, the maximum number of exiting validators will gradually be reduced to four to intentionally prevent large destabilizing amounts of staked ETH from being withdrawn concurrently.

### Post-merge inflation breakdown {#post-merge-inflation-breakdown}

Expand Down
3 changes: 2 additions & 1 deletion src/intl/en/page-staking.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,6 @@
"page-staking-meta-title": "Ethereum staking",
"page-staking-withdrawals-important-notices": "Important notices",
"page-staking-withdrawals-important-notices-desc": "Withdrawals are not yet available. Please read the <a href=\"https://blog.ethereum.org/2021/12/01/eth2-merge-and-post-merge-faq/\" target=\"_blank\">Eth2 Merge and post-merge FAQ</a> for more information.",
"page-upgrades-merge-btn": "More on The Merge"
"page-upgrades-merge-btn": "More on The Merge",
"subscribe-to-ef-blog": "<a href=\"https://blog.ethereum.org/category/protocol/#subscribe\" target=\"_blank\">Subscribe to the EF Blog</a> to receive email notifications for the latest protocol announcements."
}

0 comments on commit 79f4c72

Please sign in to comment.