Alert Source Discuss
🚧 Stagnant Standards Track: ERC

ERC-1923: zk-SNARK 验证器注册表标准

Authors Michael Connor <michael.connor@uk.ey.com>, Chaitanya Konda <chaitanya.konda@uk.ey.com>, Duncan Westland <duncan.westland@uk.ey.com>
Created 2018-12-22
Discussion Link https://github.com/ethereum/EIPs/issues/1923
Requires EIP-165, EIP-196, EIP-197

简述

一个用于“验证器注册表”合约的标准接口,通过该接口可以注册所有 zk-SNARK 验证活动。

摘要

以下标准允许实现一个标准的合约 API,用于注册 zk-SNARKs(“零知识简洁非交互知识论证”),也称为“证明”、“论证”或“承诺”。

待办事项:此标准接口公开了哪些功能?

动机

zk-SNARKs 是以太坊社区一个很有前景的关注领域。zk-SNARKs 的主要应用包括:

  • 私有交易
  • 私有计算
  • 通过“捆绑”交易证明来实现以太坊扩展

用于注册所有 zk-SNARKs 的标准接口将允许应用程序更轻松地实现私有交易、私有合约和扩展解决方案;并提取和解释在 zk-SNARK 验证期间发出的有限信息。

:warning: 待办事项:解释标准化注册表的动机,而不仅仅是标准化验证器交互。

⚠️ 待办事项:解释信息消费者的利益和观点。即与标准验证器注册表交互的东西。

规范

本文档中的关键词“必须 (MUST)”,“禁止 (MUST NOT)”,“需要 (REQUIRED)”,“应当 (SHALL)”,“不应当 (SHALL NOT)”,“应该 (SHOULD)”,“不应该 (SHOULD NOT)”,“推荐 (RECOMMENDED)”,“可以 (MAY)”,和“可选 (OPTIONAL)”按照 RFC 2119 中的描述进行解释。

pragma solidity ^0.5.6;

/// @title EIP-XXXX zk-SNARK 验证器注册表标准
/// @dev See https://github.com/EYBlockchain/zksnark-verifier-standard
///  Note: the ERC-165 identifier for this interface is 0xXXXXXXXXX.
/// ⚠️ TODO: Set the interface identifier
interface EIP-XXXX /* is ERC165 */ {

  event NewProofSubmitted(bytes32 indexed _proofId, uint256[] _proof, uint64[] _inputs);

  event NewVkRegistered(bytes32 indexed _vkId);

  event NewVerifierContractRegistered(address indexed _contractAddress);

  event NewAttestation(bytes32 indexed _proofId, address indexed _verifier, bool indexed _result);


  function getVk(bytes32 _vkId) external returns (uint256[] memory);

  function registerVerifierContract(address _verifierContract) external returns (bool);

  function registerVk(uint256[] calldata _vk, address[] calldata _verifierContracts) external returns (bytes32);

  function submitProof(uint256[] calldata _proof, uint64[] calldata _inputs, bytes32 _vkId) external returns (bytes32);

  function submitProof(uint256[] calldata _proof, uint64[] calldata _inputs, bytes32 _vkId, address _verifierContract) external returns (bytes32);

  function submitProofAndVerify(uint256[] calldata _proof, uint64[] calldata _inputs, bytes32 _vkId, address _verifierContract) external returns (bytes32);

  function attestProof(bytes32 _proofId, bytes32 _vkId, bool _result) external;

  function attestProofs(bytes32[] calldata _proofIds, bytes32[] calldata _vkIds, bool[] calldata _results) external;

  function challengeAttestation(bytes32 _proofId, uint256[] calldata _proof, uint64[] calldata  _inputs, address _verifierContract) external;

  function createNewVkId(uint256[] calldata _vk) external pure returns (bytes32);

  function createNewProofId(uint256[] calldata _proof, uint64[] calldata _inputs) external pure returns (bytes32);

}

接口

interface ERC165 {
    /// @notice Query if a contract implements an interface
    /// @param interfaceID The interface identifier, as specified in ERC-165
    /// @dev Interface identification is specified in ERC-165. This function
    ///  uses less than 30,000 gas.
    /// @return `true` if the contract implements `interfaceID` and
    ///  `interfaceID` is not 0xffffffff, `false` otherwise
    function supportsInterface(bytes4 interfaceID) external view returns (bool);
}

理由

⚠️ 待办事项:添加理由部分。

向后兼容性

⚠️ 待办事项:添加向后兼容性部分。

测试用例

此存储库中包含示例实现的 Truffle 测试。

⚠️ 待办事项:引用具体的测试用例,因为目前存储库中有很多。

实现

此存储库中包含详细的示例实现和这些示例实现的 Truffle 测试。

⚠️ 待办事项:更新引用的验证器注册表实现,以便它们可以部署或引用这些实现的已部署版本。目前,引用的代码特别声明“请勿在生产环境中使用”。

⚠️ 待办事项:提供对实现此标准的标准验证器注册表合约进行询问的实现的引用。

参考文献

⚠️ 待办事项:更新参考文献并确认每个参考文献都在文本中被引用(不需要括号内的文档)。

标准

  1. ERC-20 Token Standard. ./eip-20.md

  2. ERC-165 Standard Interface Detection. ./eip-165.md
  3. ERC-173 Contract Ownership Standard (DRAFT). ./eip-173.md
  4. ERC-196 Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128. ./eip-196.md
  5. ERC-197 Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128. ./eip-197.md
  6. Ethereum Name Service (ENS). https://ens.domains
  7. RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https://www.ietf.org/rfc/rfc2119.txt
教育材料:zk-SNARKs
  1. Zcash. What are zk-SNARKs? https://z.cash/technology/zksnarks.html
  2. Vitalik Buterin. zk-SNARKs: Under the Hood. https://medium.com/@VitalikButerin/zk-snarks-under-the-hood-b33151a013f6
  3. Christian Reitweissner. zk-SNARKs in a Nutshell. https://blog.ethereum.org/2016/12/05/zksnarks-in-a-nutshell/
  4. Ben-Sasson, Chiesa, Tromer, et. al. Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture. https://eprint.iacr.org/2013/879.pdf
zk-SNARKs 的著名应用
  1. EY. Implementation of a business agreement through Token Commitment transactions on the Ethereum mainnet. https://github.com/EYBlockchain/ZKPChallenge
  2. Zcash. https://z.cash
  3. Zcash. How Transactions Between Shielded Addresses Work. https://blog.z.cash/zcash-private-transactions/
与 zk-SNARKs 相关的著名项目
  1. libsnark: A C++ Library for zk-SNARKs (“project README)”. https://github.com/scipr-lab/libsnark
  2. ZoKrates: Scalable Privacy-Preserving Off-Chain Computations. https://www.ise.tu-berlin.de/fileadmin/fg308/publications/2018/2018_eberhardt_ZoKrates.pdf
  3. ZoKrates Project Repository. https://github.com/JacobEberhardt/ZoKrates
  4. Joseph Stockermans. zkSNARKs: Driver’s Ed. https://github.com/jstoxrocky/zksnarks_example
  5. Christian Reitweissner - snarktest.solidity. https://gist.github.com/chriseth/f9be9d9391efc5beb9704255a8e2989d
zk-SNARKs 的著名“替代方案”——正在进行的零知识证明研究领域
  1. Vitalik Buterin. STARKs. https://web.archive.org/web/20230425101334/https://vitalik.ca/general/2017/11/09/starks_part_1.html
  2. Bu ̈nz, Bootle, Boneh, et. al. Bulletproofs. https://eprint.iacr.org/2017/1066.pdf
  3. Range Proofs. https://www.cosic.esat.kuleuven.be/ecrypt/provpriv2012/abstracts/canard.pdf
  4. Apple. Secure Enclaves. https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/storing_keys_in_the_secure_enclave
  5. Intel Software Guard Extensions. https://software.intel.com/en-us/sgx

版权

CC0 下放弃版权及相关权利。

Citation

Please cite this document as:

Michael Connor <michael.connor@uk.ey.com>, Chaitanya Konda <chaitanya.konda@uk.ey.com>, Duncan Westland <duncan.westland@uk.ey.com>, "ERC-1923: zk-SNARK 验证器注册表标准 [DRAFT]," Ethereum Improvement Proposals, no. 1923, December 2018. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-1923.