atms

Crates.ioatms
lib.rsatms
version0.1.0
sourcesrc
created_at2022-04-12 13:40:04.60963
updated_at2022-04-12 13:40:04.60963
descriptionAn Ad-hoc Threshold MultiSignature primitive on Bls12-381.
homepage
repositoryhttps://github.com/input-output-hk/atms-sidechains
max_upload_size
id566437
size150,855
IƱigo Querejeta Azurmendi (iquerejeta)

documentation

README

Ad-hoc Threshold Multi-Signatures CI workflow crates.io

Proof of Concept implementation. This crate is ongoing work, has not been audited, and API is by no means final. Do not use.

A Rust implementation of ATMS signatures

atms implements Ad-Hoc Threshold MultiSignatures (ATMS) implementation using Boldyreva multi signature scheme as described in Section 5.2 of the Proof-of-Stake Sidechains by Gazi, Kiayias and Zindros. Elliptic curve cryptography, and basic signature procedures are performed using the blst library by supranational which implements BLS signatures over curve BLS12-381.

The library exposes a C API for facilitating its usage with other languages.

ATMS C library Usage

Environment

Compiling and testing the C library requires a working installation of clang and gtest. To do so, one can check the documentation of your package-manager for system-dependent install instructions.

Note: For MacOS I made it work by adding -std=c++<VERSION> to the clang command below, after installing gtest as specified here. <VERSION> needs to be 11 or higher.

Compiling the library and header file

First, one needs to compile the library running:

cargo build --release

Then, we need to build the header files using cbindgen. For this, first install cbindgen:

cargo install cbindgen

and then build the header file by running the following command from the parent directory (nightly is required):

rustup run nightly cbindgen ./ --config cbindgen.toml --crate atms --output target/include/atms.h

Running tests

For running rust tests, simply run (recommended use of --release, otherwise it takes a while):

cargo test --release

For the c-tests, we first build the test executable. First enter the c-tests folder, and then run:

clang -x c++ tests.c stms.c atms.c -g -o tests -L ../target/release -lmithril -lstdc++ -lgtest -lgtest_main

NOTE: Do not use g++, it does compile but leads to segfault when running the test.

To execute the tests:

./tests
[==========] Running 5 tests from 2 test suites.
[----------] Global test environment set-up.
[----------] 3 tests from atms
[ RUN      ] atms.produceAndVerifyAggregateSignature
[       OK ] atms.produceAndVerifyAggregateSignature (27 ms)
[ RUN      ] atms.testingErrors
[       OK ] atms.testingErrors (29 ms)
[ RUN      ] atms.serdeAtms
[       OK ] atms.serdeAtms (14 ms)
[----------] 3 tests from atms (71 ms total)

[----------] 2 tests from multisig
[ RUN      ] multisig.produceAndVerifyMultiSignature
[       OK ] multisig.produceAndVerifyMultiSignature (2 ms)
[ RUN      ] multisig.serdeMultiSignature
[       OK ] multisig.serdeMultiSignature (2 ms)
[----------] 2 tests from multisig (4 ms total)

[----------] Global test environment tear-down
[==========] 5 tests from 2 test suites ran. (76 ms total)
[  PASSED  ] 5 tests.
Commit count: 54

cargo fmt