# NERVEs Protocol v1 ## Wire format HTTP requests use `POST`, `Content-Type: application/json`, and lowercase hex byte strings without `0x`. Requests: `/api/v1/open {}`; `/api/v1/commit {session_id_hex, commitment_hex}`; `/api/v1/reveal {session_id_hex, public_key_g1_compressed_hex, salt_hex}`; `/api/v1/attest {session_id_hex, q_hex}`; `/api/v1/seal {session_id_hex, aggregate_signature_g2_compressed_hex, committee_signature_g2_compressed_hex}`. `session_id`, `context`, `commitment`, `salt`, and `motion_nonce` are 32 bytes; compressed G1 is 48 bytes; compressed G2 is 96 bytes. G1 public keys and G2 signatures use canonical compressed BLS12-381 encodings and must be non-identity points in the prime-order subgroup. `context` is the decoded `pre_registration_context_hex` from OPEN; `motion_nonce` and `motion` are the decoded `motion_nonce_hex` and `motion_hex` from COMMIT. ## Parameters All hashes specified here are SHA-256. Multi-byte integers are big-endian. ```text COMMIT_DOMAIN = MSGCTF/ROSTER-SEAL/V1/COMMIT ROSTER_DOMAIN = MSGCTF/ROSTER-SEAL/V1/ROSTER FINAL_MESSAGE_DOMAIN = MSGCTF/ROSTER-SEAL/V1/FINAL-MESSAGE BASIC_NUL_DST = BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_ COMMITTEE_AUX_DOMAIN = MSGCTF/ROSTER-SEAL/V1/COMMITTEE-AUX ``` ## Reference checker `./nerves-check ` ```text input = session_id[32] || context[32] || raw_member_0[54] || ... || raw_member_4[54] raw_member_i = position_i_u8 || slot_id_i_u32_be || flags_i_u8 || public_key_g1_compressed_i[48], i = 0..4 in order input_hex = lowercase_hex(input) # input: 334 bytes; input_hex: 668 characters stdout = lowercase_hex(digest[32]) || "\n" # 64 lowercase hex characters, then newline ``` ## Commitment and signing `member_record_i` is the derived roster record for the member at position `i`. ```text commitment = SHA256(COMMIT_DOMAIN || session_id || public_key_g1_compressed || salt) final_roster_hash = SHA256(ROSTER_DOMAIN || session_id || context || 0x05 || member_record_0 || member_record_1 || member_record_2 || member_record_3 || member_record_4) final_message = FINAL_MESSAGE_DOMAIN || session_id || context || final_roster_hash || motion_nonce || len(motion)_u32_be || motion HashToG2(final_message): BASIC_NUL_DST, empty augmentation ``` ## Committee attestation REVEAL includes `committee_coefficients_hex = [d_0, d_1, d_2, d_3]`, four canonical big-endian scalars in the BLS12-381 scalar field. After REVEAL, one nonzero canonical scalar `q` can be submitted to ATTEST. The response contains seven compressed G2 signatures `T_0, ..., T_6` in `receipt_signature_g2_compressed_hex`. Repeating the same `q` returns the same receipts; a different `q` is rejected for that session. The seven receipts are honest-committee partial signatures over the four honest public keys `P_0, ..., P_3`: each `T_j` combines the four honest secret keys with `q`-dependent coefficients across two hash-to-curve bases. The response also includes a binding receipt `R` in `binding_receipt_g2_compressed_hex` (one compressed G2 point) that commits the honest aggregate key to the committee coefficients over `H_0`. ```text H_0 = HashToG2(final_message) H_1 = HashToG2(COMMITTEE_AUX_DOMAIN || final_message) D = d_0 P_0 + d_1 P_1 + d_2 P_2 + d_3 P_3 K = final-roster verification key (aggregate over all five members) P_a = the attacker's revealed public key ``` Both hash calls use `BASIC_NUL_DST` with empty augmentation. SEAL accepts only when both verdicts hold over `H_0`: ```text committee: e(D, H_0) = e(G, committee_signature) aggregate: e(K, H_0) = e(G, aggregate_signature) * e(P_a, committee_signature) ``` Each signature must be a canonical, non-identity, prime-order G2 point. The OPEN, COMMIT, REVEAL, ATTEST, and SEAL stages must occur in that order. Stage deadlines are 600 seconds after OPEN, 15 seconds after COMMIT, and 600 seconds after REVEAL or the first ATTEST. Repeating ATTEST does not extend a deadline.