Skip to main content
Version: next

Interface: Prover

src.Prover

The prover interface is used to write custom implementations for creating and verifying proofs. This abstracts away the logic of loading the proving keys. For example, a prover implementation could load the keys from disk, from a remote url, etc.

info

See the defaultProver for a nodejs implementation.
See the webProver for a browser compatible implementation.

Properties

genProofAndPublicSignals

genProofAndPublicSignals: (circuitName: string, inputs: any) => Promise<{ proof: any ; publicSignals: any }>

Type declaration

▸ (circuitName, inputs): Promise<{ proof: any ; publicSignals: any }>

The function should return snark proof and snark public signals of given circuit and inputs

Parameters
NameTypeDescription
circuitNamestringName of the circuit, which can be chosen from Circuit
inputsanyThe user inputs of the circuit
Returns

Promise<{ proof: any ; publicSignals: any }>

proof and publicSignals that can be verified by Prover.verifyProof

Defined in

circuits/src/type.ts:95


getConfig

Optional getConfig: () => CircuitConfig

Type declaration

▸ (): CircuitConfig

Get the current circuit config

Returns

CircuitConfig

Defined in

circuits/src/type.ts:113


getVKey

getVKey: (circuitName: string) => Promise<any>

Type declaration

▸ (circuitName): Promise<any>

Get vkey from default built folder zksnarkBuild/

Parameters
NameTypeDescription
circuitNamestringName of the circuit, which can be chosen from Circuit
Returns

Promise<any>

vkey of the circuit

Defined in

circuits/src/type.ts:108


verifyProof

verifyProof: (circuitName: string, publicSignals: any, proof: any) => Promise<boolean>

Type declaration

▸ (circuitName, publicSignals, proof): Promise<boolean>

The function returns true if the proof of the circuit is valid, false otherwise.

Parameters
NameTypeDescription
circuitNamestringName of the circuit, which can be chosen from Circuit
publicSignalsanyThe public signals of the snark
proofanyThe proof of the snark
Returns

Promise<boolean>

True if the proof is valid, false otherwise

Defined in

circuits/src/type.ts:83