Skip to main content

SelfProof

o1js / Modules / SelfProof

Class: SelfProof\<PublicInput, PublicOutput>

Type parameters

Name
PublicInput
PublicOutput

Hierarchy

  • Proof\<PublicInput, PublicOutput>

    SelfProof

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new SelfProof\<PublicInput, PublicOutput>(«destructured»)

Type parameters

Name
PublicInput
PublicOutput

Parameters

NameType
«destructured»Object
› maxProofsVerified0 | 2 | 1
› proofunknown
› publicInputPublicInput
› publicOutputPublicOutput

Inherited from

Proof.constructor

Defined in

lib/proof_system.ts:137

Properties

maxProofsVerified

maxProofsVerified: 0 | 2 | 1

Inherited from

Proof.maxProofsVerified

Defined in

lib/proof_system.ts:95


proof

proof: unknown

Inherited from

Proof.proof

Defined in

lib/proof_system.ts:94


publicInput

publicInput: PublicInput

Inherited from

Proof.publicInput

Defined in

lib/proof_system.ts:92


publicOutput

publicOutput: PublicOutput

Inherited from

Proof.publicOutput

Defined in

lib/proof_system.ts:93


shouldVerify

shouldVerify: Bool

Inherited from

Proof.shouldVerify

Defined in

lib/proof_system.ts:96


publicInputType

Static publicInputType: FlexibleProvablePure\<any>

Inherited from

Proof.publicInputType

Defined in

lib/proof_system.ts:84


publicOutputType

Static publicOutputType: FlexibleProvablePure\<any>

Inherited from

Proof.publicOutputType

Defined in

lib/proof_system.ts:85


tag

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

Type declaration

▸ (): Object

Returns

Object

NameType
namestring

Inherited from

Proof.tag

Defined in

lib/proof_system.ts:86

Methods

toJSON

toJSON(): JsonProof

Returns

JsonProof

Inherited from

Proof.toJSON

Defined in

lib/proof_system.ts:104


verify

verify(): void

Returns

void

Inherited from

Proof.verify

Defined in

lib/proof_system.ts:98


verifyIf

verifyIf(condition): void

Parameters

NameType
conditionBool

Returns

void

Inherited from

Proof.verifyIf

Defined in

lib/proof_system.ts:101


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>>

Inherited from

Proof.dummy

Defined in

lib/proof_system.ts:175


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"]>>

Inherited from

Proof.fromJSON

Defined in

lib/proof_system.ts:113