/zokrates-evaluation

Example for a practical evaluation using zk-SNARKs with ZoKrates on the Ethereum Blockchain.

Primary LanguageSolidityGNU General Public License v3.0GPL-3.0

ZoKrates evaluation

Example for a practical evaluation using zk-SNARKs with ZoKrates.

The verification Smart Contract is deployed on the Ethereum Ropsten Testnet: https://ropsten.etherscan.io/address/0xa142e351a99d667aea5e671ce9a508d1cca642d7

To verify the example proof, the following input can be used when calling the verifyTx method:

proof (tuple):
[["0x0dd2029b4d3efd329a684aab1027372da9d83d1ec4518be31d8a0b84e808627f","0x015b014adaa9a306c4ebc41aea06de2f3b9e1e4c4d2975fd595cdd6c882ac404"],[["0x0d13b02af25776c529b9307f6f56cfb17f95616d70350dabe4544d4073d49996","0x29ba42f2a310e6d63d1171f2f6e97c271cd28d3b2731cad1e177d350dbd76ee0"],["0x151465f694dcdb2428ab1582c3e749c8ad5c10dc30b18f3673e5d44aef3b2f83","0x0763c5492dfef950079f15fc8ef0ad234601392cb6709bb56ef8a2ff405d8ba9"]],["0x13a07a48c2aace6c59e5a1bd212a2b94fa7288055dc8d81a66c4fe12a56c0535","0x2b65f92396af555578e28a06f2b38511c3dfe59191c1b80773a69eee990702ed"]]

input (uint256[3]):
["0x000000000000000000000000000000008dcabedc588ff73a42d3ff0d6a55771c","0x000000000000000000000000000000009396a8c7dba36e478eed41121f4a80e2","0x0000000000000000000000000000000000000000000000000000000000000001"]

Files

  • check_hash.py: Python file to compute the hash and useful formats for an arbitrary preimage. Outputs the padded, hex-encoded input the ZoKrates SHA256 implementation uses.
  • proof.zok: ZoKrates program to prove knowledge of a preimage for a given hash digest without revealing the preimage.
  • generate_hash.zok: ZoKrates helper program to generate the hash digest for a proof example in the correct format (two fields each holding a 128-bit number).
  • verifier.sol: Verification Smart Contract automatically generated by ZoKrates. See given license.
  • example_proof.json: Example output of the ZoKrates witness computation.
  • example_verification_key.json: Example output of the ZoKrates setup phase.

Licensing

This project uses ZoKrates, released under the GNU Lesser General Public License v3. The implemented example is based on the ZoKrates documentation.