This repository contains compiled static library of https://github.com/herumi/bls with BLS_ETH=1
.
add SecretKey::GetSafePublicKey()
, which returns an error if sec is zeroMultiVerify
returns true only if all signatures are valid.SignHashWithDomain
, VerifyHashWithDomain
, VerifyAggregateHashWithDomain
are removed.EthModeDraft07
is added for draft-07.EthModeDraft06
is default. Call SetETHmode(EthModeDraft05)
to use older evrsion.SetETHmode(2)
has changed because of changing DST in hash-to-curve function.Init as the followings:
Init(BLS12_381)
then, you can use the following functions.
bls-eth-go-binary | eth2.0 spec name |
---|---|
SecretKey::SignByte | Sign |
PublicKey::VerifyByte | Verify |
Sign::Aggregate | Aggregate |
Sign::FastAggregateVerify | FastAggregateVerify |
Sign::AggregateVerifyNoCheck | AggregateVerify |
The size of message must be 32 byte.
Check functions:
deserialize
check the correctness of the orderdeserialize
check the correctness of the orderexamples/sample.go
go get github.com/herumi/bls-eth-go-binary/
go run examples/sample.go
The following steps are not necessary if you use compiled binary in this repository.
git clone --recursive https://github.com/herumi/bls-go-binary
cd bls-go-binary
#git submodule update --init --recursive
go test ./bls -bench "Pairing|Sign|Verify" -count=1
On x64 Linux,
make
Otherwise, clang is necessary to build ll files.
make CXX=clang++
make ARCH=x86_64 # for Intel mac
make ARCH=arm64 # for M1 mac
sudo apt-get install gcc-multilib
make -C src/bls -f Makefile.onelib build_aarch64 CXX=clang++ -j OUT_DIR=../..
make android
If you need a shared library, then after make clean
,
make android BLS_LIB_SHARED=1
make ios
Check llc --version
shows to support the target armv7a.
make ../mcl/src/base32.ll
env CXX=clang++ BIT=32 ARCH=arm _OS=android _ARCH=armeabi-v7a make MCL_USE_GMP=0 UNIT=4 CFLAGS_USER="-target armv7a-linux-eabi -fPIC"
armv7a-linux-eabi
.
env CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARM=7 GOARCH=arm go build examples/sample.go
env QEMU_LD_PREFIX=/usr/arm-linux-gnueabi qemu-arm ./sample
Check llc --version
shows to support the target mips.
make ../mcl/src/base32.ll
env CXX=clang++ BIT=32 ARCH=mipsel _OS=linux _ARCH=mipsle make MCL_USE_GMP=0 UNIT=4 CFLAGS_USER="-target mipsel-linux -fPIC"
mipsel-linux
.
env CC=mipsel-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build examples/sample.go
env QEMU_LD_PREFIX=/usr/mipsel-linux-gnu qemu-mipsel ./sample
#define BLS_ETH
#include <mcl/bn_c384_256.h>
#include <bls/bls.h>
MITSUNARI Shigeo(herumi@nifty.com)