ECVRF Library
ECVRF TypeScript Library
A production-grade TypeScript implementation of Elliptic Curve Verifiable Random Function (ECVRF) using secp256k1, following RFC 9381 for suite ECVRF-SECP256k1-SHA256-TAI.
Features
- Standards-compliant ECVRF implementation (RFC 9381)
- secp256k1 curve support
- Deterministic, verifiable outputs
- Robust error handling
- Well-documented API
- Comprehensive test coverage
Installation
Usage Example
API Reference
generateVRFKeyPair()
– Generate a new ECVRF key pairproveVRF(privateKeyHex, alphaHex)
– Generate a proof for a messageverifyVRF(publicKeyHex, alphaHex, chunkedProof)
– Verify a proofvrfProofToHash(proofHex)
– Convert proof to deterministic hash- Utility:
hexToBytes
,bytesToHex
,utf8ToBytes
,concatHex
,padHex
,concatBytes
Use Cases
- Random beacon
- Provably fair games and lotteries
- Unpredictable but verifiable selections
- Cryptographic sortition
- Leader election in distributed systems
Development
- Node.js >= 16 required
- See Testing for test suite details
Security
- Secure your private keys
- Keep dependencies up to date
- Review code before production use
- Consider a security audit for critical applications
License
MIT License © 2025 Hemanth Krishna