Skip to content

Commit 59d876b

Browse files
committed
Update dkg verification documentation
1 parent 05d2335 commit 59d876b

File tree

1 file changed

+56
-16
lines changed

1 file changed

+56
-16
lines changed

doc/dkg_verification.md

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Purpose and Scope
66

7-
This specification provides a detailed framework for zero-knowledge (ZK) verification circuits within a Distributed Key Generation (DKG) protocol. It emphasizes precise cryptographic formulations to ensure the correctness and security of each verification step.
7+
This specification provides a framework for zero-knowledge (ZK) verification circuits within a Distributed Key Generation (DKG) protocol. It emphasizes cryptographic formulations to ensure the correctness and security of each verification step.
88

99
### Overview of Distributed Key Generation (DKG)
1010

@@ -22,9 +22,7 @@ The protocol ensures that:
2222
- The secret is generated according to Shamir's Secret Sharing scheme.
2323
- Any deviation — whether intentional or accidental — can be detected, and the malicious participant can be identified. Zero-knowledge proofs play a crucial role in enabling this detection without revealing any sensitive information exchanged during the process.
2424

25-
## 2. DKG Process Overview
26-
27-
### 2.0 High-Level Overview of Provable Distributed Key Generation (PDKG)
25+
## 2.0 High-Level Overview of Provable Distributed Key Generation (PDKG)
2826

2927
1. **Initialization (Public Setup Phase):**
3028
One participant initializes the session by publishing the setup on a shared, publicly accessible platform (e.g., a blockchain smart contract, shared database, or bulletin board).
@@ -86,7 +84,7 @@ Where:
8684
- \(a_{i,j} \in \mathbb{F}_q\): Random coefficients
8785
- \(f_i(x)\): Secret polynomial of \(P_i\)
8886

89-
The secret share of participant \(P_i\) is \(s_i = f_i(0) = a_{i,0}\).
87+
The secret sub share of participant \(P_j\) is \(s_{i,j} = f_i(j)\).
9088

9189
We define a verification vector \(\text{V}_i\) as:
9290
\[(\text{PK}(a_{i,0}), \dots, \text{PK}(a_{i,t}))\]
@@ -101,7 +99,7 @@ Published to a public board and signed with \(\text{AuthKey}_i\).
10199
Each \(P_i\) computes:
102100
\[s_{i,j} = f_i(j)\]
103101

104-
Sends to \(P_j\) along with \(\text{V}_i\), all signed with \(\text{AuthKey}_i\). The verification vector \(\text{V}_i\) allows \(P_j\) to verify that the received share \(s_{i,j}\) is consistent with the polynomial committed to by \(P_i\).
102+
Sends to \(P_j\) along with \(\text{V}_i\), all signed with \(\text{AuthKey}_i\). The verification vector \(\text{V}_i\) allows \(P_j\) to verify that the received share \(s_{i,j}\) is consistent with the polynomial committed to by \(P_i\) (\(P_i\) can take the \(C_i\) from the public board).
105103

106104
### 2.4 Share Verification
107105

@@ -131,7 +129,21 @@ Upon receiving \(s_{i,j}\) and \(\text{V}_i\) from \(P_i\), participant \(P_j\)
131129

132130
If a participant submits a share that cannot be verified or if there is insufficient evidence to validate its correctness, and malicious intent is suspected, then participant \(P_j\) should initiate a **challenge** against \(P_i\) on the public board.
133131

134-
The challenge must include an expiration timestamp. The response to the challenge should be **encrypted using ECDH** (Elliptic Curve Diffie-Hellman) with the `AuthKey`s of both participants. Here, we assume `AuthKey_i` and `AuthPK_i` are the private and public keys, respectively, of an ECDH key pair for participant \(i\). The shared secret is derived using \(P_i\)'s private key and \(P_j\)'s public key (or vice versa), and this shared secret is used to encrypt the response. ECDH is suitable here as it allows two parties to establish a shared secret over an insecure channel using their public keys.
132+
The challenge must include an expiration timestamp. The response to the challenge must be **encrypted using a deterministic ECDH scheme** based on the sender’s published verification vector.
133+
134+
Specifically:
135+
136+
- The verification vector \(\mathbf{V}_i\) (published by \(P_i\)) is **sorted deterministically**, for example, lexicographically by public key bytes.
137+
- The **last element** of this sorted vector is used for key agreement:
138+
- \(P_i\) uses the **private key** from their own last element.
139+
- \(P_j\) uses the **public key** from the corresponding last element of \(P_i\)'s vector.
140+
- They derive a shared secret using ECDH:
141+
\[
142+
K_{i,j} = \text{ECDH}(\text{PrivKey}_{i}^{\text{last}}, \text{PubKey}_{j}^{\text{last}})
143+
\]
144+
- This shared secret is passed through a key derivation function (e.g., HKDF) to obtain a symmetric key \(K_{\text{enc}}\).
145+
146+
This encryption scheme ensures that only the intended recipient (with access to the corresponding private key) can decrypt the response, while preserving deterministic behavior and cryptographic soundness necessary for verifiability and zero-knowledge applications.
135147

136148
If the challenge expires without a valid response, or if the response is invalid, the protocol can demonstrate misbehavior by \(P_i\), which may result in penalties (e.g., slashing). If the protocol fails, all participants can verify the failure based on the data recorded on the public board.
137149

@@ -140,8 +152,8 @@ The use of encryption and zero-knowledge proofs guarantees that sensitive inform
140152
### 2.5 Partial Key Generation
141153

142154
Each \(P_i\) computes their partial secret key \(S_i\) by summing the valid shares received from all other participants:
143-
\[S_i = \sum_{k=1}^{n} s_{k,i}\]
144-
where \(s_{k,i}\) is the share sent from \(P_k\) to \(P_i\).
155+
\[S_i = \sum_{j=1}^{n} s_{j,i}\]
156+
where \(s_{j,i}\) is the share sent from \(P_j\) to \(P_i\).
145157

146158
### 2.6 Finalization
147159

@@ -211,19 +223,47 @@ Once all valid signatures are collected, any participant (or a subset thereof) c
211223

212224
### Circuit 3: Malicious Encryption Detection
213225

214-
- **Objective**: Verify that encrypted shares sent from \(P_i\) to \(P_j\) decrypt correctly and correspond to valid shares as per \(P_i\)'s committed polynomial.
226+
- **Objective**:
227+
Verify that an encrypted share sent from \(P_i\) to \(P_j\) can be correctly decrypted using a shared key derived via ECDH and that the resulting plaintext corresponds to a valid share consistent with \(P_i\)'s committed polynomial.
215228

216229
- **Verification Steps**:
217-
1. **Key Derivation (ECDH)**:
218-
The shared secret \(K_{i,j}\) between \(P_i\) and \(P_j\) is derived using Elliptic Curve Diffie-Hellman. \(P_i\) uses their private ECDH key \(\text{AuthKey}_i\) and \(P_j\)'s public ECDH key \(\text{AuthPK}_j\) to compute \(K_{i,j}\). Similarly, \(P_j\) uses their private key \(\text{AuthKey}_j\) and \(P_i\)'s public key \(\text{AuthPK}_i\) to compute the same shared secret.
230+
231+
1. **Deterministic Key Derivation via ECDH**:
232+
- The vector \(\mathbf{V}_i\) is **sorted deterministically** (e.g., lexicographically by public key bytes).
233+
- The **last element** of the sorted verification vector is used for key agreement:
234+
- Participant \(P_i\) uses the **private key** from their own last element.
235+
- Participant \(P_j\) uses the **public key** from the corresponding last element of \(P_i\)'s vector.
236+
- They perform ECDH:
237+
\[
238+
K_{i,j} = \text{ECDH}(\text{PrivKey}_{i}^{\text{last}}, \text{PubKey}_{j}^{\text{last}})
239+
\]
240+
- The result is passed through a key derivation function (e.g., HKDF) to produce a symmetric key \(K_{\text{enc}}\) for encryption with a cipher like ChaCha20-Poly1305.
241+
242+
- This shared secret is used to derive a symmetric encryption key (e.g., via HKDF), which is then used with a cipher like ChaCha20 to encrypt:
243+
- The generation id
244+
- The share \(s_{i,j}\)
245+
- The \(\text{HASH}(n, t, \text{generation\_id}, \mathbf{V}_i)\)
246+
- \(\text{AuthPK}_i\)
247+
- \(\text{SIGN(AuthPK, HASH)}\)
248+
219249
2. **Decryption and Share Extraction**:
220-
The ciphertext containing the share \(s_{i,j}\) is decrypted using the derived shared secret \(K_{i,j}\) and the agreed-upon decryption algorithm.
250+
- Participant \(P_j\) derives the shared key:
251+
\[
252+
K_{j,i} = \text{ECDH}(\text{AuthKey}_j, \text{AuthPK}_i)
253+
\]
254+
- Since ECDH is symmetric, \(K_{i,j} = K_{j,i}\).
255+
- \(P_j\) uses the derived key to decrypt the ciphertext and extract the share \(s_{i,j}\) and accompanying data.
221256

222257
3. **Share Validation**:
223-
Apply the same validation logic as in **Circuit 1** to accept or reject the decrypted share. This includes checking commitment consistency (using \(C_i\) and \(V_i\)) and verifying that the decrypted share \(s_{i,j}\) satisfies the expected polynomial evaluation: \(\text{PK}(s_{i,j}) \stackrel{?}{=} p_i(j)\).
258+
- The circuit first proves that the correct decryption key was derived from the initial secrets using the specified ECDH protocol and verification vector.
259+
- Then, two possible outcomes are evaluated:
260+
1. If decryption fails (e.g., due to incorrect key derivation, incomplete or malformed ciphertext, or tampering), this constitutes a verifiable failure of proper encryption.
261+
2. If decryption succeeds but the decrypted share is inconsistent with the committed polynomial (e.g., does not satisfy the homomorphic evaluation check), the logic from **Circuit 1** is applied to prove inconsistency or misbehavior in the share itself.
262+
263+
- **Expected Output**:
264+
The circuit succeeds if the decrypted share can be verified as correct and consistent with the sender’s public commitments. Otherwise, it produces a verifiable contradiction, proving either encryption-level tampering or an invalid share.
265+
224266

225-
- **Expected Output**:
226-
The circuit fails if the decrypted share is invalid (doesn't match the committed polynomial) or inconsistent with the public commitments made by \(P_i\).
227267

228268
### Circuit 4: Successful Finalization
229269

0 commit comments

Comments
 (0)