etherlime zk
In order to start a project with Zero Knowledge Proof, please refer to etherlime init command.
Available Commands:
Circuit Compilation
etherlime zk compileRunning this command will compile a circuitfile located in
zero-knowledge-proof/circuitsand generates anew folder
compiled-circuits.
Establish Trusted Setup
etherlime zk setupRunning this command will establish a trustedsetup based on compiled circuit and generates a folder `trusted
setup
withproving_keyandverification_key`. The commandreads the compiled circuit from
zero-knowledge-proof/compiled-circuits.
Generate ZK Proof
etherlime zk proof [signal] [circuit] [provingKey]Running thiscommand will generates a proof based on compiled circuit, public
signal input and proving key. A new folder
generated-proofisgenerated with
proofandpublic_signals. This proof can beused for off-chain Zero-Knowledge-Proof verification.
Parameters:
signal- [Optional] Specifies the file with publicsignals input to be used for generating a proof.
Defaults to
input.jsonread from
zero-knowledge-proof/inputfolder.
circuit- [Optional] Specifies the compiled circuitfor checking of matched signals. Defaults to:
circuit.jsonread from
zero-knowledge-proof/compiled-circuitsfolder.
provingKey- [Optional] Specifies the prooving keyto be used for generating a proof. Defaults to:
circuit_proving_key.jsonread from
zero-knowledge-proof/trusted-setupfolder.
Verify Proof (Off-chain)
etherlime zk verify [publicSignals] [proof] [verifierKey]Running this command will generates a verifier based on public
signals file that comes out of the proof command, the proof itself
and verifier key. A new folder
verified-proofis generated with
output.jsonfile.
Parameters:
publicSignals- [Optional] Specifies the file withsignals to be used for generating verifying a proof.
Defaults to
circuit_public_signals.jsonread from
zero-knowledge-proof/generated-prooffolder.
proof- [Optional] Specifies the compiled proof thatwould be used for generating a proof based on it.
Defaults to:
circuit_proof.jsonread from
zero-knowledge-proof/generated-prooffolder.
verifierKey- [Optional] Specifies the verifier keyto be used for generating a proof. Defaults to:
circuit_verification_key.jsonread from
zero-knowledge-proof/trusted-setupfolder.
output.jsonfile has two params:
verified- whatever the proof is verified or not
timestamp- identifier for the time that event occurs
Generate Smart Contract for On-Chain Verification
etherlime zk generate [verifierKey]Generates a verifier smartcontract based on verification key which can be used for on-chain
verification. The smart contract is written in contracts folder
and it is ready to be compiled and deployed with `etherlime
compile
andetherlime deploy`. The verifier smart contract has apublic view method
verifyProofthat can be called for on-chainverification. You can generate the call parameters with `etherlime
zk-generate-call` cli command.
Parameters:
verifierKey- [Optional] Specifies the verifier keyto be used for generating a verifier smart contract.
Defaults to: circuit_verification_key.json read from
zero-knowledge-proof/generated-prooffolder.
Generate output call based for On-chanin Verification
etherlime zk call [publicSignals] [proof]Running this commandwill generates a call based on proof and public signals. A new
folder
generated-callis generated withgeneratedCall.jsonfile. This generated call can be used for on-chain verification,
for calling public view method
verifyProofof the generatedverifier contract with this data.
Parameters:
publicSignals- [Optional] Specifies the file withsignals to be used for generating verifying a proof.
Defaults to
circuit_public_signals.jsonread from
zero-knowledge-proof/generated-prooffolder.
proof- [Optional] Specifies the compiled proof thatwould be used for generating a proof based on it.
Defaults to:
circuit_proof.jsonread from
zero-knowledge-proof/generated-prooffolder.
Last updated
Was this helpful?
