A standard interface for a âVerifier Registryâââ contract, through which all zk-SNARK verification activity can be registered.
Abstract
The following standard allows for the implementation of a standard contract API for the registration of zk-SNARKs (âZero-Knowledge Succinct Non-Interactive Arguments of Knowledgeâ), also known as âproofsâ, âargumentsâ, or âcommitmentsâ.
TODO: Which functionality is exposed in this standard interface?
Motivation
zk-SNARKs are a promising area of interest for the Ethereum community. Key applications of zk-SNARKs include:
Private transactions
Private computations
Ethereum scaling through proofs of âbundledâ transactions
A standard interface for registering all zk-SNARKs will allow applications to more easily implement private transactions, private contracts, and scaling solutions; and to extract and interpret the limited information which gets emitted during zk-SNARK verifications.
:warning: TODO: Explain the motivation for standardizing a registry, other than simply standardizing the verifier interactions.
â ď¸ TODO: Explain the benefits to and perspective of a consumer of information. I.e. the thing that interfaces with the standard verifier registry.
Specification
The key words âMUSTâ, âMUST NOTâ, âREQUIREDâ, âSHALLâ, âSHALL NOTâ, âSHOULDâ, âSHOULD NOTâ, âRECOMMENDEDâ, âMAYâ, and âOPTIONALâ in this document are to be interpreted as described in RFC 2119.
pragmasolidity^0.5.6;/// @title EIP-XXXX zk-SNARK Verifier Registry Standard
/// @dev See https://github.com/EYBlockchain/zksnark-verifier-standard
/// Note: the ERC-165 identifier for this interface is 0xXXXXXXXXX.
/// â ď¸ TODO: Set the interface identifier
interfaceEIP-XXXX/* is ERC165 */{eventNewProofSubmitted(bytes32indexed_proofId,uint256[]_proof,uint64[]_inputs);eventNewVkRegistered(bytes32indexed_vkId);eventNewVerifierContractRegistered(addressindexed_contractAddress);eventNewAttestation(bytes32indexed_proofId,addressindexed_verifier,boolindexed_result);functiongetVk(bytes32_vkId)externalreturns(uint256[]memory);functionregisterVerifierContract(address_verifierContract)externalreturns(bool);functionregisterVk(uint256[]calldata_vk,address[]calldata_verifierContracts)externalreturns(bytes32);functionsubmitProof(uint256[]calldata_proof,uint64[]calldata_inputs,bytes32_vkId)externalreturns(bytes32);functionsubmitProof(uint256[]calldata_proof,uint64[]calldata_inputs,bytes32_vkId,address_verifierContract)externalreturns(bytes32);functionsubmitProofAndVerify(uint256[]calldata_proof,uint64[]calldata_inputs,bytes32_vkId,address_verifierContract)externalreturns(bytes32);functionattestProof(bytes32_proofId,bytes32_vkId,bool_result)external;functionattestProofs(bytes32[]calldata_proofIds,bytes32[]calldata_vkIds,bool[]calldata_results)external;functionchallengeAttestation(bytes32_proofId,uint256[]calldata_proof,uint64[]calldata_inputs,address_verifierContract)external;functioncreateNewVkId(uint256[]calldata_vk)externalpurereturns(bytes32);functioncreateNewProofId(uint256[]calldata_proof,uint64[]calldata_inputs)externalpurereturns(bytes32);}
Interface
interfaceERC165{/// @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
functionsupportsInterface(bytes4interfaceID)externalviewreturns(bool);}
Rationale
â ď¸ TODO: Add Rationale section.
Backwards Compatibility
â ď¸ TODO: Add Backwards Compatibility section.
Test Cases
Truffle tests of example implementations are included in this Repo.
â ď¸ TODO: Reference specific test cases because there are many currently in the repository.
Implementations
Detailed example implementations and Truffle tests of these example implementations are included in this Repo.
â ď¸ TODO: Update referenced verifier registry implementations so that they are ready-to-deploy or reference deployed versions of those implementations. At current, the referenced code specifically states âDO NOT USE THIS IN PRODUCTIONâ.
â ď¸ TODO: Provide reference to an implementation which interrogates a standard verifier registry contract that implements this standard.
References
â ď¸ TODO: Update references and confirm that each reference is cited (parenthetical documentation not necessary) in the text.
Standards
ERC-20 Token Standard. ./eip-20.md
ERC-165 Standard Interface Detection. ./eip-165.md
ERC-173 Contract Ownership Standard (DRAFT). ./eip-173.md
ERC-196 Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128. ./eip-196.md
ERC-197 Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128. ./eip-197.md
Ethereum Name Service (ENS). https://ens.domains
RFC 2119 Key words for use in RFCs to Indicate Requirement Levels. https://www.ietf.org/rfc/rfc2119.txt
Educational material: zk-SNARKs
Zcash. What are zk-SNARKs? https://z.cash/technology/zksnarks.html
Vitalik Buterin. zk-SNARKs: Under the Hood. https://medium.com/@VitalikButerin/zk-snarks-under-the-hood-b33151a013f6
Christian Reitweissner. zk-SNARKs in a Nutshell. https://blog.ethereum.org/2016/12/05/zksnarks-in-a-nutshell/
Ben-Sasson, Chiesa, Tromer, et. al. Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture. https://eprint.iacr.org/2013/879.pdf
Notable applications of zk-SNARKs
EY. Implementation of a business agreement through Token Commitment transactions on the Ethereum mainnet. https://github.com/EYBlockchain/ZKPChallenge
Zcash. https://z.cash
Zcash. How Transactions Between Shielded Addresses Work. https://blog.z.cash/zcash-private-transactions/
Notable projects relating to zk-SNARKs
libsnark: A C++ Library for zk-SNARKs (âproject README)â. https://github.com/scipr-lab/libsnark