nx_fruiting.nx
buildroot/runtime/nx_fruiting.nx
about
nx_fruiting.nx -- content-addressed many-to-many broadcast (mushroom
fruiting body releasing spores).
Per user 2026-05-19: *"not just peer but we should also have torrent
aka the fruiting or whatever"* -- the underground mycelium (nx_hypha)
is point-to-point peer share; the ABOVE-GROUND fruiting body is the
many-to-many broadcast layer. Mushrooms release spores that disperse
via wind / water / animal / ballistospory; spores find new substrate
and germinate. Substrate equivalent: content-addressed fragment
dispersal where any peer holding fragment-N can serve it to any
receiver requesting fragment-N (BitTorrent-class but biology-named).
Per [[feedback-naming-discipline-no-industry-competitor-overlap]]:
"torrent" is a tech-product name we avoid. "Fruiting" is biology-
precise + unowned in tech-product space.
V1 ships sealed enum of dispersal modes + content-addressed fragment-
hash chain + per-fragment provenance + per-fruiting-body dispersal
budget (refuses amplification attacks).
Distinct from nx_hypha: hypha is RECIPROCITY-REQUIRED point-to-point
peer exchange; fruiting is one-to-many broadcast where receivers do
NOT need to share back (they may, but it's not required for
reception). Together they're the complete fungal-network
distribution architecture.
Composes:
nx_methyl -- each fragment carries Ed25519-signed methyl
marker; receiver verifies before germinating
nx_chromatin -- content-addressed block storage; fragments are
chromatin block hashes
nx_provenance_chain -- dispersal event chain-logged
nx_hypha -- peers can re-share fruiting fragments via hypha
point-to-point if desired (composes)
V1 ships state-machine + classification primitives. Actual byte-
transport for fragment delivery is caller-supplied (V2 wires
content-addressed BLAKE3 fragment chain + chromatin block fetch).
Gap list (V1 honest perf verdict):
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_fruiting_test.nx
structs
| 110 | struct NxFruitingBody |
consts
| 75 | const NX_FR_ANEMOPHILY: nx_int = 0 // wind: broadcast many-to-many |
| 76 | const NX_FR_HYDROPHILY: nx_int = 1 // water: sequential flow |
| 77 | const NX_FR_ZOOCHORY: nx_int = 2 // animal: carry-and-deliver |
| 78 | const NX_FR_BALLISTOSPORY: nx_int = 3 // active push |
| 79 | const NX_FR_AUTOCHORY: nx_int = 4 // local store + pull-available |
| 80 | const NX_FR_N_MODES: nx_int = 5 |
| 84 | const NX_FB_DEVELOPING: nx_int = 0 // gathering fragments |
| 85 | const NX_FB_READY_TO_DISPERSE: nx_int = 1 // complete + verified |
| 86 | const NX_FB_DISPERSING: nx_int = 2 // actively serving fragments |
| 87 | const NX_FB_QUIESCENT: nx_int = 3 // dispersal-budget exhausted |
| 88 | const NX_FB_FAILED: nx_int = 4 // refused/invalid |
| 89 | const NX_FB_N_STATES: nx_int = 5 |
| 93 | const NX_FR_OK: nx_int = 0 |
| 94 | const NX_FR_ERR_INVALID_MODE: nx_int = 1 |
| 95 | const NX_FR_ERR_INVALID_STATE: nx_int = 2 |
| 96 | const NX_FR_ERR_BUDGET_EXHAUSTED: nx_int = 3 |
| 97 | const NX_FR_ERR_FRAGMENT_OUT_OF_RANGE: nx_int = 4 |
| 98 | const NX_FR_ERR_NULL_INPUT: nx_int = 5 |
| 99 | const NX_FR_ERR_INVALID_TRANSITION: nx_int = 6 |
| 100 | const NX_FR_N_VERDICTS: nx_int = 7 |
| 123 | const NX_FB_BYTES: nx_int = 80 |
| 124 | const NX_FB_DEFAULT_BUDGET_MULTIPLIER: nx_int = 100 |
functions
| 128 | func nx_fr_mode_is_valid(m: nx_int) -> nx_int called by 1: main |
| 136 | func nx_fb_state_is_valid(s: nx_int) -> nx_int |
| 144 | func nx_fr_verdict_is_valid(v: nx_int) -> nx_int called by 1: main |
| 157 | func nx_fr_mode_is_broadcast(m: nx_int) -> nx_int called by 1: main |
| 168 | func nx_fr_mode_requires_active_sender(m: nx_int) -> nx_int called by 1: main |
| 175 | func nx_fb_state_is_serving(s: nx_int) -> nx_int called by 1: main |
| 182 | func nx_fb_state_is_terminal(s: nx_int) -> nx_int |
| 193 | func _fb_transition_allowed(from: nx_int, to: nx_int) -> nx_int |
| 216 | func nx_fb_new(body_id: nx_int, |
| 244 | func nx_fb_record_fragment_complete(b: *NxFruitingBody) -> nx_int called by 1: main |
| 256 | func nx_fb_is_complete(b: *NxFruitingBody) -> nx_int called by 1: main |
| 264 | func nx_fb_transition(b: *NxFruitingBody, to: nx_int) -> nx_int |
| 289 | func nx_fb_serve_fragment(b: *NxFruitingBody, called by 1: main |
| 313 | func nx_fb_remaining_budget(b: *NxFruitingBody) -> nx_int called by 1: main |
| 326 | func nx_fb_set_dispersal_budget(b: *NxFruitingBody, called by 1: main |