This project is a Rust implementation of {t,n}-threshold ECDSA (elliptic curve digital signature algorithm).
Threshold ECDSA includes two protocols:
- Key Generation for creating secret shares.
- Signing for using the secret shares to generate a signature.
ECDSA is used extensively for crypto-currencies such as Bitcoin, Ethereum (secp256k1 curve), NEO (NIST P-256 curve) and much more. This library can be used to create MultiSig and ThresholdSig crypto wallet. For a full background on threshold signatures please read our Binance academy article Threshold Signatures Explained.
The library was built with four core design principles in mind:
- Multi-protocol support
- Built for cryptography engineers
- Foolproof
- Black box use of cryptographic primitives
To learn about the core principles as well as on the audit process and security of the library, please read our Intro to multiparty ecdsa library blog post.
The library implements three different protocols for threshold ECDSA. The protocols presents differnt tradeoffs in terms of parameters, security assumptions and efficiency.
Protocol | High Level code |
---|---|
Lindell 17 [1] | Gotham-city (accepted to CIW19) is a two party bitcoin wallet, including benchmarks. KMS is a Rust wrapper library that implements a general purpose two party key management system. thresh-sig-js is a Javascript SDK |
Gennaro, Goldfeder 19 [2] (video) | tss-ecdsa-cli is a wrapper CLI for full threshold access structure, including network and threshold HD keys (BIP32). See Demo in this library to get better low level understanding |
Castagnos et. al. 19 [3] | WIP, Currently enabled as a feature in this library. To Enable build with --features=cclst . |
The following steps are for setup, key generation with n
parties and signing with t+1
parties.
-
We use shared state machine architecture (see white city). The parameters
parties
andthreshold
can be configured by changing the file:param
. a keygen will run withparties
parties and signing will run with any subset ofthreshold + 1
parties.param
file should be located in the same path of the client softwares. -
Install Rust. Run
cargo build --release --examples
(it will build into/target/release/examples/
) -
Run the shared state machine:
./sm_manager
. Currently configured to be in127.0.0.1:8001
, this can be changed inRocket.toml
file. TheRocket.toml
file should be in the same folder you runsm_manager
from.
run gg18_keygen_client
as follows: ./gg18_keygen_client http://127.0.0.1:8001 keys.store
. Replace IP and port with the ones configured in setup. Once n
parties join the application will run till finish. At the end each party will get a local keys file keys.store
(change filename in command line). This contain secret and public data of the party after keygen. The file therefore should remain private.
Run ./gg18_sign_client
. The application should be in the same folder as the keys.store
file (or custom filename generated in keygen). the application takes three arguments: IP:port
as in keygen, filename
and message to be signed: ./gg18_sign_client http://127.0.0.1:8001 keys.store "KZen Networks"
. The same message should be used by all signers. Once t+1
parties join the protocol will run and will output to screen signatue (R,s).
Run ./run.sh
(located in /demo
folder) in the main folder. Move params
file to the same folder as the excutables (usually /target/release/examples
). The script will spawn a shared state machine, clients in the number of parties and signing requests for the threshold + 1
first parties.
sm_manager
rocket server runs in production mode by default. You may modify the ./run.sh
to config it to run in different environments. For example, to run rocket server in development:
ROCKET_ENV=development ./target/release/examples/sm_manager
A 5 parties setup with 3 signers (threshold = 2) |
The contribution workflow is described in CONTRIBUTING.md, in addition the Rust utilities wiki contains information on workflow and environment set-up.
Multi-party ECDSA is released under the terms of the GPL-3.0 license. See LICENSE for more information.
Feel free to reach out or join the KZen Research Telegram for discussions on code and research.
[1] https://eprint.iacr.org/2017/552.pdf