Synapses
A synapse is a persistent, stateful, weighted connection between two NTL nodes. Synapses are the edges in the neural graph — they determine how signals flow through the network.How Synapses Differ from Connections
| Property | HTTP Connection | WebSocket | NTL Synapse |
|---|---|---|---|
| State | Stateless | Session state | Weighted, learning |
| Lifetime | Per-request | Session duration | Persistent, evolving |
| Direction | Client → Server | Bidirectional | Bidirectional |
| Adaptation | None | None | Strengthens/weakens with use |
| Memory | None | In-memory only | Persisted to SiafuDB |
Synapse Structure
Synapse Lifecycle
1. Discovery
Nodes discover potential synapse partners through:- Bootstrap nodes — Well-known entry points that introduce new nodes to the network
- Signal traces — Signals carry their path; receiving nodes can form synapses with upstream nodes
- Discovery signals — Nodes broadcast capability announcements
2. Handshake
When two nodes decide to form a synapse, they perform a handshake:- Exchange node identities and capabilities
- Negotiate transport binding (QUIC preferred, TCP fallback)
- Exchange cryptographic material via the pluggable crypto module
- Establish initial weight (typically 0.1)
3. Active State
An active synapse transmits signals bidirectionally. With each successful signal transmission:- Weight increases by a configurable delta
- Latency statistics update
- The synapse is marked as recently active
4. Strengthening
Weight increases when:- Signals are successfully transmitted and acknowledged
- High-weight signals traverse the synapse
- The remote node provides valuable responses (as determined by the application layer)
5. Weakening
Weight decreases when:- Time passes without signal activity (decay)
- Signals fail or time out
- The remote node becomes unreliable
6. Dormancy
When a synapse’s weight drops below the dormancy threshold (configurable, default 0.01), it enters a dormant state. Dormant synapses:- Stop actively transmitting signals
- Retain their state in SiafuDB
- Can be reactivated if the remote node sends a signal
7. Pruning
After a configurable dormancy period (default: 7 days), dormant synapses are pruned — their state is archived and the connection resources are released.Transport Bindings
Synapses are transport-agnostic. The actual bytes move over a configurable transport layer:| Transport | Use Case | Properties |
|---|---|---|
| QUIC | Default for internet | Multiplexed, encrypted, low latency |
| TCP | Fallback | Reliable, widely supported |
| Unix Socket | Same-machine nodes | Zero network overhead |
| Bluetooth LE | Proximity mesh | Offline-capable, IoT |
| Custom | Specialized | Application-defined |
Synapse Topology
The collection of all synapses in the network forms the synapse topology — a weighted, directed graph. This topology is:- Self-organizing — No central authority defines it
- Adaptive — It reshapes based on actual signal patterns
- Resilient — Node failures cause local topology adjustment, not global disruption
- Observable — Nodes can inspect their local topology for monitoring and debugging
Local vs Global Topology
No single node knows the full network topology. Each node maintains knowledge of:- Its direct synapses (immediate connections)
- Nearby topology (2-3 hops, learned through signal traces)
- Bootstrap references (known stable nodes for re-entry)