Translated by Alex Liu, Foresight News

Ethereum's success has led to a thriving decentralized application ecosystem, but its scalability challenges are becoming increasingly severe. Developers face a difficult choice: limit the functionality and data richness of their applications, or endure high gas fees and gas usage limits. What if developers had a way to bypass these restrictions?

Steel, connecting RISC Zero and Ethereum

RISC Zero is one of the main zkVM developers. If you often hear zkEVM but don't know what zkVM is, you can refer to this article. RISC Zero recently launched Steel, a view call proof library based on Alloy, which brings a huge change in the way developers interact with Ethereum L1 or other EVM chains. Using zero-knowledge proofs and RISC Zero zkVM, Steel enables developers to perform view calls and provably read and compute the state of Ethereum in a scalable, secure, and cost-effective way.

The convenience of Solidity, the power of ZK

Steel bridges the gap between Ethereum application development and zero-knowledge technology, making it easier for developers to leverage the power of ZK in their smart contracts. Combined with the power of RISC Zero zkVM, Steel enables developers to build more secure, scalable, and efficient applications on Ethereum L1 or any EVM equivalent chain.

With Steel, developers can:

  • Execute Solidity smart contracts directly in zkVM, compatible with more complex on-chain logic

  • Access historical Ethereum state within zkVM

  • Use continuations for computation without being limited by block and transaction data size

  • Ensure that off-chain computing is as secure and reliable as on-chain execution

  • Leverage the first production-ready zkVM that has been rigorously tested and used by multiple partners

  • Private Computation of Ethereum State

  • Maintain flexibility and freedom from vendor lock-in through an open source code base

Seamless integration and cost savings

With Steel, executing a view call is as simple as specifying the desired Solidity method. Whether it is retrieving ERC-20 token balances (example) or accessing aspects such as Ethereum state, Steel simplifies the process by seamlessly integrating with RISC Zero zkVM while ensuring security and efficiency. Testing has shown that Steel is capable of handling over 100K SLOAD operations in a single view call, which saves thousands of dollars in gas fees on the mainnet. We can prove it in about 15 minutes using Bonsai, which requires at least 210M of gas, 7 times more than the block limit.

Example: ERC20 balanceOf

The following code snippet demonstrates the process of using Steel to prove the balance of a specific address of an ERC-20 contract deployed on Ethereum. This example shows how developers can use Steel to interact with Ethereum on-chain data within the zkVM. The full code can be viewed here.

Define the view function signature

First, use the sol! macro to define the ERC-20 balanceOf function signature. This will parse the Solidity syntax to generate a corresponding Rust structure that implements the SolCall trait and can be used to call the balanceOf method, which accepts an account address and returns the associated ERC-20 token balance.

Prepare to call

Next, we set up the call by instantiating the balanceOfCall structure with the target account address. We also define constants for the contract address we wish to query and the address of the caller.

Execute the call in Main

The main function is executed in zkVM and generates a zero-knowledge proof. It first reads the input environment, then constructs a ViewCallEnv object, ensuring that the current state matches the expected state root. After submitting the relevant block hash and number, the view call is executed and the balance is printed.

How it works

Steel simplifies the process of proving Solidity code in RISC Zero zkVM in three steps:

  1. Pre-flight phase: Pre-flight is initiated by making a view call to the Ethereum RPC node, which caches the necessary storage slots and populates the EVM database with only the data required for the query. All storage slots are automatically discovered and acquired based on the view call execution.

  2. Storage Verification: Performs storage integrity checks to ensure that the data in the EVM database is aligned with the state root of the blockchain, thereby confirming its legitimacy.

  3. Solidity execution: Runs a given Solidity function on the EVM within the RISC Zero zkVM.

How is this different from Proof of Storage?

With traditional storage proofs, developers must manually select the storage slots used by their smart contracts and re-implement the smart contract logic. With Steel, all storage slots are automatically discovered and acquired based on the view call execution. This saves developers a lot of time and reduces the possibility of implementation errors, thereby reducing the chance of security vulnerabilities.

Get the verified block hash

When using the blockhash opcode for verification in an Ethereum smart contract, the commitment being verified must reference a block hash no older than 256 blocks. Given the average block time of 12 seconds, this sets a narrow time frame of about 50 minutes to complete proof generation and confirm that a transaction has been included in a block.

When you need to get a verified block hash on-chain that is older than 256 blocks, you can use one of the following strategies:

  • When the block hash that will be needed is known in advance (for example, when making a governance proposal), the block hash can be saved into the contract state.

  • Another approach is to use RISC Zero to prove a hash chain from the queried block to one of the most recent 256 blocks.

The future of on-chain applications

We envision a future where off-chain computation is seamlessly integrated with on-chain validation. Steel contributes significantly to this vision by enabling developers to reliably access and compute Ethereum’s full history within the zkVM, enabling the creation of the next generation of data-rich and more powerful on-chain applications.