This repository provides an example of integrating jsnark circuits with EthSnarks. It allows you to construct circuits using jsnark and xjsnark which can be proven on Ethereum.
Checkout this repository into the same parent directory that contains ethsnarks
:
- project-root
- ethsnarks
- ethsnarks-jsnark
jsnark and xjsnark output two files:
- Circuit instructions (ending in
.arith
) - Input values (ending in
.in
)
EthSnarks ships with an executable called pinocchio
, this takes the .arith
and .in
files to generate the proving and verification keys for the circuit, and then to create a proof.
pinocchio mycircuit.arith eval mycircuit.in
Generates proving key file named mycircuit.pk
and verification key named mycircuit.vk.json
pinocchio mycircuit.arith genkeys mycircuit.pk mycircuit.vk.json
Uses the proving key mycircuit.pk
to create a proof named mycircuit.proof.json
for the inputs mycircuit.in
pinocchio mycircuit.arith prove mycircuit.in mycircuit.pk mycircuit.proof.json
Uses the verification key mycircuit.vk.json
and the proof mycircuit.proof.json
pinocchio mycircuit.arith verify mycircuit.vk.json mycircuit.proof.json
The jsnark tool could be improved in the following ways:
- It's not necessary to output the values for every variable if the operations are evaluated
- Public inputs must be specified first in the circuit
.arith
file
The pinocchio
tool could be improved in the following ways:
- If all variable values are provided by jsnark, there's no need to evaluate the circuit