Ethereum’s Shanghai upgrade is proposed for mid-march 2023. Shanghai EIPs are now finalized. Activating Withdrawals, i.e., EIP-4895, is the main priority of the upgrade. But, it also includes a few protocol improvement EIPs like EIP-3651. Created on 12th July 2021 by William Morriss, this EIP proposes to access
COINBASE at lower gas cost, that will be helpful for smart contract users. In this article, we will get a complete overview of EIP-3651 and why it is crucial in Shanghai Upgrade.
Table of Contents
- Warm COINBASE (EIP-3651)
- Earlier Efforts of Gas Cost Reduction
- When Expected on Mainnet?
Warm COINBASE (EIP-3651)
EIP-3651 makes the
COINBASE warm. Previously, Accessing
COINBASE is overpriced because the address is initially cold under the access list framework introduced in EIP-2929.
- Also, the present design incentivizes signing parallel transactions per possible COINBASE to save gas fees. The currently initialized warm addresses are already loaded at the start of transaction validation. For Example;
ORIGINaddress is always loaded to check its balance against the gas limit and the gas price.
tx.toaddress is always loaded to begin execution.
COINBASEaddress should always be loaded because it receives the block reward and the transaction fees.
So, the first time we access accounts, it will cost 2600 gas, and for account storage, it will cost 2100 gas. However, if the state already accessed is now "warm", it can be reaccessed cheaply, i.e., around 100 gas. This will save around 2500 gas in case of account access.
Client Implementation & Testing Status
Developers have already tested EIP-3651 on Shandong Testnet. It was a Pure JS-based testnet, i.e., running on a set of Lodestar (CL) and EthereumJS (EL) client boot nodes. This EIP will be also tested on multiple Shanghai Devnets, Public Testnets, and Shanghai Shadow Forks in the coming weeks.
EIP-3651 is successfully implemented in all Execution Layer and Consensus Layer Clients.
Earlier Efforts of Gas Cost Reduction
In this section, we will discuss EIPs related to warm
COINBASE and how they have contributed in gas cost reduction.
EIP-2929 added State access lists to the gas computation of a transaction. So, if the transaction accesses more states, it will cost more and gas fees will be increased.
Previously, all accesses would cost the same whether you accessed it or not.
This EIP also defined that a few accesses would be warm from the start, i.e., they're accessed already at the start of the transaction. For example, "from" (ORIGIN), "to", and precompiles are warm by default.
Developers can now specify and access what they anticipate and assume that if it happens, that will save gas fees. Also, if it doesn't happen, that will waste gas. So, developers should only use this for accesses they believe with 90% confidence.
This is done to encourage transactions to use the access list as much as possible. Also, processing transactions is easier when their storage reads are predictable because clients can pre-load the data from databases and ask for witnesses when the transaction is received or at least load the data in parallel.
It also has a JSON RPC method, i.e.,
eth_createAccessList, that facilitates the creation of these access lists.
- Terminologies Used
- base fee = value set by the protocol
- priority fee = value the user sets as a tip to the validator.
Alice can also set a max fee (maxFeePerGas) for the transaction. The difference between the max and actual fees is refunded to Alice, i.e., refund = max fee - (base fee + priority fee).
Users can now set the max fee to the base fee and the priority fee to zero. In addition, users can now pay the miners conditionally by using the
COINBASEopcode to get their address and send them Ether.
This allows users to pay transaction fees only when the transaction succeeds. This method is popular in systems like Flashbots as it receives many direct payments.
When Expected on Mainnet?
Developers are expecting Shanghai Hard Fork in Mid March 2023. EIP-3651 is one of the EIPs included in Shanghai Upgrade with Withdrawals.
- TWAMM: Time-Weighted Average Market Maker
- MobyMask: An Initiative to Eliminate Phishers
- Fractional NFTs: EIP-4675 using EIP-1155 & EIP-1633
- Transient Storage for Beginners: EIP-1153 Explained
- How Layer 3 in Future will look like?
- An Overview of Beacon Chain API
Disclaimer: The information contained on this web page is for education purposes only. Readers are suggested to conduct their own research, review, analyze and verify the content before relying on them.
To publish press releases, project updates and guest posts with us, please email at email@example.com.
Subscribe to EtherWorld YouTube channel for ELI5 content.
Support us at Gitcoin
You've something to share with the blockchain community, join us on Discord!