npvdkgrs

Crates.ionpvdkgrs
lib.rsnpvdkgrs
version0.1.0
sourcesrc
created_at2024-12-02 16:43:54.227728
updated_at2024-12-02 16:43:54.227728
descriptionSingle Round Non-interactive publicly verifiable distributed key generation and resharing algorithm over BLS12-381
homepagehttps://orehub.flake.lol
repositoryhttps://github.com/shekohex/orehub.git
max_upload_size
id1468898
size165,193
(shekohex)

documentation

README

npvdkgrs

Non-interactive publicly verifiable distributed key generation and resharing algorithm over BLS12-381

Overview

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:

  • Non-interactive DKG and resharing
  • Publicly verifiable
  • Secure against malicious adversaries
  • Built on Arkworks & round-based model
  • DKG is just one round
  • Resharing is just one round
  • Signing is just one round and is non-interactive
  • Asynchronous API

Installation

Add this to your Cargo.toml:

[dependencies]
npvdkgrs = "0.1.0"

Usage

Key Generation

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)
}

Signing

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)
}

Verification

use npvdkgrs::Signature;

fn verify_signature(signature: &Signature, message: &[u8], public_key: &PublicKey) -> bool {
    signature.verify(message, public_key)
}

Features

  • std: Use the Rust standard library (enabled by default)
  • parallel: Enable parallel computation optimizations using Rayon
  • asm: Use assembly optimizations for improved performance
  • print-trace: Print debug traces for development and troubleshooting
  • getrandom: Enable getrandom feature for secure random number generation
  • state-machine: Enable state machine for round-based protocols

Security Assumptions

The security of this protocol relies on the following assumptions:

  1. The hardness of the Discrete Logarithm problem in BLS12-381.
  2. The Random Oracle Model for hash functions.
  3. The honesty of at least t+1 participants, where t is the threshold.

For more details on the security proofs and assumptions, please refer to the NPVDKGRS paper.

Performance

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Please make sure to update tests as appropriate and adhere to the existing coding style.

Reporting Issues

If you find a bug or have a feature request, please open an issue on GitHub.

License

This project is licensed under either of

at your option.

References

The protocol is based on the paper:

NPVDKGRS: Non-Interactive Publicly Verifiable Distributed Key Generation and Resharing over BLS12-381

Acknowledgements

This project makes use of the following libraries:

We thank the authors and contributors of these projects for their valuable work.

Commit count: 21

cargo fmt