ProofGenerator class
This class is defined in ozki-lib, and used by the user (prover) to create a zk-snark proof which has been signed by the oracle service.
The ProofGenerator is an abstract class which is defined below. This is the type used to generate a signed proof.
export default abstract class ProofGenerator<Type> extends BaseProofGenerator<Type> {
constructor(
zkpComponentPath: string,
zkpComponentName: string
) {
super(zkpComponentPath, zkpComponentName);
}
// the subclass needs to implement this method
// to format caller-specific input parameters
// protected abstract formatCustomInput(customInput: Type): object
protected formatRequiredInput(oracleSignature: Uint8Array, proofTimeStamp: number): object {
... deleted for clarity...
}
generateProof = async (
oracleSignature: Uint8Array,
proofTimeStamp: number,
customInput: Type
): Promise<[string, string]> => {
... deleted for clarity...
}
}
There are two simple steps to use this class:
Subclass the ProofGenerator class with your own specific <Type> that defines the custom input which you use for the circom prove function. Implement the formatCustomInput method which takes the <Type> object and formats it for the circom prove function.
Instantiate the proof generator subclass, and call the generateProof function to create a zk-snark proof. This method takes 3 params: the digital signature of the input parameters, the proof timestamp, and the custom input specific to your circom function.
Last updated
Was this helpful?