Skip to main content

Proof

o1js / Modules / Proof

Class: Proof\<Input, Output>

Type parameters

Name
Input
Output

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Proof\<Input, Output>(«destructured»)

Type parameters

Name
Input
Output

Parameters

NameType
«destructured»Object
› maxProofsVerified0 | 2 | 1
› proofunknown
› publicInputInput
› publicOutputOutput

Defined in

lib/proof-system.ts:136

Properties

maxProofsVerified

maxProofsVerified: 0 | 2 | 1

Defined in

lib/proof-system.ts:94


proof

proof: unknown

Defined in

lib/proof-system.ts:93


publicInput

publicInput: Input

Defined in

lib/proof-system.ts:91


publicOutput

publicOutput: Output

Defined in

lib/proof-system.ts:92


shouldVerify

shouldVerify: Bool

Defined in

lib/proof-system.ts:95


publicInputType

Static publicInputType: FlexibleProvablePure\<any>

Defined in

lib/proof-system.ts:83


publicOutputType

Static publicOutputType: FlexibleProvablePure\<any>

Defined in

lib/proof-system.ts:84


tag

Static tag: () => { name: string }

Type declaration

▸ (): Object

Returns

Object

NameType
namestring

Defined in

lib/proof-system.ts:85

Methods

toJSON

toJSON(): JsonProof

Returns

JsonProof

Defined in

lib/proof-system.ts:103


verify

verify(): void

Returns

void

Defined in

lib/proof-system.ts:97


verifyIf

verifyIf(condition): void

Parameters

NameType
conditionBool

Returns

void

Defined in

lib/proof-system.ts:100


dummy

Static dummy\<Input, OutPut>(publicInput, publicOutput, maxProofsVerified, domainLog2?): Promise\<Proof\<Input, OutPut>>

Dummy proof. This can be useful for ZkPrograms that handle the base case in the same method as the inductive case, using a pattern like this:

method(proof: SelfProof<I, O>, isRecursive: Bool) {
proof.verifyIf(isRecursive);
// ...
}

To use such a method in the base case, you need a dummy proof:

let dummy = await MyProof.dummy(publicInput, publicOutput, 1);
await myProgram.myMethod(dummy, Bool(false));

Note: The types of publicInput and publicOutput, as well as the maxProofsVerified parameter, must match your ZkProgram. maxProofsVerified is the maximum number of proofs that any of your methods take as arguments.

Type parameters

Name
Input
OutPut

Parameters

NameTypeDefault value
publicInputInputundefined
publicOutputOutPutundefined
maxProofsVerified0 | 2 | 1undefined
domainLog2number14

Returns

Promise\<Proof\<Input, OutPut>>

Defined in

lib/proof-system.ts:174


fromJSON

Static fromJSON\<S>(this, «destructured»): Proof\<InferProvable\<S["publicInputType"]>, InferProvable\<S["publicOutputType"]>>

Type parameters

NameType
Sextends Subclass\<typeof Proof>

Parameters

NameType
thisS
«destructured»JsonProof

Returns

Proof\<InferProvable\<S["publicInputType"]>, InferProvable\<S["publicOutputType"]>>

Defined in

lib/proof-system.ts:112