Crates.io | npvdkgrs |
lib.rs | npvdkgrs |
version | 0.1.0 |
source | src |
created_at | 2024-12-02 16:43:54.227728 |
updated_at | 2024-12-02 16:43:54.227728 |
description | Single Round Non-interactive publicly verifiable distributed key generation and resharing algorithm over BLS12-381 |
homepage | https://orehub.flake.lol |
repository | https://github.com/shekohex/orehub.git |
max_upload_size | |
id | 1468898 |
size | 165,193 |
Non-interactive publicly verifiable distributed key generation and resharing algorithm over BLS12-381
This library implements a non-interactive publicly verifiable distributed key generation (DKG) and key resharing protocol using the BLS12-381 pairing-friendly elliptic curve. It is built using the Arkworks library for elliptic curve cryptography.
The protocol allows a group of participants to jointly generate a shared public key and corresponding private key shares, without requiring interactive communication rounds. It also supports resharing to change the set of participants or threshold.
Key features:
Add this to your Cargo.toml
:
[dependencies]
npvdkgrs = "0.1.0"
use ark_std::UniformRand;
use npvdkgrs::{keygen, party::KeysharePackage, Keypair, PublicKey};
async fn run_dkg(participants: &[PublicKey], threshold: u16) -> Result<KeysharePackage, Error> {
let mut rng = rand::thread_rng();
let my_keypair = Keypair::rand(&mut rng);
let tracer = None;
let pkg = keygen::run(
&mut rng,
tracer,
&my_keypair,
participants,
threshold,
party
).await?;
Ok(pkg)
}
use npvdkgrs::{sign, Signature};
async fn sign_message(
keypair: &Keypair,
pkg: &KeysharePackage,
participants: &[PublicKey],
message: &[u8],
) -> Result<Signature, Error> {
let sig = sign::run(
None,
keypair,
pkg,
participants,
message,
party
).await?;
Ok(sig)
}
use npvdkgrs::Signature;
fn verify_signature(signature: &Signature, message: &[u8], public_key: &PublicKey) -> bool {
signature.verify(message, public_key)
}
std
: Use the Rust standard library (enabled by default)parallel
: Enable parallel computation optimizations using Rayonasm
: Use assembly optimizations for improved performanceprint-trace
: Print debug traces for development and troubleshootinggetrandom
: Enable getrandom feature for secure random number generationstate-machine
: Enable state machine for round-based protocolsThe security of this protocol relies on the following assumptions:
For more details on the security proofs and assumptions, please refer to the NPVDKGRS paper.
Benchmarks for different participant counts and thresholds:
Participants | Threshold | Key Generation | Signing |
---|---|---|---|
3 | 2 | 64ms | TBD |
5 | 3 | 186ms | TBD |
8 | 5 | 550ms | TBD |
10 | 6 | 950ms | TBD |
12 | 8 | 1.2s | TBD |
15 | 10 | 3.0s | TBD |
18 | 12 | 5.1s | TBD |
Note: These benchmarks were run on a machine with M1 Macbook PRO. Your results may vary, see benches dir
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Please make sure to update tests as appropriate and adhere to the existing coding style.
If you find a bug or have a feature request, please open an issue on GitHub.
This project is licensed under either of
at your option.
The protocol is based on the paper:
This project makes use of the following libraries:
We thank the authors and contributors of these projects for their valuable work.