libBLS: a C++ library for BLS Threshold Signatures
A mathematical library written in C++ that supports BLS threshold signatures, Distributed Key Generation (DKG) and Threshold Encryption (TE).
This libBLS library is developed by SKALE Labs and uses SCIPR-LAB's libff (see Libraries below).
An important note about production readiness
This libBLS library is still in active development and therefore should be regarded as alpha software. The development is still subject to security hardening, further testing, and breaking changes. This library has not yet been reviewed or audited for security. Please see SECURITY.md for reporting policies.
Overview
libBLS is a C++ library for BLS signatures and DKG that supports both threshold signatures and multi-signatures. Also it supports Threshold Encryption.
The signature process proceeds in 4 steps:
- Key generation
- Hashing
- Signing
- Verification
libBLS uses the alt_bn128 (Barreto-Naehrig curve) elliptic curve to be compatible with Ethereum's cryptography and provides 128 bits of security. Also, it provides opportunity to generate secret keys with DKG algorithm that supports the same curve.
libBLS for the most part corresponds to BLS signature standard. This work is still in progress and is going to be improved in the next couple of months.
Encryption process is running as follows:
- Key generation
- Encryption
- Decryption
- Verifying and combining shares
libBls uses the same alt_bn128 curve for threshold encryption as for BLS signatures.
Performance Specifications
libBLS allows to sign about 3000 messages per second on a single thread (Intelยฎ Coreโข i3-4160 CPU @ 3.60GHz). However, for our solution we have implemented constant time signing (0.01 sec for sign) to avoid timing attacks.
Installation Requirements
libBLS has been built and tested on Ubuntu and Mac.
GitHub is used to maintain this source code. Clone this repository by:
git clone https://github.com/skalenetwork/libBLS.git
cd libBLS
Building Dependencies
Ensure that required packages listed below are installed.
Build libBLS's dependencies by:
cd deps
bash ./build.sh
cd ..
Building from source on Mac
brew install flex bison libtool automake cmake pkg-config yasm
# Configure the project and create a build directory.
cmake -H. -Bbuild
# Build all default targets using all cores.
cmake --build build -- -j$(sysctl -n hw.ncpu)
Building from source on Ubuntu
Ensure that the required packages are installed by executing:
sudo apt-get update
sudo apt-get install -y automake cmake build-essential libprocps-dev libtool\
pkg-config yasm texinfo autoconf flex bison clang-format-6.0
Configure the project build with the following commands.
# Configure the project and create a build directory.
cmake -H. -Bbuild
# Build all default targets using all cores.
cmake --build build -- -j$(nproc)
Include the library
#include <libBLS.h>
Documentation
See docs for libBLS documentation.
Libraries
Contributing
If you have any questions please ask the development community on Discord.
Otherwise see our CONTRIBUTING.md for more information.
License
Copyright (C) 2018-present SKALE Labs