Crates.io | atms |
lib.rs | atms |
version | 0.1.0 |
source | src |
created_at | 2022-04-12 13:40:04.60963 |
updated_at | 2022-04-12 13:40:04.60963 |
description | An Ad-hoc Threshold MultiSignature primitive on Bls12-381. |
homepage | |
repository | https://github.com/input-output-hk/atms-sidechains |
max_upload_size | |
id | 566437 |
size | 150,855 |
Proof of Concept implementation. This crate is ongoing work, has not been audited, and API is by no means final. Do not use.
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.
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.
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
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.