BLS signature for Node.js by WebAssembly for Ethereum 2.0
npm install bls-eth-wasm
BLS_ETH=1 for Ethereum 2.0 spec.
{G1,G2}::isValidOrder()
bls.multiVerify to verify all {sigs, pubs, msgs}.
setETHmode(bls.ETH_MODE_DRAFT_07) is default mode
v0.4.2 breaks backward compatibility of the entry point.
const bls = require('bls-eth-wasm')
const bls = require('bls-eth-wasm/browser')
bls.init(bls.BLS12_381)
`
(old) The new eth2.0 functions are supported. This mode will be removed in the future.
Init as the followings:
`
bls.init(bls.BLS12_381)
`
then, you can use the following functions.
bls-eth-wasm | eth2.0 spec name|
------|-----------------|
SecretKey::sign|Sign|
PublicKey::verify|Verify|
Sign::aggregate|Aggregate|
Sign::fastAggregateVerify|FastAggregateVerify|
Sign::aggregateVerifyNoCheck|AggregateVerify|
The size of message must be 32 byte.
Check functions:
- verifySignatureOrder ; make deserialize check the correctness of the order
- Sign::isValidOrder ; check the correctness of the order
- verifyPublicKeyOrder ; make deserialize check the correctness of the order
- PublicKey::isValidOrder ; check the correctness of the order
- areAllMsgDifferent ; check that all messages are different each other
see bls
How to build src/bls_c.js
Install Emscripten.
`
cd src
git submodule update --init
make
`
For Node.js
node test.js
Browser demo
see bls-demo.
See browser/readme.md to make browser/bls.js.
for React
`
const bls = require('bls-eth-wasm/browser')
``