BLS operations on BN254 in Solidity, including constant-time hash-to-curve using a the general Shallue-van de Woestijne encoding described in RFC9380 Section 6.6.1.
A lot of the code in this repository has been taken from these repositories:
- https://github.com/thehubbleproject/hubble-contracts
- https://github.com/ChihChengLiang/bls_solidity_python
- https://github.com/kilic/evmbls
- https://github.com/kevincharm/draft-irtf-cfrg-hash-to-curve
This repo also comes with an accompanying JS lib for creating signatures.
npm install --save @kevincharm/bls-bn254 ethers@^6 [email protected]
Hash a regular string
yarn bls:hash "message to hash"
Hash hex bytes
yarn bls:hash 0xdeadbeef