With The Shanghai/Capella upgrade rapidly approaching, there is a lot of discussion
about Ethereum Staking Withdrawals and what this means for the Ethereum ecosystem as a whole.
So how do withdrawals work? What are common misconceptions about this process? And what
are the implications of enabling Ethereum stakers to withdraw their
locked-up ETH? You’ll find answers to these questions and more in this video.
Before we begin, if you want to learn more about decentralised finance and the technology behind
it, make sure you subscribe to my channel, hit the bell icon and enable all notifications.
Let’s start with understanding how we got here and why staking withdrawals
weren’t enabled when Ethereum moved from proof-of-work to proof-of-stake.
The transition to PoS happened over multiple steps to minimise the number
of big changes happening at the same time. This approach was essential,
especially for an established network settling trillions of dollars of value per year.
The most significant steps were: -the launch of the Beacon Chain
-the Merge
The launch of the Beacon Chain in 2020 created the foundation for the transition
by creating a separate PoS consensus layer, running alongside the Ethereum PoW chain.
Launching the Beacon Chain earlier allowed for the accumulation of enough ETH to secure the
network before settling real-value transactions. It also allowed the
testing of the new PoS consensus model for an extended period with real funds at stake.
The early network participants committed millions of ETH to secure the Ethereum
PoS network despite knowing they wouldn’t be able to withdraw their ETH until much later.
The next big step, the Merge, united the PoS consensus layer with the execution
layer. This allowed for finally moving off PoW and maintaining
only one canonical chain - Ethereum - now secured by millions of staked ETH.
The Merge was by far the largest change ever to Ethereum. Due to the nature of the upgrade,
It had to happen without any downtime.
To minimise 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.
The biggest “cut” that had to be done impacted withdrawals,
which became the focus of the upcoming Shanghai/Capella upgrade.
Staking withdrawals, as the name suggests, will allow stakers to withdraw their locked-up ETH.
Before we get any further, let’s define two types of withdrawals: “partial” and “full”.
A “partial” withdrawal happens when the validator withdraws their accumulated
rewards. This is an extra balance on top of the maximum 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. This occurs only when the validator
exits the system either voluntarily or by being forcibly removed in a process called “slashing”.
Once enabled, staking withdrawals will be automatically distributed every few
days. We’ll explain the details of this process later in the video.
Additionally, the withdrawal process initiates on the consensus layer,
so no transaction fee is required at any of the steps.
In order to start withdrawing their staking rewards,
a validator 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.
Now, let’s see how withdrawals work under the hood.
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.
In order to enable withdrawals, validators with 0x00 credentials will need to 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 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 analogue clock where the hand on
the clock points to the hour, progresses in one direction, doesn’t 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 uniquely identify each withdrawal
“ValidatorIndex” - 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.
Now, it’s time to discuss some common misconceptions when it comes to withdrawals.
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. In case 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 have full ownership of the address provided.
There is also a lot of speculation when it comes to 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 destabilise 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’s 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.
There are also some important implications when it comes to withdrawals.
First, enabling withdrawals will create an open, two-sided staking flow.
Currently, the staking flow is one-sided; ETH can only flow into the network and never exit it.
Interestingly, enabling withdrawals may incentivise even more people to stake as
they will know they can always withdraw their ETH if needed for something else.
Stakers who don’t run their validators and stake with a centralised staking provider
will be able to change their provider to a different one. So, for example,
they can withdraw their funds from a provider that offers a lower staking
rate to another provider which offers a better rate or move from a centralised
provider to a decentralised one, or even run their own validator!
Withdrawals will also impact liquid staking derivatives such as Lido, RocketPool and others.
For example, liquid staking coins such as stETH or rETH had a history of temporarily losing their peg
to the price of ETH during market turbulences. However, with the two-sided staking flow,
any significant discrepancy in their peg would be quickly arbitraged away.
Early adopters in liquid staking and centralised staking captured a vast majority of the market as
they didn’t have much competition. However, the market share of these incumbent players could
see a major change once withdrawals are enabled, especially if they don’t offer a competitive rate.
The ability to shift freely between staking providers will benefit the ETH staking market.
Enabling staking withdrawals is one of the most anticipated upgrades to Ethereum.
It will be extremely important to make sure this change is executed smoothly. In order to
help with testing, validators will have several devnets and testnets available to run through
the process and iron out any potential issues before going live on the mainnet.
Withdrawals are yet another improvement bringing Ethereum one step further
towards building a sustainable, secure and decentralised future.
Shapella upgrade is expected to take place in the first half of 2023.
At the time of this video, The Beacon Chain accumulated over 17M ETH across over 530k
validators. An average balance for a validator is just above 34 ETH, which means over 1m ETH in
accumulated rewards. It will be interesting to see how withdrawals will affect these numbers.
So what do you think about Ethereum enabling staking withdrawals? Comment down below.
And as always, if you enjoyed this video, smash the like button, subscribe to my
channel and check out Finematics on Patreon to join our DeFi community.
Thanks for watching!