| 1 | # Test vectors for cocktail-dkg |
| 2 | |
| 3 | Spec: <https://c2sp.org/cocktail-dkg> |
| 4 | |
| 5 | These are current as of v0.2.0 of the cocktail-dkg spec. |
| 6 | |
| 7 | ## Seed Derivation |
| 8 | |
| 9 | The test vectors are generated from a SHA256 hash of the spec co-maintainers' names: |
| 10 | |
| 11 | ```text |
| 12 | seed = SHA256("Daniel Bourdrez,Soatok Dreamseeker,Tjaden Hess") |
| 13 | = b171b6992cc6db1f40b18dd8b1361d642f013e4b1208a735259a516af60dcb68 |
| 14 | ``` |
| 15 | |
| 16 | All secret values are derived using a labeled hash with ciphersuite and threshold domain separation: |
| 17 | |
| 18 | ```text |
| 19 | derived_bytes = H(seed || ciphersuite_id || uint32_le(t) || uint32_le(n) || label) |
| 20 | ``` |
| 21 | |
| 22 | Where: |
| 23 | |
| 24 | - `H` is the ciphersuite's hash function |
| 25 | - `ciphersuite_id` is the ciphersuite identifier string |
| 26 | - `t` is the threshold (little-endian 32-bit unsigned integer) |
| 27 | - `n` is the number of participants (little-endian 32-bit unsigned integer) |
| 28 | - `label` is a human-readable ASCII string identifying the value |
| 29 | |
| 30 | ## Test Vector Types |
| 31 | |
| 32 | Each JSON file contains multiple test vectors: |
| 33 | |
| 34 | 1. **2-of-3 basic**: Standard 2-of-3 DKG with empty extension |
| 35 | 2. **3-of-5 basic**: Standard 3-of-5 DKG with empty extension |
| 36 | 3. **7-of-14 basic**: Standard 7-of-14 DKG with empty extension |
| 37 | 4. **2-of-3 with payload extension**: 2-of-3 DKG where each participant includes a |
| 38 | seed-derived payload, and the extension is a hash of all payloads |
| 39 | |
| 40 | ## JSON Structure |
| 41 | |
| 42 | Each vector includes: |
| 43 | |
| 44 | - `n`: Total number of participants |
| 45 | - `t`: Threshold |
| 46 | - `session_tag`: Application session tag used to derive the context (hex-encoded) |
| 47 | - `context`: Derived protocol context (hex-encoded) |
| 48 | - `extension`: Application-specific extension (hex-encoded, empty string if none) |
| 49 | - `payloads`: (Optional) Array of hex-encoded payloads for each participant |
| 50 | - `config`: Static keys for all participants |
| 51 | - `round1`: Ephemeral keys, VSS commitments, PoPs, PoP intermediate values, and encrypted shares |
| 52 | - `round2`: Secret shares and verification shares |
| 53 | - `round3`: Transcript hash and signatures |
| 54 | - `group_public_key`: Final group public key |
| 55 | - `recovery`: Recovery data for participant 1 in the 2-of-3 vectors |
| 56 | |
| 57 | Each `round1[*].pop_intermediate` object includes: |
| 58 | |
| 59 | - `message`: Raw PoP message `context || C_i || E_i` |
| 60 | - `nonce_input`: Input to the ciphersuite's deterministic nonce scalar derivation |
| 61 | - `nonce`: Reduced nonce scalar `k` |
| 62 | - `nonce_commitment`: Nonce commitment point `R = k * B` |
| 63 | - `challenge_input`: Input to the ciphersuite's challenge scalar derivation |
| 64 | - `challenge`: Reduced challenge scalar `c` |
| 65 | |
| 66 | For secp256k1, `nonce_input` and `challenge_input` are the expanded BIP-340 |
| 67 | tagged-hash inputs, `SHA256(tag) || SHA256(tag) || msg`. |
| 68 | |
| 69 | ## Ciphersuites |
| 70 | |
| 71 | | File | Ciphersuite | |
| 72 | |-----------------------------------------|----------------------------------| |
| 73 | | `cocktail-dkg-ristretto255-sha512.json` | COCKTAIL(Ristretto255, SHA-512) | |
| 74 | | `cocktail-dkg-ed25519-sha512.json` | COCKTAIL(Ed25519, SHA-512) | |
| 75 | | `cocktail-dkg-p256-sha256.json` | COCKTAIL(P-256, SHA-256) | |
| 76 | | `cocktail-dkg-secp256k1-sha256.json` | COCKTAIL(secp256k1, SHA-256) | |
| 77 | | `cocktail-dkg-ed448-shake256.json` | COCKTAIL(Ed448, SHAKE256) | |
| 78 | | `cocktail-dkg-jubjub-blake2b512.json` | COCKTAIL(JubJub, BLAKE2b-512) | |
| 79 | | `cocktail-dkg-pallas-blake2b512.json` | COCKTAIL(Pallas, BLAKE2b-512) | |