Module threshold_ecdsa

Module threshold_ecdsa 

Source
Expand description

Threshold ECDSA for distributed signature generation.

This module implements a threshold ECDSA signature scheme where a group of n signers can jointly generate an ECDSA-style signature with only t signers participating (t-of-n threshold).

§Protocol Overview

  1. Setup: Distributed key generation to create key shares
  2. Signing Round 1: Each signer generates nonce shares
  3. Signing Round 2: Combine nonces and create partial signatures
  4. Aggregation: Combine partial signatures into final signature

§Example

use chie_crypto::threshold_ecdsa::*;

// Create a 2-of-3 threshold ECDSA setup
let threshold = 2;
let total = 3;

// Generate threshold key shares (in practice, use DKG)
let (group_pubkey, key_shares) = generate_threshold_keys(threshold, total).unwrap();

// Create signers from shares
let signer1 = ThresholdEcdsaSigner::from_share(threshold, total, key_shares[0].1.clone(), key_shares[0].2);
let signer2 = ThresholdEcdsaSigner::from_share(threshold, total, key_shares[1].1.clone(), key_shares[1].2);
let signer3 = ThresholdEcdsaSigner::from_share(threshold, total, key_shares[2].1.clone(), key_shares[2].2);

let message = b"Threshold ECDSA test";

// Signing Round 1: Generate nonce shares (only 2 signers participate)
let nonce1 = signer1.generate_nonce_share();
let nonce2 = signer2.generate_nonce_share();

let nonce_shares = vec![nonce1.public(), nonce2.public()];
let signer_ids = vec![1, 2];

// Signing Round 2: Create partial signatures
let partial1 = signer1.partial_sign(message, &nonce1, &nonce_shares, &signer_ids).unwrap();
let partial2 = signer2.partial_sign(message, &nonce2, &nonce_shares, &signer_ids).unwrap();

// Aggregate signatures
let signature = aggregate_threshold_signatures(&[partial1, partial2], &nonce_shares).unwrap();

// Verify
assert!(verify_threshold_ecdsa(&group_pubkey, message, &signature));

Structs§

NonceShare
Nonce share (ephemeral key for signing)
PublicNonceShare
Public nonce share
PublicShare
Public key share
SecretShare
Secret share for a threshold ECDSA signer
ThresholdEcdsaSignature
Final threshold ECDSA signature
ThresholdEcdsaSigner
Threshold ECDSA signer
ThresholdPartialSignature
Partial signature from a signer

Enums§

ThresholdEcdsaError

Functions§

aggregate_threshold_public_key
Aggregate public key shares into group public key
aggregate_threshold_signatures
Aggregate partial signatures into final signature
generate_threshold_keys
Generate threshold key shares using polynomial secret sharing
verify_threshold_ecdsa
Verify a threshold ECDSA signature

Type Aliases§

ThresholdEcdsaResult
ThresholdKeyShares
Type alias for threshold key generation result: (group_pubkey, key_shares)