Skip to main content
Version: 0.5.1

Schnorr Signatures

schnorr::verify_signature‚Äč

Verifier for Schnorr signatures over the embedded curve (for BN254 it is Grumpkin).

fn verify_signature(_public_key_x: Field, _public_key_y: Field, _signature: [u8; 64], _message: [u8]) -> Field

where _signature can be generated like so using the npm package @noir-lang/barretenberg

const { BarretenbergWasm } = require('@noir-lang/barretenberg/dest/wasm');
const { Schnorr } = require('@noir-lang/barretenberg/dest/crypto/schnorr');

...

const barretenberg = await BarretenbergWasm.new();
const schnorr = new Schnorr(barretenberg);
const pubKey = schnorr.computePublicKey(privateKey);
const message = ...
const signature = Array.from(
schnorr.constructSignature(hash, privateKey).toBuffer()
);

...
info

This is a black box function. Read this section to learn more about black box functions in Noir.