Code Monkey home page Code Monkey logo

skalenetwork / libbls Goto Github PK

View Code? Open in Web Editor NEW
138.0 11.0 45.0 31.65 MB

Solidity-compatible BLS signatures, threshold encryption, distributed key generation library in modern C++. Actively maintained and used by SKALE for consensus, distributed random number gen, inter-chain communication and protection of transactions. BLS threshold signatures can be verified in Solidity, and used as random beacon (common coin)

Home Page: https://skale.space

License: GNU Affero General Public License v3.0

CMake 5.16% C++ 90.47% Shell 1.12% Python 1.88% Sage 1.10% C 0.27%
cryptography bls-signature threshold-cryptography distributed-key-generation threshold-signatures threshold-encryption dkg solidity common-coin bls

libbls's Introduction

libBLS: a C++ library for BLS Threshold Signatures

Build and test libBLS codecov CII Best Practices Discord

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:

  1. Key generation
  2. Hashing
  3. Signing
  4. 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:

  1. Key generation
  2. Encryption
  3. Decryption
  4. 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.

Discord

Otherwise see our CONTRIBUTING.md for more information.

License

License

Copyright (C) 2018-present SKALE Labs

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.