Understanding Ethereum Withdrawals with Shanghai Upgrade

In this article, we will dive a little deeper into the withdrawals funtionality introduced by the Shanghai/Capella upgrade.

Understanding Ethereum Withdrawals with Shanghai Upgrade

The Ethereum Shanghai/Capella upgrade is allowing stakers to withdraw their staked ETH.

Shanghai will offer 3 withdrawal functionalities:

  1. Updating withdrawal credentials: Validators can now transition from the 0x00-type credentials to the newer 0x01-type ones.
  2. Partial withdrawals: Validators can access consensus layer rewards above 32 ETH in their account.
  3. Full withdrawals: Validators can reclaim the entire balance of an exited validator.

Only validators with the new 0x01-type withdrawal credentials can perform these withdrawals. Validators using the older 0x00-type credentials can become eligible by updating their credentials. Notably, validators using the old credentials aren't under any immediate pressure to switch as they will continue earning rewards, as they have since the Beaconchain's genesis.

The Ethereum protocol utilizes an automated process to handle both types of withdrawals. Every 12 seconds, it sweeps through the validator set, identifying the first 16 eligible for either a partial or a full withdrawal. There can be up to 16 withdrawals per slot, with full withdrawals requiring extra steps and time.

A significant advantage is that executing either type of withdrawal will not incur any gas costs, as they aren't considered transactions by Ethereum's Execution Layer (EL).

These system-level operations act more like account balance top-ups, akin to coinbase transactions paid to miners in Proof of Work (PoW) blockchains.

How withdrawal credentials work

Activating a new Ethereum validator involves depositing 32 ETH, along with other data, into Ethereum’s deposit contract. The withdrawal credentials, part of this data payload, dictate where a validator’s withdrawn balance goes.

Ethereum validators can have one of two versions of withdrawal credentials. These versions are differentiated by their withdrawal prefix: either 0x00-type or 0x01-type. Only validators with 0x01-type credentials can have their balances partially or fully withdrawn. This is because 0x00 credentials derive from a BLS public key, whereas 0x01 credentials point to a standard Ethereum address.

To have ETH locked on Ethereum’s consensus layer (CL), i.e., validator balances, withdrawn and credited to an Ethereum address on the Execution Layer (EL), the validator must have a corresponding Ethereum execution address. The 0x01-type withdrawal credential provides this corresponding execution address, which the 0x00-type does not.

As of February 2023, about 58% of active Ethereum validators had 0x00-type withdrawal credentials. When the Beacon chain launched in 2020, these credentials were the only option, with the 0x01 credentials being introduced in March 2021. Hence, validators activated before this date had 0x00 credentials.

Around 20% of newly activated validators still set their withdrawal credentials to the older, 0x00-type. This could be due to solo stakers or institutions using outdated guides or a conscious choice by stakers avoiding potential tax implications. However, the tax implications of staking are not yet well-defined in many jurisdictions, and this is not tax advice. Consult a certified professional in your jurisdiction for advice.

The Capella upgrade includes a mechanism for 0x00-credentialed validators to update their withdrawal credentials to the 0x01-type. This requires the validator's owner to sign and submit a withdrawal credentials change message to Ethereum’s CL via a consensus layer client.

Withdrawal credentials Update Process

Validators wishing to update their withdrawal credentials must use their owner key to sign a withdrawal credentials change message. This message contains the validator’s public key, new withdrawal credentials, and the message’s signature. Upon submission, the CL processes these change messages to update the validator's withdrawal credentials.

To minimize the processing power required and to maintain network stability, Ethereum's consensus layer limits the number of withdrawals processed each block (12 seconds) to 16. For stakers in the back of the queue, it could take some time before their change message is processed and they can begin withdrawals.

What are Partial Withdrawals?

Partial withdrawals are a new feature introduced with the upgrade. They allow validators to withdraw earned rewards exceeding the 32 ETH deposit without having to stop validating. This option provides stakers with access to liquid rewards while keeping their validator active.

Validators can only have a partial withdrawal processed if they have a validator balance of more than 32 ETH. When partial withdrawals are processed, the validator's balance is reduced by the amount withdrawn but never below the original 32 ETH deposit.

Validators are not required to request a partial withdrawal. If the validator is eligible for a partial withdrawal and its turn in the queue comes up, the CL will automatically process the withdrawal.

Full withdrawals and validator exit process

Full withdrawal is reclaiming the entire balance of an exited validator, including the initial 32 ETH deposit and any rewards earned while validating. This process requires the validator to exit first from Ethereum’s CL.

To execute a full withdrawal, the validator must signal its intent to exit by submitting a voluntary exit message. Validators must still perform their assigned duties until they are officially exited, which involves waiting in an exit queue.

Full withdrawal process and rate limits

To maintain network stability, the number of validators exiting is controlled by a churn limit. The length of time a validator must wait in the exit queue depends on this churn limit and the number of validators already in the queue.

After a validator is exited and a delay of 256 epochs (around 27.3 hours), the validator's status changes to "withdrawable." The validator will then undergo the same automated sweep as in partial withdrawals to complete the full withdrawal.

In summary, Ethereum's Shanghai/Capella upgrade is a significant milestone in Ethereum's development. It offers important enhancements to the network's staking mechanism, providing validators with more control over their staked ETH and enabling a smoother, more efficient withdrawal process.