ETH Withdrawals After Shanghai: the Hardcore Guide for Validators

24 Feb 2023
17 min read
Staking
Guide for Validators
Shanghai
ethereum
ETH
17 min read
Article content
Types of ETH Withdrawals
How to Check if the Validator is Ready for ETH Withdrawal
How to Make Withdrawal Credentials Compatible for Funds Unstake With staking-deposit-cli
Steps to Exit Staking
Summing Up

On February 1st, the Zhejiang public withdrawal testnet was activated on Ethereum. After February 7th’s hardfork, it simulates the withdrawal of ETH from the Beacon Chain’s staking contract. It signifies an essential step in testing how the network handles the withdrawal of staked ETH for developers and regular users alike.

Everstake’s DevOps team has tested partial withdrawal (rewards skimming) and full withdrawal of funds from the Beacon Chain. They shared their findings in this technical guide for validators on how those kinds of withdrawal will work once the Shanghai upgrade is live. 

Types of ETH Withdrawals

With the Shanghai/Capella update, withdrawals will become integral to Beacon Chain, including EIP-4895. This Ethereum improvement proposal allows the automatic withdrawal of rewards to an execution-level address. Also, it will enable active validators to unlock their entire balance without paying for gas. That said, there are two types of withdrawals.

Partial withdrawal, or rewards skimming, occurs when an active validator has a maximum effective balance of 32 ETH and a total balance exceeding said amount. A single validator cannot receive a reward for an excess balance (more than 32 ETH). Thus, these accounts will automatically receive an extra balance. The term “partial withdrawal” is sometimes used as the remaining 32 ETH remain locked and deposited. 

Example:

Epoch

On the other hand, if the validator wants to unstake its entire balance, it will need to go through a full withdrawal process, which implies the exit and stop being a part of the beacon chain. After the exit and withdrawal mechanism is completed, the entire validator balance (32 ETH and any rewards) will be unlocked and allowed to be spent.

Example:

undefined

Depending on how you set up your initial deposit, your account may or may not be ready for a withdrawal: if you used --eth1_withdrawal_address flag when generating your keys, you can consider yourself ready. If you did not use --eth1_withdrawal_address, you must change withdrawal_credentials to the bls_withdrawal address format to enable withdrawal.

How to Check if the Validator is Ready for ETH Withdrawal

There are several ways to check if the validator is ready for withdrawal (whether partial or full):

  1. Open https://zhejiang.launchpad.ethereum.org/en/withdrawals and enter the validator index.

An exemplary message on the validator's readiness for withdrawal (bound to eth1_withdrawal_address)

undefined

An exemplary message on the validator's unreadiness for withdrawal (not bound to eth1_withdrawal_address)

undefined

  1. Go to https://zhejiang.beaconcha.in/validators, where the validator address must be entered.

An example of a validator ready for withdrawal (the Withdrawals menu is active)

undefined

An example of a validator not ready for withdrawal (the Withdrawals menu is not active)

undefined

How to Make Withdrawal Credentials Compatible for Funds Unstake With staking-deposit-cli

If you do not use --eth1_withdrawal_address to enable withdrawal, you will need to change withdrawal_credentials to bls_withdrawal execution address format, for example, via staking-deposit-cli:

  1. Find validator index
    Go to https://zhejiang.beaconcha.in and enter the validator address (in our example, the validator address is a17afd48695c2c657e276eacf6198457bdbcdfa1d3920ecde4234f914632ec837980871c6f1f522512c420167b6e06c7). There, you get information about the validator and its index (an example index is 61632):
    undefined

  2. Find withdrawal_credentials for this validator address.
    Withdrawal_credentials can be found in the deposit_data-*.json file (if you have keys generated via staking-data-cli, you usually may find them in the validator_keys directory. Example: cat staking_deposit-cli/validator_keys/deposit_data-1675696936.json | jq .
    Code

    In our example, withdrawal_credentials 0033d2ac41932090f960b6de17f3ca62753a4d8003426dde4cbb048f0dcfb021

  1. Download staking-deposit-cli with generate_bls_to_execution_change, unzip it, and go to the directory with the binary file.
    For linux and
    1. mkdir tmp && cd tmp && wget []() && tar zxvf 
    2. staking_deposit-cli-c9b4e01-linux-amd64.tar.gz && cd cd
    3. staking_deposit-cli-c9b4e01-linux-amd64

  2. Change the withdrawal_credentials format to the bls_withdrawal execution address

. /deposit --language=english generate-bls-to-execution-change --chain=zhejiang --mnemonic="you mnemonic" --bls_withdrawal_credentials_list="0x0033d2ac41932090f960b6de17f3 ca62753a4d8003426dde4cbb048f0dcfb021" -validator_start_index=2 --validator_indices="61632" --execution_address='0x48F0dC92d9562645a9646916F101Fc6911C48084’

chain= – network name (in our case, Zhejiang)
bls_withdrawal_credentials_list - current bls_withdraw you want to change can be done as a comma-separated list (in this example, one 0033d2ac41932090f960b6de17f3ca62753a4d8003426dde4cbb048f0dcfb021 in the format of 0x0033d2ac41932090f960b6de17f3ca62753a4d8003426dde4cbb048f0dcfb021) validator_start_index is the index of the validator key you want to change bls_withdrawal from. 

Please note:

  • If you have multiple keys and you want to change bls_withdrawal for all of them, then you should use validator_start_index=0

  • If you have multiple keys and you want to change bls_withdrawal only for a particular validator, enter its index, following the order in which it is stored in the deposit_data-*.json file (starting with 0 rather than 1). In our example, we want to change bls_withdrawal for the validator, the third in the deposit_data-*.json file. Its index number will be two.

validator_indices: the index of the validator you want to change bls_withdrawal_credentials for (you can find it in the validator logs or on https://zhejiang.beaconcha.in. in our example, a validator index for whom we change bls_withdrawal is 61632). You can also create a comma-separated list.
execution_address: an execution address where the balance will be withdrawn (in our example, 0x48F0dC92d9562645a9646916F101Fc6911C48084). 

Example: /deposit --language=english generate-bls-to-execute-change --chain=zhejiang --mnemonic="rasgo culto cofre patio paso pichón enero venta multa cemento plomo música caballo pilar atún letal toser informe exigir etapa paella pijama sensor situar" -bls_withdrawal_credentials_list="0x0033d2ac41932090f960b6de17f3ca62753a4d8003426dde4cbb048f0dcfb021" --validator_start_index=2 --validator_indices="61632" --execution_address='0x48F0dC92d9562645a9646916F101Fc6911C48084’

Code

You need to confirm the execution address to which the balance will be withdrawn.

After the command’s execution, the bls_to_execution_change-*.json file will be created alongside the respective path.

undefined

  1. Upload bls_to_execution_change-*.json to the pool Beacon Node

Example: (CL-PRYSM)
curl -X POST -H “Content-type: application/json” -d "@/path-to-bls_to_execution_change-*.json" http:/127.0.0.1:3500/eth/v1/beacon/pool/bls_to_execution_changes

Code

Important: you will not get any response after sending the POST request.

  1. Check the validator for the bounded eth1_withdrawal_address

https://zhejiang.beaconcha.in/validator/a17afd48695c2c657e276eacf6198457bdbcdfa1d3920ecde4234f914632ec837980871c6f1f522512c420167b6e06c7

undefined

https://zhejiang.launchpad.ethereum.org/en/withdrawals

undefined

You are ready now!

Steps to Exit Staking

Exit staking (full withdrawal): 

The prysm binary is not currently available as is for the Zhejiang network. In the example, we used Bazel v5.3.0.

  1. Check the key list  

/usr/bin/bazel-5.3.0 run //validator -- --chain-config-file=/puth-to-custom-config-chain/custom_config_data/config.yaml --accept-terms-of-use accounts list --wallet-dir=/path-to-wallet-dir

Code

  1. Request for a voluntary exit of a validator from the network 

/usr/bin/bazel-5.3.0 run //validator -- --chain-config-file=/puth-to-custom-config-chain/custom_config_data/config.yaml --accept-terms-of-use accounts voluntary-exit --wallet-dir=/path-to-wallet-dir --public-keys=0xa17afd48695c2c657e276eacf6198457bdbcdfa1d3920ecde4234f914632ec837980871c6f1f522512c420167b6e06c7 

public-keys = A comma-separated list of hexadecimal public key strings to indicate validator accounts performing a voluntary exit. 

Example:

Code

  1. You will be asked to confirm the voluntary exit. If you did everything right, you’d see the message: “Voluntary exit was successful,” accompanied by a link to track the validator's voluntary exit.

Code
IMPORTANT: the validator voluntary exit tracking link refers to the mainnet, which is incorrect for this network. Zhejiang network tracking can be done at
https://zhejiang.beaconcha.in

Exited

  1. Following this, the validator gets the Exiting status, and an epoch at which the validator will voluntarily exit the network is defined. 

Example: (in our case, epoch 1606).

Exit epoch

  1. When your validator reaches the epoch designated for the exit (in the example, epoch 1606), the validator exits the network (the validator status becomes Exited) and is notified of the epoch after which the funds will become available (in the example, epoch 1862). They will be automatically withdrawn to a previously set --eth1_withdrawal_address (in our case, 0x48F0dC92d9562645a9646916F101Fc6911C48084). 

Example: 

Exit and withdrawal epoch

  1. On the screenshots below, when an epoch has been reached (in our case, epoch 1862), all funds are automatically withdrawn to eth1_withdrawal_address (in our example, funds were withdrawn in the next epoch, 1863).
    Withdrawal epochWithdrawal transaction

MetaMask

Here are some other useful resources to dive into ETH withdrawals:

- How to use staking-deposit-cli to generate SignedBLSToExecutionChange

- Staking Launchpad (Zhejiang): Staking withdrawals

- Prysm Documentation: Exit your validator

Summing Up

Zhejiang testnet is a critical milestone preceding the Shanghai / Cappella upgrade coming in March. It is intended to give the community a practice run for withdrawals, as they are a highly-anticipated and long-awaited feature for the main Ethereum blockchain. Zhejiang is the first of three testnets running a Shanghai simulation to conduct the withdrawal of staked ETH successfully.

If you are a solo staker or an enthusiastic validator, this guide can help you sort out the withdrawal process. Also, refer to the FAQ section on Ethereum’s official resource for any further inquiries.

Follow us on Twitter and join our Discord to remain in touch and get assistance if needed. If you have any Ethereum-specific issues, feel free to contact our ETH Blockchain Manager on Twitter.

Dark - Light
Everstake Logo
Everstake
Content Manager
Everstake is one of the most reliable PoS validators on the market, with current volumes of customer staked funds exceeding 2B$ and over 735K+ delegators as of March 2023.

Contact us

Have questions?
We’re always there to answer!

Our distributed team of 20+ community managers is online 24/7 and is ready to assist you.