vrfSign method

  1. @override
List<int> vrfSign(
  1. List<int> message, {
  2. List<int>? context,
  3. List<int>? extra,
})
override

Implementation

@override
List<int> vrfSign(List<int> message, {List<int>? context, List<int>? extra}) {
  final MerlinTranscript vrfScript =
      _SubstrateSr25519SignerUtils.vrfScript(extra: extra);
  final MerlinTranscript script =
      _SubstrateSr25519SignerUtils.substrateVrfSignScript(message, context);
  final sign =
      _signer.vrfSign(script, kusamaVRF: true, verifyScript: vrfScript);
  final List<int> vrfResult = [...sign.item1.output, ...sign.item2.toBytes()];
  final verifier = toVerifyKey();
  if (!verifier.vrfVerify(message, List<int>.from(vrfResult),
      context: context, extra: extra)) {
    throw const MessageException(
        'The created vrfSign does not pass verification.');
  }
  return vrfResult;
}