An article to understand the working principle of Ethereum pledged withdrawal

Original: “Understanding Withdrawals” by Jim McDonald

Translator: John, ECN Reviewer: Franci, ECN

Withdrawals are the missing part of the validator lifecycle, which has been in development since December 2020 when the Ethereum consensus chain first launched, and will now come with the Shanghai upgrade. Since the Shanghai upgrade will be launched in the first half of this year, it is worth noting and understanding what withdrawal is, how it works, and how to use this new feature.


When the consensus chain first launches in December 2020, you cannot send any information from the consensus chain to the execution chain. In other words, although the balance can be accumulated on the consensus chain, you cannot withdraw cash through the execution chain, because withdrawal is technically impossible at that time. Over the years, the structure of Ethereum has been changed to accommodate new research results, transformed into the current layer 2-centric expansion model, and largely maintained the original appearance of the execution chain. In September 2022, the execution chain merges with the consensus chain, and the execution block becomes a subset of the data in the consensus block. At this point it is feasible to transfer information from the consensus chain to the execution chain, an example of which is validator rewards.

You can find detailed details on how the consensus and execution chains interact and how merged blocks are constructed in the article “Understanding post-merge rewards”. The key point is that withdrawals become possible only after the merger.

What are validators doing?

Since the consensus chain genesis in December 2020, validators have been producing blocks and maintaining the security of the chain. Specifically, they have been proposing new blocks and participating in voting on blocks proposed by themselves and other validators (Note 2). When executed correctly, these actions generate rewards for validators. The Consensus Chain launched with just over 20,000 validators, but at the time of writing has around 520,000 active validators ensuring its security. From December 2020 to September 2022, the consensus chain only maintains its own security, but this paves the way for the merger to come (Note 3), and from September 2022 onwards the execution chain is already only validator We guarantee its safety.

In return for their actions in maintaining the security of the blockchain, these validators are promised rewards directly generated by the Ethereum protocol, recorded on the consensus chain.

What happened to validator rewards?

Because the consensus chain itself has no execution capability, the ETH accumulated on it cannot be transferred from one account to another. It’s true that the consensus chain doesn’t even have the concept of an account, and the only entity on the chain with a balance is the validator itself. This means that these validator rewards, while increasing steadily over the past two years, do not have a way to withdraw them.

An article to understand the working principle of Ethereum pledged withdrawal

Among all validators, the consensus chain has generated more than 1 million ETH as cumulative rewards. In the case of individual validators, their rewards depend on a number of factors, but the most obvious is their time as an active validator. There are many validators who have amassed a huge amount of rewards:

Most validators received rewards of less than 2 ETH, some as high as 5 ETH, although these rewards are registered on the consensus chain, they cannot be instantiated on the execution chain until the withdrawal function is in place .

Note that since the merge, in addition to the above rewards, validators who propose blocks receive a portion of transaction fees. These fees are paid directly on the execution chain, so they will not be discussed below.

What did the Shanghai upgrade change?

The Shanghai upgrade (Note 4) provides a mechanism to transfer rewards from the consensus chain to the execution chain. Each execution block will include about 16 withdrawals (Note 5) data that transfer ETH to the execution chain account. Withdrawal has the following data structure:

An article to understand the working principle of Ethereum pledged withdrawal

Diagram 3: A withdrawal

The individual components of a withdrawal are:

Withdrawal index A unique identifier for a withdrawal for easy reference.

Validator index (Validator index) The index of the validator of a withdrawal source on the consensus chain

Address (Address) The address where withdrawals will be funneled

Amount (Amount) The amount of ETH that will be added to the account, in Gwei (Note 6)

When a block is imported into the execution chain, the withdrawal will be processed according to the given amount, and the balance of the corresponding address will increase. Note that withdrawals are not transactions, they do not consume gas, and they do not trigger any smart contract operations at the withdrawal address. Once a block has been processed, the corresponding balance will increase, but nothing else will happen.

Where did the withdrawn ETH come from?

The above information describes what a withdrawal is, but where does the ETH come from when the withdrawal occurs?

Although a validator profile is created by depositing 32 ETH to the Ethereum deposit contract, this ETH cannot be accessed for withdrawal purposes because there is no mechanism in the contract to allow token transfers. The use of the sum of these accounts will also eventually lead to a negative balance in the contract, because the sum of the verifier’s balance on the consensus chain now exceeds the sum of the initial deposits.

Withdrawals are paid with funds generated according to the Ethereum protocol (i.e. newly minted ETH), rather than transferred from existing accounts. This ensures that withdrawals can always be paid out, even if the total amount withdrawn from the consensus chain is higher than the total amount deposited.

Withdrawal clock

Internally, the consensus layer software maintains a simple list of validators:

An article to understand the working principle of Ethereum pledged withdrawal

The individual components of each validator entity are:

Index (Index) The unique index corresponding to this validator and its position in the list

State (State) The current state of the validator, such as “active” or “exiting” (Note 7)

Balance (Balance) The current balance of the validator, in Gwei

Withdrawal credentials (Withdrawal credentials) The validator’s withdrawal credentials

Most of these concepts above are self-explanatory, however withdrawal vouchers require some explanation. Each validator has a set of withdrawal credentials. These credentials control the flow of consensus layer funds, including initial deposits and subsequent rewards.

There are currently two withdrawal certificates:

  • Generated from BLS public key, known as “type 0” withdrawal certificate
  • Generated from the execution address, it is called a “type 1” withdrawal certificate.

We’ll explore these concepts in more detail later, but for now the big difference is that type 1 withdrawal tokens allow consensus funds to be withdrawn to the execution chain, whereas type 0 withdrawal tokens do not.

The consensus chain processes withdrawals sequentially, starting at index 0, going down to the last index in a set, and then starting from the beginning again. You can use a single-hand analog clock as a way of thinking about the cash withdrawal process. Each tick on the clock represents a validator, starting from validator index 0 to the last one (currently about 520,000).

An article to understand the working principle of Ethereum pledged withdrawal

Chart 4 Withdrawal clock

Once the Shanghai upgrade goes live, the block will contain withdrawal information. In order to select which validators can withdraw, the clock hands rotate around the validators, and each time it points to a validator who is eligible to withdraw, some or all of the validator’s balance will be withdrawn according to the following rules:

  • If the verifier has a type 1 certificate, is in the “active” state (Note 8), and has a balance of more than 32 ETH, then the part exceeding 32 ETH will be withdrawn.
  • If the validator has a type 1 credential and is in the “withdrawable” state with a non-zero balance, then all remaining balances will be withdrawn.

If one of the above rules applies, a withdrawal is made and added to the block; if neither of the above applies, the validator is deemed ineligible and the pointer continues to go down. The pointer will continue to jump until it finds 16 qualified verifiers (Note 9). At this time, the number of withdrawals required for a single block is sufficient, and the withdrawal information will be included in the block.

The time it takes for the hands of the clock to complete a round depends on the number of validators who are eligible.

An article to understand the working principle of Ethereum pledged withdrawal

There are approximately 520,000 active validators at the time of writing. With 16 withdrawals per block and 7,200 blocks per day, it will take approximately 4.5 days to process each round of eligible validator sets. But as the graph above shows, this time will change as the number of eligible validators changes.

Procedure for Amending Withdrawal Voucher

As mentioned above, to qualify as a validator you must have a type 1 withdrawal voucher. At the time of writing, about 40% of validators have type 1 certificates, and the rest have type 0 certificates. The Shanghai upgrade will bring the ability to upgrade from type 0 to type 1 withdrawal certificates so validators can receive rewards. Modifying withdrawal credentials requires creating a signed operation that is broadcast on the consensus chain. The structure of this operation is as follows:

An article to understand the working principle of Ethereum pledged withdrawal

Figure 6: Operations to modify the withdrawal certificate

The components of the operation are:

  • Validator index The index of the validator to which this operation applies
  • Withdrawal BLS public key (Withdrawal BLS public key) The BLS public key of the current BLS withdrawal certificate
  • Execution address Execution address for new withdrawal vouchers
  • Signature A signature made by the private key of the current BLS withdrawal credential on other fields of the operation.

The operation process on the beacon chain is as follows:

“For each validator defined by the validator index, check whether the given BLS public key can be converted to a type 0 withdrawal certificate matching the current validator. If so, convert the given execution address to type 1’s withdrawal credentials and updated for validators.”

Therefore, the operation to modify a credential can only occur once. Once the modification of the credential is processed, the definition of the on-chain validator will include a type 1 withdrawal credential, so there will be no type 0 withdrawal credential to match as described above. That is, once a type 1 credential is set, it will remain unchanged during its lifetime. (Note 11)

Select execution address

The first step in modifying the withdrawal certificate is to select the Ethereum execution address to receive the withdrawal. As described above, you can only make one change, so you must ensure that you have secured control of the address private key before making the settings. If you have multiple validator identities then you need to consider whether to provide a different withdrawal address for each validator identity, or use the same address for all validator identities:

It is convenient for you to set the same address, and the rewards will be accumulated to this address faster, so the gas consumed will be less.

Setting up different addresses and keeping them unrelated increases the security of your validator identity, if these validator identities are not related to each other (different savings addresses, different or non-existent block proposal graffiti wait)

create operation

Once an execution address is selected, an operation needs to be created and signed for each validator. Due to the sensitivity of exposing private information related to withdrawal credentials (could be private keys or seed phrases), we recommend offline creation. How to do this is beyond the scope of this article, but you can refer to the detailed guide for doing so using the ethdo tool, or use other tools and wizards that will become available in the future.

broadcast operation

After creating operations, you need to broadcast them on the consensus chain. If the operation is provided to the consensus node after the Shanghai upgrade, it will be broadcast to the network at the next opportunity to be packaged into the block. If the operation was provided to consensus nodes before the Shanghai upgrade, it will be stored and broadcast to the network after the upgrade is complete. Note that this requires you to be connected to a consensus node that recognizes the Shanghai upgrade; as of right now these consensus nodes are expected to be available sometime in February, providing a good time for the mainnet upgrade.

Online/Offline Process

As mentioned above, creating credential modification operations should be done offline. This avoids the situation where the private key for withdrawal is exposed to an unsafe computer and the private key is stolen. However, accessing an online computer requires obtaining information from the beacon node and ultimately broadcasting the credential modification operation. Therefore, we recommend using an online/offline process to create and broadcast modification operations.

An article to understand the working principle of Ethereum pledged withdrawal

Figure 7: Create and broadcast modify withdrawal voucher operations in online and offline configurations

There are quite a few tools that follow this process. For example, ethdo has their own documentation explaining how to do this process. The following is an overview of each step, describing its role and significance.

1. Obtain information on the chain

To create a valid signed credential modification operation, you need to obtain different information from the chain, which should be obtained from the chain itself to ensure that it is the correct information. We also recommend getting a list of all current validators. Because it makes it easier to create operations and at the same time verify that the created operations are suitable for validators.

This information comes from an active consensus node, so it needs to be obtained from a computer connected to the Internet. Most entities running validator programs should have access to consensus nodes, but if they delegate the staking process to a facilitator, they should seek to obtain the necessary information from the facilitator.

This will produce a file containing information on the chain. The files themselves will not carry private keys or other sensitive information.

2. Transfer information on the chain

Once the chain information is collected, it needs to be transferred from an online computer to an offline computer. The current common practice is to use USB storage, which allows two computers to transfer information without direct connection. This means that offline computers can be completely disconnected from the Internet, greatly increasing the security of private keys or seed words.

3. Create Credentials Operations

Once the chain information is available on the offline computer, the credential modification operation can be created. This requires access to the seed phrase and private key that created the current withdrawal credentials, so it is more secure to run the process on an offline computer.

The private key and mnemonic may create credentials for multiple verifiers, so the creation process may result in multiple modification operations.

This will produce a file containing the operations to modify the credentials, the file itself will not contain private keys or other sensitive information.

4. Modify operation of transfer certificate

Once the file for the credential modification operation has been created, it needs to be transferred from the offline computer to the online computer. Again, USB storage or similar is a general best practice.

5. Broadcast credential modification operation

Once the online computers have a file of credential modification operations, they can be broadcast to the Ethereum network by sending these operations to a consensus node. Most likely it is sent to the node where the download chain information comes back.

Once the operations are submitted to the consensus node, the node will broadcast them throughout the network, and once the consensus block packages these operations, the modification will take effect. Each block has room for 16 modification operations, so it may take 4 days for an operation to be added to a block, but more likely 1-2 hours.


The withdrawal function will be rolled out with the Shanghai upgrade, making consensus rewards available to users for the first time since the launch of the consensus chain. Once set up, they are automatically available to any validator, and the upgrade also brings a mechanism to configure validators that are not yet ready to withdraw.

After the validator life cycle is completed, the consensus chain fulfills the promise made to the pledgers since December 2020, and allows the validators to leave the system that they thought they might not be able to leave. Additional validators will bring stronger security and a stronger chain to Ethereum.

1. There are multiple chains in Ethereum, usually called the consensus chain (or beacon chain) and the execution chain. For more information, please refer to the article “Understanding Merged Rewards”.

2. They also participate in sync committees, but these are just another form of witnessing.

3. It is to use common sayings to explain the migration of Ethereum from the proof-of-work consensus mechanism to the proof-of-stake consensus mechanism.

4. Simultaneously with the Capella upgrade on the consensus chain.

5. Strictly speaking, the maximum number of withdrawals can reach 16, except for extreme cases, all slots should be full.

6. All values ​​on the consensus chain are in Gwei, so any token transfer from the consensus chain to the execution chain is an integer in Gwei.

7. The state actually comes from other fields in the validator info, so it doesn’t show up in the validator definition, but since it’s referenced elsewhere in the article, it’s shown here.

8. For the status definitions of “active” and “withdrawable”, please refer to the article “Understanding the validator life cycle”

9. After 16384 validators, the hand of the withdrawal clock will stop beating, even if there are not enough 16 qualified validators, although this is unlikely to happen outside the testnet.

10. The number was actually around 7160 at the time of writing, as some blocks were not proposed or became orphaned after being proposed.

11. This may change in the future as new operations are introduced, but at the time of writing there are no such plans.

12. It is expected that there will be an initial peak of validators modifying their credentials in the first few days after the upgrade, after which there will be very few people queuing as most validators who are eligible to modify their credentials have already done so.

Click “Read the original text” to get the internal link of the article!

Original link:

ECN’s translation and editing work aims to deliver high-quality information and learning resources for the Ethereum Chinese community. The copyright of the article belongs to the original author, and the source of the original text and ETH Chinese must be indicated when reprinting. For long-term reprinting, please contact [email protected] for authorization.

An article to understand the working principle of Ethereum pledged withdrawal

Related Posts

Analysis of Pendle and the Pendle War it triggered

By: Jaden, LD Capital Research 1. Current status of Pendle Pendle Finance is a revenue strategy agreement deployed on Ethereum and Arbitrum. It will launch the v2 version at the end of 2022 and change the economic model, and then support LST…
Read More