Circuit
Constructors
new Circuit()
new Circuit(): Circuit
Returns
Properties
_main
static _main: CircuitData<any, any>;
Source
lib/proof-system/circuit.ts:22
Methods
generateKeypair()
static generateKeypair(): Promise<Keypair>
Generates a proving key and a verification key for this circuit.
Returns
Promise
\<Keypair
>
Example
const keypair = await MyCircuit.generateKeypair();
Source
lib/proof-system/circuit.ts:31
prove()
static prove(
privateInput: any[],
publicInput: any[],
keypair: Keypair): Promise<Proof>
Proves a statement using the private input, public input, and the Keypair of the circuit.
Parameters
• privateInput: any
[]
• publicInput: any
[]
• keypair: Keypair
Returns
Promise
\<Proof
>
Example
const keypair = await MyCircuit.generateKeypair();
const proof = await MyCircuit.prove(privateInput, publicInput, keypair);
Source
lib/proof-system/circuit.ts:51
verify()
static verify(
publicInput: any[],
verificationKey: VerificationKey,
proof: Proof): Promise<boolean>
Verifies a proof using the public input, the proof, and the initial Keypair of the circuit.
Parameters
• publicInput: any
[]
• verificationKey: VerificationKey
• proof: Proof
Returns
Promise
\<boolean
>
Example
const keypair = await MyCircuit.generateKeypair();
const proof = await MyCircuit.prove(privateInput, publicInput, keypair);
const isValid = await MyCircuit.verify(publicInput, keypair.vk, proof);