Kapnet — Bitcoin-Anchored Coordination Supersubstrate

title: Kapnet — Bitcoin-Anchored Coordination Supersubstrate created: 2026-06-01 updated: 2026-06-08

title: Kapnet — Bitcoin-Anchored Coordination Supersubstrate created: 2026-06-01 updated: 2026-06-08 type: entity tags: [substrate, bitcoin, nostr, braid, protocol, coordination] sources: []

Kapnet — Bitcoin-Anchored Coordination Supersubstrate

Source: Architecture packet from previous OWL session (2026-07-15) Repo: /media/user/6E45-1E47/untitled folder/kapnet/ (44 Rust crates) Handoff: /media/user/6E45-1E47/untitled folder/handoff/HANDOFF.md

What Is Kapnet?

Kapnet is a Bitcoin-anchored coordination supersubstrate — a protocol and software system for deterministic institutional activity. It sits on top of Bitcoin (observing but not modifying consensus) and lets organizations coordinate through structured message objects called TXXMs.

Core Concepts

Term Definition
TXXM Transaction-like activity envelope — the fundamental message unit
KOR Context-bearing operational domain (a namespace with grammar and governance), levels k-2 to k+4
KScript/KVM Deterministic execution environment for TXXM logic (10 opcodes: Push/Pop/Dup/Eq/Neq/Jmp/JmpIf/LoadField/Assert/Emit/Halt)
Braid Non-linear partially ordered state graph (like a DAG) of candidate state objects
Knot Checkpoint object that ties braid tips into canonical views
Weakwork Lightweight attention/work scoring (nonce search, difficulty bits)
Knot Selection Deterministic canonical choice: highest weakwork_score → most TXXMs → lowest knot_id hash

Architecture: 4-Node Distributed Braid

HermQube (coordinator)
  ├── Hermes Alpha   → kapnetd (session: alpha)
  ├── Hermes Beta    → kapnetd (session: beta)
  ├── Hermes Gamma   → kapnetd (session: gamma)
  └── Hermes Delta   → kapnetd (session: delta)
                          ↓
                  Shared Nostr relays
              (relay.damus.io, nos.lol)

Each node:

  • Runs kapnetd with unique identity and config
  • Publishes TXXMs as Nostr events to shared relays
  • Receives peer TXXMs, processes through local node
  • Converges on heaviest braid via deterministic KnotSelector

Nostr Event Kinds

Kind Range Purpose
30000-30099 Raw TXXMs
30078 Peer discovery
30100-30199 Blob TXXMs
30300-30399 Knot commitments
30400-30499 Governance
30500-30599 Braid sync (tip exchange)

Gossip Protocol (GossipMessage types)

  • TxxmAnnounce — announce new TXXM (txxm_id, kind, kor_id)
  • BraidRequest — request braid state (since_height, limit)
  • BraidResponse — respond with braid state (tips, txxm_ids, height)
  • KnotAnnounce — announce new knot (knot_id, height, state_root, selected_tips)
  • TxxmRequest — request specific TXXMs by ID
  • TxxmResponse — respond with requested TXXMs
  • Heartbeat — peer liveness (braid_tip, knot_height, timestamp)

Conflict Resolution (KnotSelector)

When nodes process TXXMs in different order (fork):

  1. Highest weakwork_score (sum of peer heights)
  2. Tie-break: most TXXMs included
  3. Tie-break: lowest knot_id hash (deterministic)

IPC Protocol (Unix Socket, JSON lines)

# Submit TXXM
{"SubmitTxxm":{"txxm":{"type":"submission","action":"hello","target":"braid"},"source_kor":"alpha.root.kor"}}

# Build knot
{"BuildKnot":{}}

# Get state
{"GetState":{}}

# List TXXMs
{"ListTxxms":{"limit":10}}

Crate Structure (44 crates)

Foundation

  • kapnet-types — Core types: TxxmId, KorId, BlobId, ObjectId, SHA-256 hash, canonical serialization
  • kapnet-events — Event system (EventSource, RuntimeEvent)
  • kapnet-storage — Persistence (DaemonStateSnapshot, LocalKapnetStore)

Core Protocol

  • kapnet-core — TXXM model + validation (Validator, ValidationTrace)
  • kapnet-kvm — KScript virtual machine (10 opcodes, bounded execution)
  • kapnet-kor — KOR registry and routing (7 KOR levels k-2 to k+4)
  • kapnet-metering — Economics (postage, burn, bond, stake)
  • kapnet-blob — Blob creation/validation (Blob, BlobAttestation)
  • kapnet-weakwork — Lightweight scoring (nonce search, difficulty)
  • kapnet-braid — Braid DAG (BraidCandidate, BraidNode, ConflictRecord)
  • kapnet-knot — Knot chain (Knot, KnotBuilder, KnotChain, KnotSelection)
  • kapnet-node — Full pipeline orchestrator (process_txxm, build_knot, replay)
  • kapnet-governance — Policy tables, roles, meta-discourse

Infrastructure

  • kapnet-libbitcoin — Bitcoin read-only observation (BitcoinObserver, OpReturnCandidate)
  • kapnet-nostr — Nostr adapter (identity, event encoding, gossip, sync, airgap, relay)
    • ws.rs — NostrWsAdapter (nostr-sdk 0.35, persistent keys)
    • gossip.rs — GossipMessage types, GossipState
    • sync.rs — BraidSynchronizer, KnotSelector
    • airgap.rs — Base64/hex copy/paste TXXM encoding

Applications

  • kapnetd — Daemon (lib.rs, ipc.rs, config.rs, state.rs, event_bus.rs, txxm.rs)
  • kapnet-cli — CLI (12 command groups)
  • kapnet-tui — Terminal UI
  • kapnet-web — Web interface
  • kapnet-studio — Development studio
  • kapnet-wizard — Setup wizard

Testing

  • kapnet-integration-tests
  • kapnet-progression-tests
  • kapnet-fuzz
  • kapnet-validation

Current State (from handoff)

What works

  • cargo build --workspace — clean build
  • cargo test — 77/77 tests pass (kapnet-libbitcoin, kapnet-nostr, kapnetd)
  • Bitcoin RPC adapter (bitcoincore-rpc 0.19)
  • Nostr WS adapter (nostr-sdk 0.35)
  • IPC server (Unix socket, JSON)
  • TXXM building, processing, knot building
  • Braid sync data structures (BraidSynchronizer, KnotSelector)
  • Event chain with hash linkage

All 4 Gaps Fixed (2026-03-06)

All critical gaps identified in the handoff have been resolved:

  • Gap 1 — NostrWsAdapter wired into Daemon::run() via self.nostr.use_ws branch. Commits: 002cdd0, 1e3f78e.
  • Gap 2 — Persistent Ed25519 keys via load_or_create_keys(path). 32-byte secret stored as hex in data_dir/keys.
  • Gap 3 — Braid tip gossip implemented. Kind 30500-30599 events for convergence.
  • Gap 4 — Node/Ledger sharing verified. Arc<RwLock<>> pattern confirmed correct.

Additional work:

  • target_kor routing added to TXXM processing
  • Kaplink TXXM type added
  • owns_kor() admission gate implemented
  • session_id added to NodeConfig

Convergence Verified

Convergence tested and working. Session ID: member.submission.room.kor. All 4 nodes converge to same braid tips and produce identical knot_id on BuildKnot.

Binary Distribution

Pre-built binary at /media/user/private/whonix-workspace/kapnetd/ (17MB + bundled libs). Runs on Whonix from SSD without building. Tested 2026-06-08: connects to Nostr relays (damus.io + nos.lol), processes events, creates Unix socket, populates event log.

Relevance to Pluronymous

Kapnet IS the instantiation of the bidirectional structured substrate. The “bidirectional” property is the gossip protocol — nodes both publish and consume TXXMs. The “structured” property is the TXXM envelope with KOR namespaces, KScript execution, and deterministic knot selection.

The HermQube + 3 MKCTP topology maps directly to the 4-node kapnetd deployment. Each Hermes instance IS a kapnetd node. The braid IS the shared state that converges across all agents.

The critical gaps identified in the handoff are the exact work HermQube needs to complete to demonstrate product-market fit.

Public Nostr Operations (2026-06-08)

Kapnet HQ Ambassador is the public-facing Nostr identity for Kapnet, operated by HermQube on QubesOS.

  • npub: npub1dwpeuyfujv27nsl3qma3stqckfwusu053ncasmaru0vsy69d9vdqrcau36
  • Identity: Separate from HermQube operational key. Stored at /home/user/.kapnet/identities/ambassador/
  • Skill: kapnet-nostr-public — governs all public Nostr operations
  • Architecture: Two-layer — public membrane (standard kinds 0,1,30078 on public relays) + private substrate (custom kinds 30000-30599 on private relay/IPC)
  • Constraint: Public relays reject custom event kinds. All public content uses standard kinds with structured JSON.
  • File vending: Store catalogs as kind-30078 replaceable events. Fulfillment via private relay or direct transfer.
  • Loops: Heartbeat (6h), content (daily), store sync (4h), convergence monitor (2h), weekly summary

Write a comment