Playground
Two devices, real WebCrypto, entirely in your browser. Give each device keys, sign entries onto its chain, merge deterministically, then tamper one byte and watch verification name the exact broken entry. Nothing leaves this page.
1 · Identity Each device generates a non-extractable ECDSA P-256 keypair. The
deviceId is the SHA-256 of its public key, so identity is self-certifying:
no device can claim an id it does not hold the key for.Phone Device A
no key yet
Tablet Device B
no key yet
2 · Append & sign
appendEntry chains each record off the previous one (prev =
last hash, seq increments). signEntry signs the exact bytes
the hash covers. Both chains grow independently and offline.Phone chain 0 entries
No entries yet.
Tablet chain 0 entries
No entries yet.
3 · Merge
mergeLedgers unions both logs, dedupes by id, and returns one total order (seq, deviceId, ts, id), identical no matter the arrival order. verifyAndMergeLedgers then re-checks every chain and signature.4 · Tamper Pick a signed entry and flip one byte (we bump its
points by one) while
keeping its old hash and signature. Re-verify: the recomputed hash
diverges (broken_chain) and the signature no longer matches
(invalid_signature). The exact entry is named.This runs the real library (imported as @nkwib/ledger) against your
browser's WebCrypto. Read the tutorial to build the same thing
from scratch, or the conflict guide for what each flag means.