Circuit
Class: Circuit
Table of contents
Constructors
Properties
- _main
 - array
 - asProver
 - assertEqual
 - constraintSystem
 - equal
 - if
 - inCheckedComputation
 - inProver
 - log
 - runAndCheck
 - runUnchecked
 - switch
 - witness
 
Methods
Constructors
constructor
• new Circuit()
Properties
_main
▪ Static _main: CircuitData<any, any>
Defined in
array
▪ Static array: <A>(elementType: A, length: number) => InferredProvable<A[]> = Provable.Array
Type declaration
▸ <A>(elementType, length): InferredProvable<A[]>
Deprecated
use Array
Type parameters
| Name | Type | 
|---|---|
A | extends FlexibleProvable<any> | 
Parameters
| Name | Type | 
|---|---|
elementType | A | 
length | number | 
Returns
InferredProvable<A[]>
Defined in
asProver
▪ Static asProver: (f: () => void) => void = Provable.asProver
Type declaration
▸ (f): void
Deprecated
use asProver
Parameters
| Name | Type | 
|---|---|
f | () => void | 
Returns
void
Defined in
assertEqual
▪ Static assertEqual: <T>(type: FlexibleProvable<T>, x: T, y: T) => void<T>(x: T, y: T) => void = Provable.assertEqual
Type declaration
▸ <T>(type, x, y): void
Deprecated
use assertEqual
Type parameters
| Name | 
|---|
T | 
Parameters
| Name | Type | 
|---|---|
type | FlexibleProvable<T> | 
x | T | 
y | T | 
Returns
void
▸ <T>(x, y): void
Deprecated
use assertEqual
Type parameters
| Name | Type | 
|---|---|
T | extends ToFieldable | 
Parameters
| Name | Type | 
|---|---|
x | T | 
y | T | 
Returns
void
Defined in
constraintSystem
▪ Static constraintSystem: <T>(f: () => T) => { digest: string ; gates: Gate[] ; publicInputSize: number ; result: T ; rows: number  } = Provable.constraintSystem
Type declaration
▸ <T>(f): Object
Deprecated
use constraintSystem
Type parameters
| Name | 
|---|
T | 
Parameters
| Name | Type | 
|---|---|
f | () => T | 
Returns
Object
| Name | Type | 
|---|---|
digest | string | 
gates | Gate[] | 
publicInputSize | number | 
result | T | 
rows | number | 
Defined in
equal
▪ Static equal: <T>(type: FlexibleProvable<T>, x: T, y: T) => Bool<T>(x: T, y: T) => Bool = Provable.equal
Type declaration
▸ <T>(type, x, y): Bool
Deprecated
use equal
Type parameters
| Name | 
|---|
T | 
Parameters
| Name | Type | 
|---|---|
type | FlexibleProvable<T> | 
x | T | 
y | T | 
Returns
▸ <T>(x, y): Bool
Deprecated
use equal
Type parameters
| Name | Type | 
|---|---|
T | extends ToFieldable | 
Parameters
| Name | Type | 
|---|---|
x | T | 
y | T | 
Returns
Defined in
if
▪ Static if: <T>(condition: Bool, type: FlexibleProvable<T>, x: T, y: T) => T<T>(condition: Bool, x: T, y: T) => T = Provable.if
Type declaration
▸ <T>(condition, type, x, y): T
Deprecated
use if
Type parameters
| Name | 
|---|
T | 
Parameters
| Name | Type | 
|---|---|
condition | Bool | 
type | FlexibleProvable<T> | 
x | T | 
y | T | 
Returns
T
▸ <T>(condition, x, y): T
Deprecated
use if
Type parameters
| Name | Type | 
|---|---|
T | extends ToFieldable | 
Parameters
| Name | Type | 
|---|---|
condition | Bool | 
x | T | 
y | T | 
Returns
T
Defined in
inCheckedComputation
▪ Static inCheckedComputation: () => boolean = Provable.inCheckedComputation
Type declaration
▸ (): boolean
Deprecated
Returns
boolean
Defined in
inProver
▪ Static inProver: () => boolean = Provable.inProver
Type declaration
▸ (): boolean
Deprecated
use inProver
Returns
boolean
Defined in
log
▪ Static log: (...args: any) => void = Provable.log
Type declaration
▸ (...args): void
Deprecated
use log
Parameters
| Name | Type | 
|---|---|
...args | any | 
Returns
void
Defined in
runAndCheck
▪ Static runAndCheck: (f: () => void) => void = Provable.runAndCheck
Type declaration
▸ (f): void
Deprecated
use runAndCheck
Parameters
| Name | Type | 
|---|---|
f | () => void | 
Returns
void
Defined in
runUnchecked
▪ Static runUnchecked: (f: () => void) => void = Provable.runUnchecked
Type declaration
▸ (f): void
Deprecated
use runUnchecked
Parameters
| Name | Type | 
|---|---|
f | () => void | 
Returns
void
Defined in
switch
▪ Static switch: <T, A>(mask: Bool[], type: A, values: T[]) => T = Provable.switch
Type declaration
▸ <T, A>(mask, type, values): T
Deprecated
use switch
Type parameters
| Name | Type | 
|---|---|
T | T | 
A | extends FlexibleProvable<T> | 
Parameters
| Name | Type | 
|---|---|
mask | Bool[] | 
type | A | 
values | T[] | 
Returns
T
Defined in
witness
▪ Static witness: <T, S>(type: S, compute: () => T) => T = Provable.witness
Type declaration
▸ <T, S>(type, compute): T
Deprecated
use witness
Type parameters
| Name | Type | 
|---|---|
T | T | 
S | extends FlexibleProvable<T> = FlexibleProvable<T> | 
Parameters
| Name | Type | 
|---|---|
type | S | 
compute | () => T | 
Returns
T
Defined in
Methods
generateKeypair
▸ Static generateKeypair(): Promise<Keypair>
Generates a proving key and a verification key for this circuit.
Example
const keypair = await MyCircuit.generateKeypair();
Returns
Promise<Keypair>
Defined in
prove
▸ Static prove(privateInput, publicInput, keypair): Promise<Proof>
Proves a statement using the private input, public input, and the Keypair of the circuit.
Example
const keypair = await MyCircuit.generateKeypair();
const proof = await MyCircuit.prove(privateInput, publicInput, keypair);
Parameters
| Name | Type | 
|---|---|
privateInput | any[] | 
publicInput | any[] | 
keypair | Keypair | 
Returns
Promise<Proof>
Defined in
verify
▸ Static verify(publicInput, verificationKey, proof): Promise<boolean>
Verifies a proof using the public input, the proof, and the initial Keypair of the circuit.
Example
const keypair = await MyCircuit.generateKeypair();
const proof = await MyCircuit.prove(privateInput, publicInput, keypair);
const isValid = await MyCircuit.verify(publicInput, keypair.vk, proof);
Parameters
| Name | Type | 
|---|---|
publicInput | any[] | 
verificationKey | VerificationKey | 
proof | Proof | 
Returns
Promise<boolean>