Skip to main content

SelfProof

Extends

  • Proof\<PublicInput, PublicOutput>

Type parameters

PublicInput

PublicOutput

Constructors

new SelfProof(__namedParameters)

new SelfProof<PublicInput, PublicOutput>(__namedParameters: {
maxProofsVerified: 0 | 1 | 2;
proof: unknown;
publicInput: PublicInput;
publicOutput: PublicOutput;
}): SelfProof<PublicInput, PublicOutput>

Parameters

__namedParameters

__namedParameters.maxProofsVerified: 0 | 1 | 2

__namedParameters.proof: unknown

__namedParameters.publicInput: PublicInput

__namedParameters.publicOutput: PublicOutput

Returns

SelfProof\<PublicInput, PublicOutput>

Inherited from

Proof.constructor

Source

lib/proof-system/zkprogram.ts:140

Properties

maxProofsVerified

maxProofsVerified: 0 | 1 | 2;

Inherited from

Proof.maxProofsVerified

Source

lib/proof-system/zkprogram.ts:95


proof

proof: unknown;

Inherited from

Proof.proof

Source

lib/proof-system/zkprogram.ts:94


publicInput

publicInput: PublicInput;

Inherited from

Proof.publicInput

Source

lib/proof-system/zkprogram.ts:92


publicOutput

publicOutput: PublicOutput;

Inherited from

Proof.publicOutput

Source

lib/proof-system/zkprogram.ts:93


shouldVerify

shouldVerify: Bool;

Inherited from

Proof.shouldVerify

Source

lib/proof-system/zkprogram.ts:96


publicInputType

static publicInputType: FlexibleProvablePure<any>;

Inherited from

Proof.publicInputType

Source

lib/proof-system/zkprogram.ts:84


publicOutputType

static publicOutputType: FlexibleProvablePure<any>;

Inherited from

Proof.publicOutputType

Source

lib/proof-system/zkprogram.ts:85


tag()

static tag: () => {
name: string;
};

Returns

{
name: string;
}
name
name: string;

Inherited from

Proof.tag

Source

lib/proof-system/zkprogram.ts:86

Methods

toJSON()

toJSON(): JsonProof

Returns

JsonProof

Inherited from

Proof.toJSON

Source

lib/proof-system/zkprogram.ts:104


verify()

verify(): void

Returns

void

Inherited from

Proof.verify

Source

lib/proof-system/zkprogram.ts:98


verifyIf()

verifyIf(condition: Bool): void

Parameters

condition: Bool

Returns

void

Inherited from

Proof.verifyIf

Source

lib/proof-system/zkprogram.ts:101


dummy()

static dummy<Input, OutPut>(
publicInput: Input,
publicOutput: OutPut,
maxProofsVerified: 0 | 1 | 2,
domainLog2: number): 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

Input

OutPut

Parameters

publicInput: Input

publicOutput: OutPut

maxProofsVerified: 0 | 1 | 2

domainLog2: number= 14

Returns

Promise\<Proof\<Input, OutPut>>

Inherited from

Proof.dummy

Source

lib/proof-system/zkprogram.ts:178


fromJSON()

static fromJSON<S>(this: S, __namedParameters: JsonProof): Promise<Proof<InferProvable<S["publicInputType"]>, InferProvable<S["publicOutputType"]>>>

Type parameters

S extends Subclass\<typeof Proof>

Parameters

this: S

__namedParameters: JsonProof

Returns

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

Inherited from

Proof.fromJSON

Source

lib/proof-system/zkprogram.ts:113