did-btcr2-js

ADR 002: JCS Canonicalization and the bip340-jcs-2025 Data Integrity Cryptosuite

Status: Accepted

Date: 2025-03-14

Commit: ce4da8d

Context

did:btcr2 requires a way to hash and sign DID documents (and updates to them) deterministically: two implementations producing different byte sequences for the same logical JSON object would break every signature verification across the ecosystem. Several canonicalization choices exist:

Separately, the signature layer needs to match W3C Verifiable Credentials Data Integrity conventions so that did:btcr2 DID documents can be consumed by existing VC verifiers. The cryptosuite choice pins the type of proof that gets attached to documents and updates.

Options considered

  1. RDFC + eddsa-rdfc-2022. Canonical VC-DM path. Requires Ed25519, not secp256k1: conflicts with Bitcoin-native key reuse.
  2. RDFC + a Bitcoin-friendly signature. No standard suite fits; we’d be inventing.
  3. JCS + BIP340 Schnorr, with a custom bip340-jcs-2025 suite name. Stays in JSON, reuses Bitcoin keys directly, matches W3C Data Integrity proof structure.

Decision

Option 3.

Messages across the aggregation subsystem, beacon signals, and signed updates all hash via canonicalHashBytes(document): canonicalize to SHA-256 to raw bytes.

Consequences

Positive

Negative

Explicitly accepted trade-offs

References