Proof
Defined in: lib/proof-system/proof.ts:125
Extends
ProofBase
<Input
,Output
>
Extended by
Type Parameters
Input
Input
Output
Output
Constructors
Constructor
new Proof<Input, Output>(__namedParameters: {
maxProofsVerified: 0 | 1 | 2;
proof: unknown;
publicInput: Input;
publicOutput: Output;
}): Proof<Input, Output>;
Defined in: lib/proof-system/proof.ts:71
Parameters
__namedParameters
maxProofsVerified
0
| 1
| 2
proof
unknown
publicInput
Input
publicOutput
Output
Returns
Proof
<Input
, Output
>
Inherited from
Properties
maxProofsVerified
maxProofsVerified: 0 | 1 | 2;
Defined in: lib/proof-system/proof.ts:37
Inherited from
proof
proof: unknown;
Defined in: lib/proof-system/proof.ts:36
Inherited from
publicInput
publicInput: Input;
Defined in: lib/proof-system/proof.ts:34
Inherited from
publicOutput
publicOutput: Output;
Defined in: lib/proof-system/proof.ts:35
Inherited from
shouldVerify
shouldVerify: Bool;
Defined in: lib/proof-system/proof.ts:38
Inherited from
publicInputType
static publicInputType: FlexibleProvable<any>;
Defined in: lib/proof-system/proof.ts:26
Inherited from
publicOutputType
static publicOutputType: FlexibleProvable<any>;
Defined in: lib/proof-system/proof.ts:27
Inherited from
tag()
static tag: () => {
name: string;
};
Defined in: lib/proof-system/proof.ts:28
Returns
{
name: string;
}
name
name: string;
Inherited from
Accessors
provable
Get Signature
get static provable(): ProvableProof<Proof<any, any>>;
Defined in: lib/proof-system/proof.ts:197
Returns
ProvableProof
<Proof
<any
, any
>>
Overrides
Methods
declare()
declare(): boolean;
Defined in: lib/proof-system/proof.ts:54
To verify a recursive proof inside a ZkProgram method, it has to be "declared" as part of
the method. This is done by calling declare()
on the proof.
Note: declare()
is a low-level method that most users will not have to call directly.
For proofs that are inputs to the ZkProgram, it is done automatically.
You can think of declaring a proof as a similar step as witnessing a variable, which introduces that variable to the circuit. Declaring a proof will tell Pickles to add the additional constraints for recursive proof verification.
Similar to Provable.witness()
, declare()
is a no-op when run outside ZkProgram compilation or proving.
It returns false
in that case, and true
if the proof was actually declared.
Returns
boolean
Inherited from
publicFields()
publicFields(): {
input: Field[];
output: Field[];
};
Defined in: lib/proof-system/proof.ts:111
Returns
{
input: Field[];
output: Field[];
}
input
input: Field[];
output
output: Field[];
Inherited from
toJSON()
toJSON(): JsonProof;
Defined in: lib/proof-system/proof.ts:61
Returns
Inherited from
verify()
verify(): void;
Defined in: lib/proof-system/proof.ts:132
Sets the shouldVerify
flag to true
The downstream effect of this is that the proof will be verified when the circuit is run
Returns
void
Note
This method is meant to be called in a circuit. Executing it outside of a circuit will have no effect.
verifyIf()
verifyIf(condition: Bool): void;
Defined in: lib/proof-system/proof.ts:142
Sets the shouldVerify
flag to the given condition param
If set to Bool(true)
, the proof will be verified when the circuit is run
If set to Bool(false)
, the proof will not be verified when the circuit is run
Parameters
condition
Returns
void
Note
This method is meant to be called in a circuit. Executing it outside of a circuit will have no effect.
_proofFromBase64()
static _proofFromBase64(proofString: string, maxProofsVerified: 0 | 1 | 2): unknown;
Defined in: lib/proof-system/proof.ts:115
Parameters
proofString
string
maxProofsVerified
0
| 1
| 2
Returns
unknown
Inherited from
_proofToBase64()
static _proofToBase64(proof: unknown, maxProofsVerified: 0 | 1 | 2): string;
Defined in: lib/proof-system/proof.ts:119
Parameters
proof
unknown
maxProofsVerified
0
| 1
| 2
Returns
string
Inherited from
dummy()
static dummy<Input, OutPut>(
publicInput: Input,
publicOutput: OutPut,
maxProofsVerified: 0 | 1 | 2,
domainLog2: number): Promise<Proof<Input, OutPut>>;
Defined in: lib/proof-system/proof.ts:182
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
Input
OutPut
OutPut
Parameters
publicInput
Input
publicOutput
OutPut
maxProofsVerified
0
| 1
| 2
domainLog2
number
= 14
Returns
Promise
<Proof
<Input
, OutPut
>>
fromJSON()
static fromJSON<S>(this: S, __namedParameters: JsonProof): Promise<Proof<InferProvable<S["publicInputType"]>, InferProvable<S["publicOutputType"]>>>;
Defined in: lib/proof-system/proof.ts:146
Type Parameters
S
S
extends Subclass
<typeof Proof
>
Parameters
this
S
__namedParameters
Returns
Promise
<Proof
<InferProvable
<S
["publicInputType"
]>, InferProvable
<S
["publicOutputType"
]>>>
publicFields()
static publicFields(value: ProofBase): {
input: Field[];
output: Field[];
};
Defined in: lib/proof-system/proof.ts:103
Parameters
value
Returns
{
input: Field[];
output: Field[];
}
input
input: Field[];
output
output: Field[];