Anoma.CairoResource.ProofRecord (Anoma v0.34.0)
I am a proof record for a shielded resource.
Summary
Functions
Callback implementation for Noun.Nounable.Kind.from_noun/1.
Generates a compliance proof using the provided witness and the fixed compliance proving key.
Calculates the Cairo program hash for the given ProofRecord.
Generates a cairo proof using the provided proving key and witness.
Verifies the given ProofRecord.
Types
Functions
Callback implementation for Noun.Nounable.Kind.from_noun/1.
Generates a compliance proof using the provided witness and the fixed compliance proving key.
This function reads the compliance proving key from a JSON file. It then uses this proving key to generate a proof based on the given witness.
Parameters
witness(binary()): The witness data used to generate the compliance proof.
Returns
{:ok, t()}: If the compliance proof is successfully generated.{:error, term()}: If there is an error, such as the compliance proving key file not being found.
Calculates the Cairo program hash for the given ProofRecord.
Parameters
- proof_record: A
ProofRecordstruct containing the instance.
Returns
- A binary representing the Cairo program hash.
Generates a cairo proof using the provided proving key and witness.
Parameters
proving_key(binary): The proving key used for generating the proof.witness(binary): The witness data used for generating the proof._instance(any, not used): An instance parameter, defaults to an empty binary. In zkvms, the instance is an output rather than an input.
Returns
{:ok, %ProofRecord{}}: A tuple containing:okand aProofRecordstruct with the generated proof and instance.{:error, any()}: A tuple containing:errorand the reason for the failure.
Verifies the given ProofRecord.
This function takes a ProofRecord and verifies its proof against its public
inputs. It converts the binary data of both the instance and the proof to
lists before passing them to the Cairo.verify/2 function. There is no
verifying key in the Cairo system; instead, a program segment in the instance
serves this purpose. For efficiency, we provide a method to retrieve the
verifying key from instance without explicitly using the verifying key field.
Parameters
- proof: A
ProofRecordcontaining the verifying key, proof and public inputs to be verified.
Returns
trueif the proof is valid.falseif the proof is invalid.{:error, term()}if the verification encounters errors.