vrfVerify method
bool
vrfVerify(
- MerlinTranscript script,
- VRFPreOut output,
- VRFProof proof, {
- MerlinTranscript? verifyScript,
Verifies a Verifiable Random Function (VRF) output and its proof.
This method verifies the validity of a VRF output and its corresponding proof by comparing it to a transcript and the provided proof.
Parameters:
script
: A transcript containing context-specific information used for VRF verification.output
: The VRF output to be verified.proof
: The proof associated with the VRF output.
Returns: A boolean indicating whether the VRF output and its proof are valid (true) or not (false).
Example Usage:
MerlinTranscript script = ...;
List<int> vrfOutput = ...;
VRFProof proof = ...;
bool isVRFValid = vrfVerify(script, vrfOutput, proof);
The vrfVerify
method is used to verify the validity of a Verifiable Random Function (VRF) output and its proof
by comparing it to a transcript and the provided proof. It returns true
if the output and proof are valid,
and false
otherwise.
Implementation
bool vrfVerify(MerlinTranscript script, VRFPreOut output, VRFProof proof,
{MerlinTranscript? verifyScript}) {
final publicPointHash = vrfHash(script);
final vrf = VRFInOut._(publicPointHash.toBytes(), output.toBytes());
final vrifyScript = verifyScript ?? MerlinTranscript("VRF");
return dleqVerify(vrifyScript, vrf, proof);
}