Giter Club home page Giter Club logo

bls-eth-wasm's Introduction

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

License

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

Author

MITSUNARI Shigeo([email protected])

Sponsors welcome

GitHub Sponsor

bls-eth-wasm's People

Contributors

herumi avatar johnta0 avatar dapplion avatar 9temare avatar igor-peregudov avatar volchunovich avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.