Verifying Ethereum Predeploy Contracts

Verifying Ethereum Predeploy Contracts

Contract verification is a vital service block explorers provide to blockchains. Through the verification process, the underlying code becomes human-readable, enabling anyone to check contract code and interact with the read and write methods within the contract. 

Typically, smart contracts are deployed to a blockchain by an external user at any time and assigned an 0x address during deployment. Often, developer tools like hardhat or remix allow for instant verification through explorer APIs, or the address that deployed the contract can complete the verification steps through the explorer UI. 

However, contracts work fine onchain without verification, and many deployers never verify their contracts or verify them on some explorers but not others. This results in a lack of transparency, potential security issues (if people can’t read the code easily, they can’t identify security problems), and inaccessibility.

While external smart contracts are deployed by addresses at any time to create new onchain functionality, a subset of contracts are deployed with set addresses during Ethereum upgrades themselves. Predeploy (or system) contracts are added during hard forks to enable various EIPs (Ethereum Improvement Proposals) and implement core functionalities within the Ethereum Virtual Machine.

Pectra Predeploys

Several important predeploys were added during the recent Pectra HF. While developers could typically verify contracts in the explorer, these system contracts were written in a language called GEAS, which is not currently supported for verification purposes. 

GEAS (Good Ethereum Assembler) is an assembly language which supports all EVM instructions, and is designed and optimized for low-level EVM interaction. Blockscout supports verification for Solidity, Vyper and Yul contract development languages, but GEAS is not a common language for eternal contract developers.

Because the contracts couldn’t be easily verified, they were not human-readable, and users could not check read or write functions. The contracts in question included one deployed during the Dencun upgrade (BeaconRoots) and three deployed as part of Pectra.

Name

Related EIP

Predeploy Contract Address

BeaconRoots

4788

0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02

HistoryStorage

2935

0x0000F90827F1C53a10cb7A02335B175320002935

WithdrawalRequest

7002

0x00000961Ef480Eb55e80D19ad83579A64c007002

ConsolidationRequest

7251

0x0000BBdDc7CE488642fb579F8B00f3a590007251

Contract Purposes

  • BeaconRoots: Gives the execution layer access to consensus layer (Beacon chain) state and data.
  • HistoryStorage: Stores historical block hashes (8192 blocks) for fast, stateless querying of recent blocks.
  • WithdrawalRequest: Beacon chain validators can initiate withdrawals and exits via the execution layer. 
  • ConsolidationRequest: Validators running many nodes can consolidate into fewer nodes with larger balances (up to 2048 ETH per validator).

Blockscout Verification

We felt it was important to show the code for these predeploys and expose the underlying methods, but not necessary to support GEAS in the Blockscout UI or verifier considering its limited usage. 

In order to provide contract transparency and process the verification, we leveraged our Ethereum Bytecode DB. This database compiles and stores deployed bytecode from a variety of contexts and chains, then uses the stored bytecode to verify newly deployed contracts across chains (contracts can be verified when the bytecode already exists in the DB). 

In this case, we hardcoded the corresponding bytecodes for the predeploy contracts, including their sources and relevant metadata, directly into the DB. We also updated the Blockscout UI to show that these contracts are written in GEAS and allow for filtering by GEAS specific contracts. 

Once deployed, the contract page simply needed to be accessed once via the Blockscout UI to complete the verification. On the first visit, the UI sends a check to the DB to see if the bytecode exists there, and if it does, populates the corresponding contract information and confirms the contract is verified.

Once verified, the contract information and methods are transparent and accessible. Now, it is possible to read contract data and even initiate a withdrawal or consolidation request directly from Blockscout if desired.

Conclusion

The Pectra HF introduced many new features and enhanced functionality to Ethereum. Blockscout is helping bring additional context and usability to these features by providing GEAS predeploy contract verification. 

At Blockscout, we are committed to providing open-source access to contracts across Ethereum and the associated L2 and L3 rollup ecosystem. Through our Ethereum Bytecode Database and our participation in the Verifier Alliance, which now includes more than 8 million contracts, we will continue providing contract accessibility and transparency for all blockchain users.

Associated PRs