Key Generation

Key Generation takes place one time. At the end of that interactive protocol both parties have computed their secret shards which will be used during the signature computation later on. There is no further need to put shards on the network again other than using them during sign phase. The protocol for key generation is described in section 3.2 https://eprint.iacr.org/2017/552.pdf.

Messages between parties are sent within a secure authenticated channel already established between the parties. The messages per se do not expose private information during key generation

In addition, the two parties must agree on who is party 1, and who is party 2 before beginning the key generation steps.

// Generate a random session id.
let session_id = SessionId::random();

// Generate two random secret values for participants. 
let x1 = BigInt::sample(256);
let x2 = BigInt::sample(256);

// Create keygen instances for each participant.
let p1 = P1Keygen::new(session_id);
let p2 = P2Keygen::new(session_id);

// Round 1
let (p1, msg1) = p1.process(())?;
let (p2, msg2) = p2.process(msg1)?;

// Round 2
let (keyshare1, msg3) = p1.process(msg2)?;
let keyshare2 = p2.process(msg3)?;

// Distributed key generation is complete. Generated (keyshare1, keyshare2)
assert!(keyshare1.public_key == keyshare2.public_key);

Last updated