Core Pillars
Backdit separates two independent roles inside every daemon:
- Client / Owner (
vault/,controller/): Strips, compresses, encrypts, packs, and Reed-Solomon encodes backups; runs Sentinel Merkle audits; executes local-first or8-of-14repairs; and publishes two-tier Recovery Capsules. - Host / Provider (
storage/,network/protocol/host/): Verifies peer identity and Proof-of-Possession, seals incoming shards to the owner’s X25519 key via RFC 9180 HPKE inside locked RAM, answers64 KiBMerkle audit challenges, and enforces bilateralGiB-hourquotas and garbage collection.
Subsystem Map
Section titled “Subsystem Map”| Pillar | Subsystem | Key Primitives & Cadence |
|---|---|---|
| 1. Vault & Erasure | Client crypto, small-file packing & host memory sealing | 64 MiB stripes, Zstd level 3, XChaCha20-Poly1305, RS 8+6, SYMPACK2 (<= 256 files), RFC 9180 HPKE in OS-locked, zeroized LockedBuffer (mlock/VirtualLock) |
| 2. P2P Transport | Dual-stack QUIC/TCP mesh & NAT traversal | libp2p 0.57.1 (QUIC + TCP/Noise/Yamux), Kademlia DHT, AutoNAT, UPnP, DCUtR, signaling-only Circuit Relay v2 (256 KiB / 120s), 64-entry reliable peer cache |
| 3. Bilateral Reciprocity | Tokenless per-partner GiB-hour ledgers |
Zero-sum i128 byte-seconds per partner, temporary 512 MiB / 5% bootstrap pool, 48 sticky partners, 14 distinct accounts with observed network diversity (<= 2 per public /24 or /48 where applicable), [[economy.trusted_accounts]] |
| 4. Sentinel Audits | Risk-tiered Proof-of-Storage watchdogs | 10m cycle, 64 KiB Merkle proofs (Degraded 30m, New Host 4h, Trusted 12h), +1 pass / -10 bad proof / 0 unreachable timeout, local-only bans |
| 5. Self-Healing & Journals | Urgency repair queue & zero-WAN rebuilds | 2 checks 30s apart, 60s Critical / 5m Urgent / 30m Watch / 24h Healthy, TABLE_LOCAL_SOURCES 0 B WAN repair before 8-of-14 P2P fallback, 2-phase crash journals |
| 6. Garbage Collection | Disk safety & reclaim valves | 15m boot delay then 24h loop, 85% -> 70% temporary trial reclaim (>= 30d zero-reciprocity debt), 90% -> 80% stale non-creditor valve (>= 60d inactive); creditors, trusted accounts, and Recovery Capsules never evicted |
| 7. Cold Recovery | 24-word BIP-39 clean-machine restore | <= 1 MiB Root Index (BKDTCAP1) + 2 MiB RS 8+6 segments (16 deltas -> Base), 2-step sequence/confirming-host check, atomic redb hydration |
| 8. Bandwidth & Transfers | 4-lane token buckets & Direct Local-Path | Separate upload, download, repair (2 MiB/s), and audit (512 KiB/s) limiters, off-peak schedules, metered bypass for <= 9 shards, hedged 9-request retrieval |
| 9. Storage Engine | Embedded ACID DB & atomic shard store | redb v5 (Durability::Immediate critical commits, 250ms soft-state flush), postcard BACKDIT1 envelopes (16 MiB cap), NTFS-safe 256-bucket temp -> fsync -> hard_link |
| 10. Control Plane & UI | Local REST API, embedded SPA & CLI | 127.0.0.1:9011, constant-time 32-byte Bearer auth, #code= launch exchange, Simple/Advanced UI, /healthz, /metrics/prometheus |
| 11. Runtime Foundation | Config, worker pools & panic-free guards | #![cfg_attr(not(test), deny(clippy::unwrap_used, clippy::expect_used, clippy::panic))], WorkerSet CPU isolation, 6h binary self-check |
On-Disk & Wire Hygiene
Section titled “On-Disk & Wire Hygiene”- All persisted
redbvalues, recovery capsules, packs, and/backdit/placement-stream/1.0.0(BKDTNET1) control frames serialize viapostcardwith explicit pre-decode size bounds and trailing-byte checks. - All critical mutations (file manifests, placement journals, bilateral ledgers, recovery hydration) commit via
redbDurability::Immediate, while soft telemetry flushes asynchronously without blocking P2P streams.