Cointime

Download App
iOS & Android

RISC Zero Steel 如何推动 zkVM 的广泛采用?

Validated Media

原文标题:《Introducing Steel

编译:Chris,Techub News

Steel,连接 RISC Zero 和以太坊

以太坊网络的成功推动了 DApp 生态的蓬勃发展,但随之而来的是越来越严峻的可扩展性挑战。开发者们面临一个两难境地:要么限制应用程序的功能和数据丰富性,要么忍受高昂的 Gas 费和其使用限制。那么,如果开发者能够找到绕过这些限制的方法,将会怎样呢?

RISC Zero 是 zkVM 开发者之一。你可能经常听说 zkEVM,但对它的衍生概念 zkVM 还不太熟悉。RISC Zero 最近推出了一项名为 Steel 的新技术,这是一种基于 Alloy 的视图调用证明库,它将彻底改变开发者与以太坊 L1 或其他 EVM 兼容链的交互方式。通过利用零知识证明和 RISC Zero 的 zkVM 技术,Steel 为开发者提供了一个可扩展、安全且成本效益高的方法,使他们能够执行视图调用并验证地读取及计算以太坊状态。

Solidity 的便利,借助 ZK 的力量

Steel 架起了以太坊应用开发与零知识证明技术之间的桥梁,极大地便利了开发者在智能合约中应用零知识证明(ZK)技术的过程。通过整合 RISC Zero 的 zkVM 功能,Steel 为开发者在以太坊 L1 或任何 EVM 兼容链上打造更安全、可扩展且效率更高的应用提供了工具。

使用 Steel,开发者能够在以下方面获得显著提升:

  1. 直接执行复杂链上逻辑:在 zkVM 上直接执行 Solidity 智能合约,以支持更复杂的链上逻辑。
  1. 访问历史状态:在 zkVM 中访问历史以太坊状态,为数据分析和验证提供更广泛的资源。
  1. 突破计算限制:使用 continuations 进行计算,不受区块大小或交易数据大小的限制。
  1. 确保链下计算的安全性:保证链下计算的安全性与链上执行同等可靠。
  1. 经验证的 zkVM:利用第一个经多个合作伙伴严格测试并用于生产环境的 zkVM。
  1. 私有计算:进行以太坊状态的私有计算,增强数据保护。
  1. 开源灵活性:通过开源代码库实现,确保灵活性,摆脱供应商限制。

Steel 的引入为开发者在现有区块链技术中融入先进的零知识证明技术提供了有力工具,推动了区块链应用开发的进一步革新。

无缝集成并节省成本

使用 Steel,执行视图调用像指定所需的 Solidity 方法一样简单。无论是检索 ERC-20 代币余额 (example) 还是访问以太坊状态等各个方面,Steel 都可以通过与 RISC Zero zkVM 无缝集成来简化流程,同时确保安全性和效率。测试表明,Steel 有能力在单个视图调用中处理超过 100K SLOAD 操作,这节省了主网上数千美元的 Gas 费用。我们可以使用 Bonsai 在大约 15 分钟内证明它,这至少需要 210M 的 Gas,超出区块限制 7 倍。

示例:ERC20 balanceOf

下面的代码片段演示了使用 Steel 证明以太坊上部署的 ERC-20 合约的特定地址余额的过程。此示例展示了开发人员如何利用 Steel 在 zkVM 内与以太坊链上数据进行交互。完整代码可在此处查看。

定义视图函数签名

首先,使用 sol! 宏来定义 ERC-20 的 balanceOf 函数签名。这将解析 Solidity 语法以生成相应的 Rust 结构体,该结构体实现了 SolCall trait,可用于调用 balanceOf 方法,该方法接受一个账户地址并返回关联的 ERC-20 代币余额。

准备调用

接下来,通过用目标账户地址实例化 balanceOfCall 结构体来设置调用。同时,为希望查询的合约地址和调用者的地址定义常量。

在 Main 中执行调用

主函数在 zkVM 中执行,生成零知识证明。它首先读取输入环境,然后构造一个 ViewCallEnv 对象,确保当前状态与预期的状态根匹配。在提交相关区块哈希和编号后,执行视图调用,并打印余额。

原理

Steel 简化了在 RISC Zero zkVM 中执行 Solidity 代码的流程,通过三个清晰的步骤来实现代码的证明:

  1. 预飞行阶段:这一阶段通过向以太坊的RPC节点发起视图调用来启动,此过程会缓存所需的存储槽,并根据查询需求填充EVM数据库。所有的存储槽都是通过视图调用的执行过程自动发现和获取的。
  1. 存储验证:此步骤涉及对存储完整性的检查,确保EVM数据库中的数据与区块链的状态根一致,从而验证数据的合法性。
  1. Solidity执行:在 RISC Zero zkVM 内部的EVM上执行指定的Solidity函数,确保代码按预期运行。

通过这三个步骤,Steel 在 RISC Zero zkVM 中提供了一个高效且可靠的方法来证明并执行 Solidity 代码,极大地简化了整个过程。

这与存储证明有何不同?

使用传统的存储证明,开发人员必须手动选择其智能合约使用的存储槽,并重新实现智能合约逻辑。而使用 Steel,所有存储槽都会根据视图调用执行自动发现和获取。这为开发人员节省了大量时间,减少了实施错误的可能性,从而减少了出现安全漏洞的机会。

获取已验证的区块哈希

在以太坊智能合约中使用 blockhash 操作码进行验证时,验证的 commitment 必须引用不超过 256 个区块旧的区块哈希。考虑到平均区块时间为 12 秒,这就设置了一个约为 50 分钟的狭窄时间范围,用于完成证明生成并确认验证交易已包含在一个区块中。

当需要在链上获取一个早于 256 个区块的已验证的区块哈希时,可以使用以下几种策略之一:

  • 当预先知道将需要的区块哈希时(例如,在发起治理提案时),可以将该区块哈希保存到合约状态中。
  • 另一种方法是使用 RISC Zero 来证明从查询的区块到最近的 256 个区块中的一个区块的哈希链。

链上应用程序的未来

设想未来链下计算将与链上验证无缝集成。 Steel 使开发人员能够在 zkVM 内可靠地访问和计算以太坊的完整历史,从而能创建出下一代数据丰富且功能更强大的链上应用程序,为实现这一愿景做出不小的贡献。

Comments

All Comments

Recommended for you

  • Fed's Collins: Another rate cut in December is under consideration, but not finalized

    Collins from the Federal Reserve stated: A rate cut in December is clearly being considered, but it has not been finally determined. There are currently no signs of price pressure. More data will be released before December, and we will have to continue to evaluate and interpret it reasonably. (Jinshi)

  • An entity called "7 Siblings" bought 1.06 million EIGEN in the past two days

    According to Onchain Lens monitoring, an entity named "7 Siblings" bought 1.06 million EIGEN in the past two days, with an average purchase price of $2.43,

  • 60 million WLDs transferred to Worldcoin multi-signature address, may be used for market making

    According to iChainfo's monitoring, 60 million WLD (worth $135.9 million) have been transferred to Worldcoin's multi-signature address. It is expected that these WLD will soon be transferred to several market makers.

  • Cryptocurrency stocks rise in pre-market trading

    influenced by the strong performance of Bitcoin, cryptocurrency concept stocks in the US market rose before the market opened. Coinbase (COIN.O) rose 2.1%, Bit Digital (BTBT.O) rose 2.8%, MicroStrategy (MSTR.O) rose 2.4%. ProShares Bitcoin Strategy ETF rose 2%, iShares Bitcoin Trust rose 2.2%.

  • U.S. Bitcoin ETFs Experience Third-Largest Outflow Since Launch

    On Thursday, U.S.-listed bitcoin exchange-traded funds experienced their third-largest outflow since launch, with over $400 million being drained. Interestingly, each time there has been an outflow greater than $400 million, a local bottom in price has been observed, as seen on May 1 and Nov. 4. This comes as stablecoin liquidity and bitcoin transactions are on the rise, while the ETH/BTC ratio has slid to its lowest point since April. Some are questioning whether bitcoin is losing its bullish momentum.

  • Crypto KOL him: He once transferred 20 million Fartcoins to the Truth Terminal wallet, now worth 5 million US dollars

    On November 15th, Equation Founder him posted on X that a whale had sent 20 million Fartcoins to Truth Terminal's wallet address, which was worth $40,000 at the time and is now worth $5 million, making Truth Terminal the first AI millionaire. Finally, he stated that the whale was himself.

  • EU regulators set out guidelines on restrictions for cryptocurrency providers

    the European Banking Authority (EBA) is the European regulatory agency responsible for addressing weaknesses in the European banking industry. It has issued two sets of guidelines, including specific guidelines for payment service providers (PSPs) and cryptocurrency asset service providers (CASPs). On November 14th, EBA released guidelines that specify the measures that PSPs and CASPs must take when transferring funds or cryptocurrency to comply with EU and national restrictive measures. According to EBA, these guidelines ensure the implementation of EU and national sanctions. EBA believes that weaknesses in control, internal policies, and procedures may pose legal and reputational risks to financial institutions (including PSPs and CASPs). In addition, weak links in these areas for financial institutions may also "weaken" the effectiveness of the EU's restrictive measures system. The European Banking Authority emphasizes that this may lead to rule evasion, thereby affecting the stability of the EU's financial ecosystem. According to ECA, these guidelines will apply from December 30, 2025.

  • Binance will launch DEGENUSDT perpetual contract

    According to an official announcement , Binance will launch a perpetual contract for DEGENUSDT, with a maximum leverage of up to 75 times.

  • Into The Block: $89,200 is Bitcoin's key support/resistance point

    According to Into The Block data, more than 907,000 addresses bought Bitcoin at an average price of $89,200, making this price a key support/resistance level.

  • CZ looks back at last year’s post: Standing on the right side of history

    CZ forwarded his November 2023 tweet and said he was standing on the right side of history. Earlier in November 2023, CZ wrote, "Imagine if there was a better form of currency that could help billions of people in history, and you stood on the wrong side. This would not be a good legacy."