vrfHash method

RistrettoPoint vrfHash(
  1. MerlinTranscript script, {
  2. List<int>? keyBytes,
})

Computes a VRF (Verifiable Random Function) hash using a transcript.

This method computes a VRF hash by appending a Schnorrkel public key to the provided transcript, extracting 64 bytes, and converting it into a RistrettoPoint point.

Parameters:

  • script: A transcript containing context-specific information for the VRF hash computation.

Returns: A RistrettoPoint point representing the VRF hash.

Example Usage:

MerlinTranscript script = ...;
SchnorrkelPublicKey publicKey = ...;
RistrettoPoint vrfHashPoint = publicKey.vrfHash(script);

The vrfHash method is used to compute a VRF hash by appending the public key to a transcript and extracting the resulting hash as a RistrettoPoint point.

Implementation

RistrettoPoint vrfHash(MerlinTranscript script, {List<int>? keyBytes}) {
  script.additionalData("vrf-nm-pk".codeUnits, keyBytes ?? toBytes());
  final scBytes = script.toBytes("VRFHash".codeUnits, 64);
  final hashPoint = RistrettoPoint.fromUniform(scBytes);
  return hashPoint;
}