The Steel connects RISC Zero with Ethereum, embracing ZK, allowing developers to bypass Ethereum's gas fees and limitations.
Compiled by: Alex Liu, Foresight News
Ethereum has successfully brought about a thriving decentralized application ecosystem, but its scalability challenges are becoming increasingly severe. Developers are faced with a difficult choice: to limit the functionality and data richness of their applications, or to endure high gas fees and gas usage limitations. What if developers have a way to bypass these limitations?
Steel, Connecting RISC Zero and Ethereum
RISC Zero is one of the main developers of zkVM. If you often hear about zkEVM but don't understand the difference with zkVM, you can refer to this article. RISC Zero has recently launched Steel, which is based on the Alloy view call proof library, bringing a huge transformation to the way developers interact with Ethereum L1 or other EVM chains. By utilizing zero-knowledge proofs and RISC Zero zkVM, Steel enables developers to execute view calls in a scalable, secure, and economically efficient manner, and to read and compute the state of Ethereum in a provable way.
Convenience of Solidity, Power of ZK
Steel bridges the gap between Ethereum application development and zero-knowledge technology, making it easier for developers to harness the power of ZK in their smart contracts. By combining the capabilities of RISC Zero zkVM, Steel enables developers to build more secure, scalable, and efficient applications on Ethereum L1 or any equivalent EVM chain.
With Steel, developers can:
Execute Solidity smart contracts directly within zkVM, compatible with more complex on-chain logic
Access historical Ethereum states within zkVM
Use continuations for computation, unaffected by block and transaction data size limitations
Ensure off-chain computations are as secure and reliable as on-chain executions
Utilize the first production-ready zkVM rigorously tested and used by multiple partners
Perform private computations of Ethereum states
Maintain flexibility through open-source code repositories, free from vendor restrictions
Seamless Integration and Cost Savings
With Steel, executing view calls is as simple as specifying the required Solidity methods. Whether it's retrieving ERC-20 token balances (example) or accessing Ethereum states, Steel simplifies the process by seamlessly integrating with RISC Zero zkVM, while ensuring security and efficiency. Tests have shown that Steel is capable of handling over 100K SLOAD operations in a single view call, saving thousands of dollars in gas fees on the mainnet. Using Bonsai, we can prove this in about 15 minutes, which would require at least 210M gas, exceeding the block limit by 7 times.
Example: ERC20 balanceOf
The following code snippet demonstrates the process of proving the balance of a specific address deployed on Ethereum using Steel. This example shows how developers can interact with on-chain data within zkVM using Steel. The complete code can be viewed here.
Define the view function signature
First, use the sol! macro to define the balanceOf function signature for ERC-20. This will parse the Solidity syntax to generate the corresponding Rust struct, which implements the SolCall trait for calling the balanceOf method, which takes an account address and returns the associated ERC-20 token balance.
Prepare the call
Next, set up the call by instantiating the balanceOfCall struct with the target account address. Also, define constants for the contract address to be queried and the caller's address.
Execute the call in Main
The main function executes within zkVM, generating a zero-knowledge proof. It first reads the input environment, then constructs a ViewCallEnv object to ensure the current state matches the expected state root. After submitting the relevant block hash and number, it executes the view call and prints the balance.
How it Works
Steel proves Solidity code within RISC Zero zkVM through three steps, simplifying the execution process:
Pre-flight phase: Initiate pre-flight by making view calls to the Ethereum RPC node, caching necessary storage slots, and populating the EVM database with only the data required for the query. All storage slots are automatically discovered and fetched based on the view call execution.
Storage verification: Perform storage integrity checks to ensure that the data in the EVM database aligns with the blockchain's state root, confirming its legitimacy.
Solidity execution: Run the given Solidity function on the EVM within RISC Zero zkVM.
How is this different from storage proofs?
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 fetched based on the view call execution. This saves developers a significant amount of time, reduces the possibility of implementation errors, and decreases the chance of security vulnerabilities.
Obtaining Verified Block Hashes on-chain
When using the blockhash opcode in Ethereum smart contracts for verification, the commitment being verified must reference a block hash no more than 256 blocks old. Given an average block time of 12 seconds, this sets a narrow time window of about 50 minutes for proof generation and confirmation that the verification transaction has been included in a block.
When there is a need to obtain a verified block hash earlier than 256 blocks, one of the following strategies can be used:
When the required block hash is known in advance (e.g., when initiating a governance proposal), it can be saved to the contract state.
Another approach is to use RISC Zero to prove a hash chain from the queried block to one of the last 256 blocks.
The Future of On-chain Applications
Imagine a future where off-chain computations seamlessly integrate with on-chain verification. Steel enables developers to reliably access and compute the complete history of Ethereum within zkVM, paving the way for the creation of next-generation, data-rich, and more powerful on-chain applications, making a significant contribution to realizing this vision.
免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。