Introducing Steel

Introducing Steel: A Hardened Alloy, Connecting RISC Zero to Ethereum

Ethereum’s success has led to a thriving ecosystem of decentralized applications, but scalability challenges have become increasingly apparent. Developers are left with a difficult choice: limit the functionality and data richness of their applications or bear the burden of excessive gas fees or gas limits. What if there was a way for developers to bypass these limitations?

Steel, the Alloy-based view call proof library by RISC Zero, represents a huge shift in how developers interact with Ethereum L1 or EVM-based chains. By harnessing the power of zero-knowledge proofs and the RISC Zero zkVM, Steel enables developers to execute view calls and provably read and compute over Ethereum’s state in a scalable, secure, and economically efficient manner.

Solidity’s Convenience, with the power of ZK.

Steel bridges the gap between Ethereum’s app development and zero-knowledge technology, making it easier than ever for developers to harness the power of ZK in their smart contracts. Combined with the capabilities of the 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 gain the ability to:

  • Execute Solidity smart contracts directly within the zkVM for more sophisticated on-chain logic
  • Access historical Ethereum State inside the zkVM
  • Compute without block and transactions size limitations using continuations
  • Ensure secure and reliable off-chain computations, as if they were executed on-chain
  • Utilize the first production-ready zkVM, rigorously tested and used by various partners
  • Private computation over Ethereum state
  • Maintain flexibility with an open-source codebase, with no vendor lock-in

Seamless Integration and Cost Savings

With Steel, executing a view call is as simple as specifying the desired Solidity methods. Whether retrieving an ERC-20 token balance (example) or accessing any aspect of Ethereum's state, Steel simplifies the process while ensuring security and efficiency through seamless integration with the RISC Zero zkVM. Our tests have shown Steel's ability to handle over 100K SLOAD operations in a single view call, potentially saving thousands of dollars in gas fees on mainnet. We can prove this in about 15 minutes using Bonsai. This would take at least 210M gas, exceeding the block limit by 7x.

Example: ERC20 balanceOf

In the code snippets below, we demonstrate the process of proving the balance of a specific address for a deployed ERC-20 contract on Ethereum using Steel. This example showcases how developers can utilize Steel to interact with on-chain Ethereum data within the confines of a zkVM. You can find the full code here.

Defining the View Function Signature

Start by defining the ERC-20 balanceOf function signature using the sol! macro. This will parse Solidity syntax to generate a corresponding Rust struct, which implements the SolCall trait. This struct can be used to call the balanceOf method, which takes an account address and returns the associated ERC-20 token balance.

Preparing the Call

Next, set up the call by instantiating the balanceOfCall struct with the target account address. Also, define constants for the address of the contract you wish to query and the caller's address.

Executing the Call in Main

The main function is executed in the zkVM, producing a zero-knowledge proof. It starts by reading the input environment, then constructs a ViewCallEnv object, ensuring the current state matches the expected state root. After committing to 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 execution in the RISC Zero zkVM in three simple steps:

  1. Pre-flight Phase: Initiate a pre-flight by making a view call to the Ethereum RPC node. This caches the necessary storage slots, populating the EVM database with only the data required for the query. All storage slots are discovered and fetched automatically based on the view call execution.
  2. Storage Verification: Conduct a storage integrity check, ensuring that the data in the EVM database aligns with the state root of the blockchain, thereby confirming its legitimacy.
  3. Solidity Execution: Run the given Solidity function on the EVM, inside the RISC Zero zkVM.

How is this different from storage proofs?

With traditional storage proofs, developers must manually select which storage slots their smart contract uses, and re-implement smart contract logic. With steel, all storage slots are discovered and fetched automatically based on the view call execution. This saves developers a significant amount of time and decreases the room of implementation errors, reducing the chance of security vulnerabilities.

Getting the verified block hash

When using the blockhash opcode for validation in Ethereum smart contracts the commitment for validation must reference a blockhash no more than 256 blocks old. Given an average block time of 12 seconds, this sets a narrow time frame of approximately 50 minutes to complete the proof generation and confirm the inclusion of the validating transaction within a block.

When a verified block hash older than 256 blocks is needed on-chain, a number of strategies can be used:

  • When the block hash that will be needed is known ahead of time (e.g. when initiating a proposal for governance), that block hash can be saved to contract state.
  • Another approach is to use RISC Zero to prove the hash chain from the block that was queried up until a block in the most recent 256.

The Future of On-chain Apps

We envision a future where there is a seamless integration of off-chain computation with on-chain validation. Steel is our contribution to making this vision a reality, by enabling developers to provably access and compute over the full history of Ethereum inside the zkVM to create the next wave of data-rich and more functional on-chain applications.

Get Started with Steel

Steel is a key component of RISC Zero’s commitment to launching zkVM 1.0, a milestone towards cheap, secure on-chain proof verification and universal zero-knowledge proofs. Get started with Steel today by visiting our GitHub repo for documentation, code examples, and resources to help you integrate Steel into your project.

Steel Github

Foundry Template

In other news: