Home

Awesome

Build Status

bls for eth with compiled static library

This repository contains compiled static library of https://github.com/herumi/bls with BLS_ETH=1.

News

Init as the followings:

Init(BLS12_381)

then, you can use the following functions.

bls-eth-go-binaryeth2.0 spec name
SecretKey::SignByteSign
PublicKey::VerifyByteVerify
Sign::AggregateAggregate
Sign::FastAggregateVerifyFastAggregateVerify
Sign::AggregateVerifyNoCheckAggregateVerify

The size of message must be 32 byte.

Check functions:

How to run examples/sample.go

go get github.com/herumi/bls-eth-go-binary/
go run examples/sample.go

How to build the static binary

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

Linux, Mac, Windows(mingw64)

On x64 Linux,

make

Otherwise, clang is necessary to build ll files.

make CXX=clang++

Cross compile on macOS

make ARCH=x86_64 # for Intel mac
make ARCH=arm64  # for M1 mac

Cross compile of aarch64 on x64 Linux

sudo apt-get install gcc-multilib
make -C src/bls -f Makefile.onelib build_aarch64 CXX=clang++ -j OUT_DIR=../..

Android

make android

If you need a shared library, then after make clean,

make android BLS_LIB_SHARED=1

iOS

make ios

How to cross-compile for armeabi-v7a

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"

How to build sample.go for armeabi-v7a

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

How to cross-compile for mipsel

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"

How to build sample.go for mipsel

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

How to use the static library from C

#define BLS_ETH
#include <mcl/bn_c384_256.h>
#include <bls/bls.h>

Author

MITSUNARI Shigeo(herumi@nifty.com)

Sponsors welcome

GitHub Sponsor