Circuit
Defined in: lib/proof-system/circuit.ts:17
Deprecated
The Circuit API is deprecated in favor of ZkFunction, which features the same
functionality with a more ergonomic and consistent structure, inspired by ZkProgram.
Constructors
Constructor
new Circuit(): Circuit;
Returns
Circuit
Properties
_main
static _main: CircuitData<any, any>;
Defined in: lib/proof-system/circuit.ts:20
Methods
generateKeypair()
static generateKeypair(lazyMode: boolean): Promise<Keypair>;
Defined in: lib/proof-system/circuit.ts:29
Generates a proving key and a verification key for this circuit.
Parameters
lazyMode
boolean = false
Returns
Promise<Keypair>
Example
const keypair = await MyCircuit.generateKeypair();
prove()
static prove(
privateInput: any[],
publicInput: any[],
keypair: Keypair): Promise<Proof>;
Defined in: lib/proof-system/circuit.ts:49
Proves a statement using the private input, public input, and the Keypair of the circuit.
Parameters
privateInput
any[]
publicInput
any[]
keypair
Returns
Promise<Proof>
Example
const keypair = await MyCircuit.generateKeypair();
const proof = await MyCircuit.prove(privateInput, publicInput, keypair);
verify()
static verify(
publicInput: any[],
verificationKey: VerificationKey,
proof: Proof): Promise<boolean>;
Defined in: lib/proof-system/circuit.ts:76
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);