The Ethereum ecosystem will continue its ongoing metamorphosis as the highly anticipated Shanghai upgrade draws near. The latest preeminent smart contract blockchain protocol improvement will activate Ether (ETH) withdrawals from Ethereum’s Beacon Chain.

The Merge marked a significant milestone for the Ethereum network in 2022, with the blockchain platform shifting from proof-of-work to proof-of-stake consensus. That change introduced validators as the new “miners” of the network, with staking ETH becoming a key component in maintaining the network.

While full validators were required to stake 32 ETH to process transactions and add new blocks to the network, the broader ecosystem could stake smaller amounts of ETH to earn a share of rewards — much like an investor that puts capital into interest-bearing accounts.

Those that locked up ETH to become validators have been unable to withdraw their staked holdings from the Beacon Chain. This changes with the Shanghai upgrade, and is a major reason for the increased fanfare around the latest change to the Ethereum network.

The Shanghai upgrade features a handful of Ethereum Improvement Proposals (EIPs) in addition to activating staking withdrawals. Cointelegraph reached out to members of the ConsenSys team, the Ethereum Foundation and analytics firm Nansen to unpack all aspects of the upcoming milestone.

Capella x Shanghai = Shapella

The upcoming changes feature two simultaneous upgrades amalgamated to encompass all facets of the upgrade.

Shanghai refers to changes to Ethereum’s execution layer, mainly enabling staked ETH to be deposited to execution layer wallets. The Shanghai upgrade requires a simultaneous change to the Beacon Chain, which has been dubbed Capella.

Justin Florentine, a staff protocol engineer for Hyperledger Besu at ConsenSys, further explained the combined upgrades at the execution and consensus layers:

“It is doubly named because it is the first simultaneous upgrade of Ethereum’s execution layer and consensus layer, and is highly anticipated because it will enable staked ETH withdrawals.”

Within the Ethereum ecosystem, execution layer upgrades are named after cities that have hosted Devcon events, while consensus layer upgrades are named after stars. Therefore the upcoming upgrade’s technical name is Shapella, combining Shanghai and Capella.

Nevertheless, given the focus on activating staked ETH withdrawals, the wider cryptocurrency ecosystem refers to the looming upgrade as Shanghai. As Beiko explained, Shanghai closes an important chapter in Ethereum’s evolution:

“It’s better to think of Shanghai as ‘finishing the Merge’ than related to future upgrades. We didn’t introduce withdrawals during the Merge because that upgrade was already the most complex in Ethereum’s history.”

Shanghai in a nutshell

As has been highlighted by several analysts and Ethereum developers, Shanghai features five EIPs. EIP-4895 will enable users to withdraw from the Ethereum staking contract, which had previously been locked.

Reward payments will be sent automatically to withdrawal addresses at regular intervals to validators. Users also have the option to exit staking entirely, which will return their entire validator balance.

Validator balances are maxed out at 32 ETH, meaning that balances above this threshold as a result of rewards do not contribute to the principal amount nor increase the weight of a validator on the network.

EIP-3651, EIP-3855, EIP-3860 and EIP-6049 are the other four elements of the network upgrade. Matt Nelson, Hyperledger Besu and Web3 senior product manager at ConsenSys, highlighted the impact of each of these EIPs.

The Ethereum protocol prices gas based on how many units of work a function will require of a computer in the network. Changes to Ethereum’s gas costs often adjust to correct overpriced or underpriced operations that have central processing units doing more or less work than anticipated. Warm coinbase (3651), PUSH0 (3855) and the initcode changes (3860) are part of these corrections, according to Nelson.

EIP-3651 changes the price of accessing the coinbase address of a validator that submits and executes transactions. Validators receive fees to their coinbase address for maintaining the network. As Nelson summarized, EIP-3651 looks to lower the gas cost of accessing a coinbase address so that users that submit transactions can pay the validators directly in specific conditions:

“Regardless, this EIP corrects a previous oversight on the cost to access the coinbase address and gives some added benefits to users and developers that open up new use cases.”

EIP-3860 will have a similar effect. Developers submit initcode to the network when deploying a new smart contract. When the initcode is executed, a smart contract “bytecode” is created on-chain, running each time the contract is called, and also runs decentralized applications (DApps).

Metering initcode intends to correct the gas cost required for network nodes to process and deploy the smart contracts specified in the initcode. Validating nodes currently check that contracts are valid on deployment, which costs time and gas to complete, which the initcode EIP aims to improve as Nelson explained:

“EIP-3860 applies a new cost to the initcode that scales in correlation to the size of the ‘initcode’ to ensure handling that contract creation is costed appropriately.”

Lastly, EIP-3855 carries out a “straightforward and simple change” to the Ethereum Virtual Machine (EVM) and gas costing. The current state of the EVM does not store a value of zero on the execution stack cheaply, with developers having to use the “expensive” PUSH1 operation to set a value to zero.

Nelson highlighted that gas costs are directly linked to storage space in this instance, meaning the EVM only needs 1 byte to store a single zero, while more than 1 byte is required to store a bigger number from the PUSH1 operation:

“This change creates a new PUSH0 opcode, which is cost for 1 byte of data storage (less than PUSH1), and will bring gas costs for developers (and ultimately users) down.”

Beiko also reiterated that Ethereum Virtual Machine object format EIPs initially included in the Shanghai upgrade have been removed from the event.

What to expect

The effect of the Shanghai upgrade on cryptocurrency markets and the value of ETH is another pertinent question that is perhaps more difficult to answer.

Michiel Milanovic, a DeFi market analyst at ConsenSys, weighed in on the anticipated effects that Shanghai will have in terms of market supply and value of ETH after the upgrade. Milanovic noted that validators are broadly categorized as short-term or long-term, with the current market split roughly 40/60 respectively, which allows for some simple predictions to be made:

“We see potential for an increase in the supply of ETH in circulation from long-term validators who are eager to withdraw their accumulated rewards.”

Milanovic also highlighted that the mechanics of withdrawals are engineered with a limit of 16 withdrawals per block and prioritizes short-term validators. The likely outcome is that any market impact from long-term validators will be gradual.

Meanwhile, short-term validators are mostly run by liquid staking providers (LSPs), which are more incentivized to use rewards to spin up new validators. Milanovic said this is mainly due to an expected increased demand once withdrawals are enabled, as it reduces the liquidity risk of staking ETH.

“We also expect to see more staked ETH tokens issued by these providers to be used across DeFi, which has so far been fairly limited.”

Andrew Thurman, an analyst at blockchain analytics platform Nansen, told Cointelegraph that the upgrade would have significant ramifications for supply flows and price of ETH, given that staking creates fundamental changes to Ethereum’s market structure:

“Some believe that a successful network upgrade will spur more deposits, which would lead to bullish market activity. Others, meanwhile, believe that large portions of the staked ETH supply — now in excess of 17.5 million ETH — will be withdrawn and sold.”

Simon Dudley, a ConsenSys senior blockchain protocol engineer, summed up a shift in focus for the Shanghai upgrade to prioritize validator withdrawals. This meant that the implementation of certain EIPs was shifted further down the timeline to limit risks of further delays to the upcoming upgrade: 

“For this reason, there was a strong desire among the core developers to prevent the Shanghai upgrade from becoming overly complicated.”

Several of these EIPs have been pushed back to the Cancun upgrade, which will follow Shanghai later in 2023. This includes improvements that will lay the foundation for sharding, namely “Proto-Danksharding” EIP-4844.

Dudley noted that Shanghai intentionally excluded foundational sharding work, but work on EIP-4844 has continued in parallel. He also concedes that the deployment of Shanghai may well influence the ongoing work on sharding in the months to come:

“Shipping the Shanghai upgrade may have an impact on sharding because it frees up developers who were working on Shanghai to focus on the more complicated series of sharding upgrades, known as ‘The Surge.‘”

The Shanghai upgrade is scheduled to take place on the Ethereum mainnet in early April. The original date was pushed out from March 2023, with the Goerli test network — which allows for development testing before mainnet deployments — carrying out the Shapella upgrade on March 14.