niko_trust/testdata/vectors/pow_vectors.json
Niko Marmeladkov 20cc52c3a5 feat: network layer — PoW, checkpoint chain, gossip, light node, WS, delegation, rotation, BFT
- BLAKE3 keyed proof-of-work on object storage and auth challenges,
  with frozen vectors cross-checked against an independent Python
  reference implementing the single-block hash it needs.
- Sparse Merkle trie over object IDs: order-independent roots,
  inclusion and absence proofs (internal/smt).
- Signed checkpoint chain per relay: transport key amendment to INV-1,
  /v1/checkpoint/* and inclusion/absence proof endpoints, restart-safe
  epoch continuity (internal/checkpoint).
- Head gossip with TOFU pinning and equivocation detection; light node
  (cmd/lightnode) that stores no history: quorum of pinned relays,
  every served object proven against the agreed root, LRU disk cache.
- WebSocket streaming on relay and light node (coder/websocket):
  scoped channels mirroring REST, raw envelopes verified client-side;
  light node marks streamed objects unproven until checkpoint coverage.
- Protocol v1 additions: DelegationClaim tag 0x07 with deterministic
  chain resolution in verify.Graph, KeyRotationRequest/Confirm tags
  0x08/0x09 with hash-bound two-sided consent and Policy.RotationMaxAge;
  spec sections, frozen vectors appended byte-identically, Python
  reference extended.
- Optional permissioned BFT finality over gossip (internal/bft):
  prevote/precommit with quorum certificates verifiable offline.
- Quick wins: Policy.TrustedIssuers, per-type stored metrics,
  batch fetch, lexicographic lists with stable cursor pagination.
- Security review of the network layer (docs/SECURITY-REVIEW.md) with
  findings F-01..F-09; hub send/close race and unstable pagination
  fixed under review.

12 packages green, vet/gofmt clean, protocol fuzzing stable.
2026-08-25 20:38:40 +03:00

91 lines
3.5 KiB
JSON

{
"domain": "trust.n1ko.dev/pow/1",
"hash_spec": "BLAKE3_keyed(key, domain || target || counter_be); valid iff leading_zero_bits(sum) >= difficulty",
"max_difficulty": 30,
"vectors": [
{
"name": "put/key-seed01-target-seed02/diff1",
"key_hex": "0101010101010101010101010101010101010101010101010101010101010101",
"target_hex": "0202020202020202020202020202020202020202020202020202020202020202",
"difficulty": 1,
"counter": 0,
"sum_hex": "63369ce6bfc277ea69b9df45011189776b00463ce4fec6d449fff42bf0908113",
"leading_zero_bits": 1
},
{
"name": "put/key-seed01-target-seed02/diff4",
"key_hex": "0101010101010101010101010101010101010101010101010101010101010101",
"target_hex": "0202020202020202020202020202020202020202020202020202020202020202",
"difficulty": 4,
"counter": 1,
"sum_hex": "046831eba83ef2b46bbcf8a7a14f3831a55b5555d3be29d26f1fd2fd5767d891",
"leading_zero_bits": 5
},
{
"name": "put/key-seed01-target-seed02/diff8",
"key_hex": "0101010101010101010101010101010101010101010101010101010101010101",
"target_hex": "0202020202020202020202020202020202020202020202020202020202020202",
"difficulty": 8,
"counter": 277,
"sum_hex": "00fa52a4129d6db6729c75e22f8c72250bc268ac89061e1c1418862e62b91a24",
"leading_zero_bits": 8
},
{
"name": "auth/zero-target/diff8",
"key_hex": "0202020202020202020202020202020202020202020202020202020202020202",
"target_hex": "0000000000000000000000000000000000000000000000000000000000000000",
"difficulty": 8,
"counter": 343,
"sum_hex": "00f8503f1687fabdf8d0a73d12d5081b748cc87d2d9959154ff3d6cf69a5eb43",
"leading_zero_bits": 8
},
{
"name": "put/key-seed02-target-seed03/diff12",
"key_hex": "0202020202020202020202020202020202020202020202020202020202020202",
"target_hex": "0303030303030303030303030303030303030303030303030303030303030303",
"difficulty": 12,
"counter": 11745,
"sum_hex": "0009f60682638831f9fafee143bdccdbdf845b32f5658bf5d6d2a8e2341c440f",
"leading_zero_bits": 12
},
{
"name": "put/key-seed04-target-seed05/diff16",
"key_hex": "0404040404040404040404040404040404040404040404040404040404040404",
"target_hex": "0505050505050505050505050505050505050505050505050505050505050505",
"difficulty": 16,
"counter": 88240,
"sum_hex": "000008fed1164db13471bd3bc0721e83c5f643e3bb72c5dfad90c09e89d4c9ef",
"leading_zero_bits": 20
}
],
"rejects": [
{
"name": "counter-misses-threshold",
"key_hex": "0101010101010101010101010101010101010101010101010101010101010101",
"target_hex": "0202020202020202020202020202020202020202020202020202020202020202",
"difficulty": 8,
"counter": 278,
"reason": "leading_zero_bits < difficulty"
},
{
"name": "wrong-key",
"key_hex": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"target_hex": "0202020202020202020202020202020202020202020202020202020202020202",
"difficulty": 8,
"counter": 277,
"reason": "hash under a different key does not meet the target"
}
],
"config_rejects": [
{
"name": "difficulty-above-max",
"difficulty": 31,
"reason": "configuration above MaxDifficulty is clamped/rejected"
},
{
"name": "negative-difficulty",
"difficulty": -1,
"reason": "negative configuration is treated as disabled, never as a pass-all proof tier"
}
]
}