1.2.1 • Published 2 months ago

bls-eth-wasm v1.2.1

Weekly downloads
358
License
BSD-3-Clause
Repository
github
Last release
2 months ago

Build Status

BLS signature for Node.js by WebAssembly

Abstract

This module is built with BLS_ETH=1 for Ethereum 2.0 spec.

News

  • 2022/Jul/20 : 1.1 times improved
  • 2021/Aug/28 : improve performance of {G1,G2}::isValidOrder()
  • 2020/Nov/04 : break backward compatibility (bls.js is renamed to index.js)
    • use blsSetupFactory to make bls instance on browser (see the top of bls-demo.js)
  • 2020/Oct/01 : add bls.multiVerify to verify all {sigs, pubs, msgs}.
  • 2020/Jul/06 ; setETHmode(bls.ETH_MODE_DRAFT_07) is default mode
  • 2020/May/19 : Call bls.setETHmode(bls.ETH_MODE_DRAFT_07) once after bls.init() for BLS_ETH_MODE_DRAFT_07 defined at BLS12381G2XMD:SHA-256_SSWU_RO.
  • setETHmode() supports hash-to-curve defined at draft-irtf-cfrg-hash-to-curve at March 2020.

How to use

The version v0.4.2 breaks backward compatibility of the entry point.

  • Node.js : const bls = require('bls-eth-wasm')
  • React : const bls = require('bls-eth-wasm/browser')
  • HTML : <script src="https://herumi.github.io/bls-eth-wasm/browser/bls.js"></script>

Init as the followings:

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-wasmeth2.0 spec name
SecretKey::signSign
PublicKey::verifyVerify
Sign::aggregateAggregate
Sign::fastAggregateVerifyFastAggregateVerify
Sign::aggregateVerifyNoCheckAggregateVerify

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')

License

modified new BSD License http://opensource.org/licenses/BSD-3-Clause

Author

MITSUNARI Shigeo(herumi@nifty.com)

Sponsors welcome

GitHub Sponsor

1.2.1

2 months ago

1.2.0

2 months ago

1.1.1

5 months ago

1.1.0

9 months ago

1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago

0.4.8

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago