|
1 |
| -Mithril-stm   |
2 |
| -======= |
| 1 | +# Mithril-stm   |
3 | 2 |
|
4 |
| -### A rust implementation of Stake-based Threshold Multisignatures (STMs) |
5 |
| -`mithril-stm` implements Stake-based Threshold Multisignatures as described in the paper |
6 |
| -[Mithril: Stake-based Threshold Multisignatures](https://eprint.iacr.org/2021/916.pdf), by |
7 |
| -Pyrros Chaidos and Aggelos Kiayias. |
8 | 3 |
|
9 |
| -This library uses zkcrypto's implementation of curve [BLS12-381](https://github.com/zkcrypto/bls12_381) |
10 |
| -by default for implementing the multisignature scheme. One can optionally choose the |
11 |
| -[blst](https://github.com/supranational/blst) backend (by using the feature `blast`), |
12 |
| -but this is not recommended due to some [flaky tests](https://github.com/input-output-hk/mithril/issues/207) |
13 |
| -That are still being resolved. We |
14 |
| -currently only support the trivial concatenation proof system (Section 4.3) and do not support |
15 |
| -other proof systems such as Bulletproofs or Halo2. |
| 4 | +**This is a work in progress** :hammer_and_wrench:s |
16 | 5 |
|
17 |
| -This library provides implementations of: |
| 6 | +* `mithril-stm` is a Rust implementation of the scheme described in the paper [Mithril: Stake-based Threshold Multisignatures](https://eprint.iacr.org/2021/916.pdf) by Pyrros Chaidos and Aggelos Kiayias. |
| 7 | +* The BLS12-381 signature library [blst](https://github.com/supranational/blst) is used as the backend for the implementation of STM. |
| 8 | +* This implementation supports the _trivial concatenation proof system_ (Section 4.3). Other proof systems such as _Bulletproofs_ or _Halo2_ are not supported in this version. |
| 9 | +* We implemented the concatenation proof system as batch proofs, which provides a remarkable decrease in the size of individual signatures. |
| 10 | +* Protocol documentation is given in [Mithril Protocol in depth](https://mithril.network/doc/mithril/mithril-protocol/protocol/). |
18 | 11 |
|
19 |
| -* Stake-based Threshold Multisignatures |
20 |
| -* Key registration procedure for STM signatures |
21 | 12 |
|
22 |
| -The user-facing documentation for the above modules can be found [here](). |
| 13 | +* This library provides: |
| 14 | + * The implementation of the Stake-based Threshold Multisignatures |
| 15 | + * Key registration procedure for STM signatures |
| 16 | + * The tests for the library functions and STM scheme |
| 17 | + * Benchmark tests |
23 | 18 |
|
| 19 | +## Pre-requisites |
24 | 20 |
|
25 |
| -Disclaimer |
26 |
| -======= |
27 |
| -This crate is ongoing work, has not been audited, and it's API is by no means final. Do not use in production. |
| 21 | +**Install Rust** |
28 | 22 |
|
| 23 | +* Install a [correctly configured](https://www.rust-lang.org/learn/get-started) Rust toolchain (latest stable version). |
| 24 | +* Install Rust [Clippy](https://github.com/rust-lang/rust-clippy) component. |
| 25 | + |
| 26 | +## Download source code |
| 27 | + |
| 28 | +```bash |
| 29 | +# Download sources from github |
| 30 | +git clone https://github.com/input-output-hk/mithril |
| 31 | + |
| 32 | +# Go to sources directory |
| 33 | +cd mithril-stm |
| 34 | +``` |
| 35 | + |
| 36 | +## Compiling the library |
| 37 | +```shell |
| 38 | +cargo build --release |
| 39 | +``` |
| 40 | + |
| 41 | +## Running the tests |
| 42 | +For running rust tests, simply run (to run the tests faster, the use of `--release` flag is recommended): |
| 43 | +```shell |
| 44 | +cargo test --release |
| 45 | +``` |
| 46 | + |
| 47 | +## Running the benches |
| 48 | +```shell |
| 49 | +cargo bench |
| 50 | +``` |
| 51 | + |
| 52 | + |
| 53 | +## Example |
| 54 | + |
| 55 | +The following is a simple example of the STM implementation: |
29 | 56 |
|
30 |
| -# Example |
31 | 57 | ```rust
|
32 | 58 | use mithril_stm::key_reg::KeyReg;
|
33 | 59 | use mithril_stm::stm::{StmClerk, StmInitializer, StmParameters, StmSig, StmSigner};
|
@@ -112,17 +138,13 @@ fn test_full_protocol() {
|
112 | 138 | }
|
113 | 139 | }
|
114 | 140 | }
|
115 |
| - |
116 | 141 | ```
|
117 | 142 |
|
118 |
| -# Test and Benchmarks |
119 |
| -You can run tests of the library using `cargo test` (we recommend to use the `--release` flag, otherwise |
120 |
| -the tests might take a while) and run benchmarks using `cargo bench`. This crate uses `criterion` to run |
121 |
| -benchmarks. |
| 143 | +## Benchmarks |
122 | 144 |
|
123 |
| -We have run the benchmarks on an Apple M1 Pro machine with 16 GB of RAM, on macOS 12.6. |
| 145 | +Here we give the benchmark results of STM for size and time. We run the benchmarks on macOS 12.6 on an Apple M1 Pro machine with 16 GB of RAM. |
124 | 146 |
|
125 |
| -> Note that single signatures in batch compat version does not depend on any variable and <mark> the size of an individual signature is 176 bytes. </mark> |
| 147 | +Note that single signatures in batch compatible version do not depend on any variable and **the size of an individual signature is 176 bytes**. |
126 | 148 |
|
127 | 149 | ```shell
|
128 | 150 | +----------------------+
|
@@ -173,4 +195,3 @@ STM/Blake2b/Aggregation/k: 250, m: 1523, nr_parties: 2000
|
173 | 195 | STM/Blake2b/Verification/k: 250, m: 1523, nr_parties: 2000
|
174 | 196 | time: [13.944 ms 14.010 ms 14.077 ms]
|
175 | 197 | ```
|
176 |
| - |
|
0 commit comments