51 lines
1.2 KiB
Markdown
51 lines
1.2 KiB
Markdown
# Interconnections Guide
|
|
|
|
## Hypercore + Hyperswarm + Hyperdrive Stack
|
|
|
|
```
|
|
Hypercore (logs) → Hyperdrive (FS) → Hyperswarm (swarm)
|
|
↓ DHT announce
|
|
HyperDHT (discovery)
|
|
```
|
|
|
|
**Example: Collaborative FS**
|
|
|
|
```js
|
|
const Hypercore = require('hypercore')
|
|
const Hyperdrive = require('hyperdrive')
|
|
const Hyperswarm = require('hyperswarm')
|
|
|
|
const core = new Hypercore(Randy('./meta'))
|
|
const drive = new Hyperdrive('./drive', core)
|
|
const swarm = new Hyperswarm()
|
|
|
|
swarm.join(core.discoveryKey)
|
|
swarm.on('connection', (conn) => drive.replicate(conn))
|
|
```
|
|
|
|
## Tradeoffs Table
|
|
|
|
| Combo | Use Case | Perf Note |
|
|
|-------|----------|-----------|
|
|
| Hypercore + Swarm | Chat logs | Low latency gossip |
|
|
| Drive + DHT | File share | Sparse replication |
|
|
| Bee + Multisig | DB collab | Append-proof integrity |
|
|
|
|
More: Autobase for CRDT over cores.
|
|
|
|
## Full Stack Interconnect (Hypercore + Swarm + DHT)
|
|
|
|
```
|
|
mermaid
|
|
graph TB
|
|
App[App/Pear] --> HS[Hyperswarm.join(topic)]
|
|
HS --> HD[HyperDHT.lookup/announce]
|
|
HD --> DHT[Kademlia + Holepunch]
|
|
HS -->|Noise Stream| HC[Hypercore.replicate]
|
|
HC --> Drive[Hyperdrive/Hyperbee]
|
|
```
|
|
|
|
**DHT-Swarm Flow:** Topic hash → DHT peers → direct Noise conn → protocol mux (Protomux for cores).
|
|
|
|
**Perf Notes:** 95% direct conn, relays <5%.
|