Is Ethereum moving to China, as the name of the upgrade might suggest? Not exactly so. Shanghai might be considered one of the world’s financial capitals; however, Ethereum is not taking its decentralized web of finance there.
In simple terms, the Shanghai/Capella upgrade intends to enable staked ETH withdrawal from the Ethereum Beacon Chain. Flashback to December 2020, the Ethereum Foundation created a deposit wallet in preparation for the Merge. This wallet was to hold staked ETH that would be used to secure the network post-Merge. It has been 27 months, and the time has come to give stakers back control over their staked ETH. This process is not exactly simple, as we will see later in this piece.
Let’s start with understanding how we got here and why staking withdrawals were not enabled when Ethereum moved from proof-of-work to proof-of-stake. The transition of Ethereum from PoW to PoS happened over multiple steps to minimize the number of significant changes happening simultaneously. This approach was essential, especially for an established network settling trillions of dollars of value yearly. Risks were to be mitigated by employing a gradual transition process. The most significant steps were:
- The Launch of the Beacon Chain
- The Merge
The launch of the Beacon Chain happened in December 2020. It laid the foundation for the PoW-PoS transition by creating a separate PoS consensus layer running alongside the Ethereum PoW chain. Launching the Beacon Chain before the Merge allowed for the accumulation of enough ETH to secure the network before real-value transactions could be settled. It also allowed testing of the new PoS consensus model for an extended period with real funds at stake. Interested network participants committed millions of ETH to secure the Ethereum PoS network despite not knowing if or when they would be able to withdraw their ETH until much later. Many of these folks were Ethereum maxis who believed in the network’s long-term viability.
The next big step, the Merge, united the PoS consensus layer with the execution layer at a predetermined total terminal difficulty (TTD), which coincided with block 15537393. This allowed the network to finally move off PoW to maintain only one canonical chain – Ethereum – now secured by millions of staked ETH instead of the computational power of mining rigs.
The Merge was by far the most significant change ever to Ethereum. Due to the nature of the upgrade, it had to happen without any downtime. To minimize risk, the scope of The Merge was reduced, and no other features, outside of the PoW to PoS switch, were included as part of the upgrade. It was agreed that every other feature would be shipped later, progressively. The biggest feature that had to be omitted impacted withdrawals, which have become the focus of the upcoming Shanghai/Capella upgrade.
The “Shapella” upgrade is expected to take place on April 12th, 2023. At this time, the Beacon Chain has accumulated over 17M ETH across over 530k validators. An average balance for a validator is just above 34 ETH, which means over 1 million ETH in accrued rewards. It will be interesting to see how withdrawals will affect these numbers and, subsequently, the price of ETH.
In simple terms, the Shanghai/Capella upgrade will enable staking withdrawals on Ethereum. Staking withdrawals, as the name suggests, allow stakers to withdraw their locked-up ETH. However, there are two types of withdrawals
- “partial” and
Currently, validators on Ethereum earn “revenue” on their staked ETH in base block rewards and transaction fees. This “revenue” accumulates on top of their staked ETH. A “partial” withdrawal happens when a validator withdraws these accrued rewards—the extra balance on top of the minimum effective balance of 32 ETH. A “partial” withdrawal can also be referred to as a “reward payment” or “excess balance payment.” In contrast, a “full” withdrawal happens when the validator has completed the process of exiting, and the entire balance is withdrawn, including staked ETH and all accumulated rewards. This occurs only when the validator exits the system voluntarily or forcibly removed in a process called “slashing.” Once enabled, staking withdrawals will be automatically distributed every few days. Additionally, the withdrawal process initiates on the consensus layer, so no transaction fee is required at any of the steps.
To start withdrawing their staking rewards, validators will have to provide their withdrawal address only once. Given withdrawals affect both the consensus and execution layers of Ethereum, both parts of the network must be updated. Shanghai is the name of the execution layer upgrade containing withdrawals, which are specified in EIP-4895, and Capella is the name of the counterpart consensus layer upgrade, which will be activated at the same time. These two upgrades are sometimes also referred to as Shapella.
A little dive into the technicalities of this upgrade unveils a not-so-simple exercise. In the Ethereum ecosystem, each validator has a corresponding index number. In addition, they also have two types of withdrawal credentials defined as either 0x00 or 0x01. 0x00 indicates that a particular validator doesn’t have an associated withdrawal address. These credentials are derived as the hash of the BLS public key with its first byte swapped out with a zero byte hence the name. In contrast, 0x01 means that a validator provided their withdrawal address. These withdrawal credentials are represented as 0x01 followed by 11 bytes of zeros, then a chosen Ethereum address. To enable withdrawals, validators with 0x00 credentials must sign a “BLSToExecutionChange” message. This will be possible after the Capella upgrade. Once withdrawals are enabled, a validator proposing a block will scan linearly through the validator indices to find the first 16 validators with 0x01 credentials who either:
- have a balance that exceeds 32 ETH (accrued validator rewards)
- are “withdrawable” (have fully exited validator set)
The linear search stops after either finding 16 validators to match these criteria or after 16,384 iterations. The algorithm remembers the index at which the search stopped, so the next validator proposing a block can resume from that index. After getting to the last index, the algorithm starts from the beginning – index 0. A good analogy here would be an analog clock where the hand on the clock points to the hour, progresses in one direction, does not skip any hours, and eventually wraps around to the beginning again after the last number is reached. After the scan is completed, the validator creates a list of withdrawals to be included in their execution payload. Each item on the list contains the following: “WithdrawalIndex” – a monotonically increasing index, starting from 0, that increments by 1 per withdrawal to identify each withdrawal “ValidatorIndex uniquely” – the index of the validator whose balance is being withdrawn “ExecutionAddress” – the ETH address on the execution layer where the withdrawal should be sent “Amount” – the amount, in gwei, to be sent to “ExecutionAddress.” When building or processing a block, Execution Layer clients will apply these withdrawals at the end of a block. As mentioned earlier, processing withdrawals do not compete with user transactions for block space. With a maximum of 16 withdrawals that can be processed in a single block, there should be a maximum of 115,200 withdrawals processed per day (assuming no missed slots). As we can see, the design of withdrawals is simple yet extremely robust.
As is always the case with network changes on Ethereum, several misconceptions have risen, with many at risk of being misled. The first misconception states that, when processing withdrawals, there is a difference between a “full” and a “partial” withdrawal in terms of priority or ordering. Both “full” and “partial” withdrawals happen when the linear scan over the validator set reaches a validator’s index. The only difference is that in the case of “full withdrawals,” a validator must leave the exit queue and reach the “withdrawable_epoch” before the linear scan can pick it up.
Another misconception is that users will lose their rewards if they do not provide a withdrawal address which is not true. If a validator forgets to provide a withdrawal address, their ETH rewards will not be sent to the void once withdrawals are enabled. Instead, the scan will skip validators who haven’t provided their withdrawal addresses. Also, it’s important to remember that the withdrawal address cannot be changed, and it’s set only once. Therefore, stakers must be extremely careful when setting up the withdrawal address, ensuring they fully own the address provided.
Also, there has been lots of speculation regarding the impact of these enabled withdrawals. One worth mentioning is the assumption that stakers will withdraw a lot of ETH from the Ethereum ecosystem once the withdrawals are enabled. The stronger version of this argument also assumes that this will destabilize the PoS consensus mechanism. Although we cannot fully predict how much ETH will be withdrawn over time, there are a few important counterarguments. First, most stakers are early Ethereum adopters who were brave enough to stake when it was still uncertain when the withdrawals would be enabled. Many stakers have expressed their desire to continue staking to support the network and to continue earning ETH-denominated rewards. Secondly, to ensure that the PoS consensus mechanism and the active set of validators remain stable, Ethereum implemented a withdrawal queue for all validators wishing to exit. This queue limits the number of validators that can leave the ecosystem simultaneously. It is worth mentioning that the first withdrawal scan will withdraw a lot of accumulated rewards – basically since the inception of the Beacon Chain. Still, the subsequent ones will process a much smaller amount of ETH as fewer people can or even want to get their ETH out.
In the fortunate turn of events, the Shanghai/Capella Upgrade will strengthen ETH’s position as the blueprint for staking protocols. The yield that Ethereum pays following Shanghai – a matter of network liquidity and transaction volumes – will emerge as a kind of “base yield” for crypto. Something similar to “risk-free” yields on government bonds. Newer and existing staking protocols will have to compete with Ethereum’s yield mechanism, likely making the asset class more secure, reliable, and predictable – and less risky. We will go into the details of the potential implications of the upcoming upgrade in a follow-up article. Stay tuned.
Interested in marketing your blockchain/Web3 project? Please contact Off-Chain Communications for a free consultation and quote.
If you enjoyed this article, you may also enjoy…
Check out the home page of Exploring Digital Assets for additional insights, reports and news!