1.0.0 • Published 3 years ago

vrf-ts-256 v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

vrf-ts-256

ECVRF-SECP256K1-SHA256-TAI (draft-irtf-cfrg-vrf-04)

Remastering of this reference for full compability with witnet/vrf-solidity

Usage

const ecvrf = require('ecvrf-sha256-ts')

const keypair = ecvrf.keygen()
const proof = ecvrf.prove(keypair.secret_key, '73616d706c65')
const beta = ecvrf.verify(keypair.public_key.key, proof.pi, '73616d706c65');

/*
Using with truffle-contract for vrf-solidity
*/
const vrfContractInstance = await VRF.deployed()
await vrfContractInstance.verify(
    [keypair.public_key.x, keypair.public_key.y],
    [proof.decoded.gammaX, proof.decoded.gammaY, proof.decoded.c, proof.decoded.s]
    '73616d706c65'
)