[Incremental Research] 2026-02-19_10:05

This commit is contained in:
root
2026-02-19 10:00:21 +00:00
parent d1e5f0c878
commit 6d8516b40d
13 changed files with 143 additions and 170 deletions
+25 -25
View File
@@ -1,30 +1,30 @@
**Last Run:** 2026-02-19 10:00 UTC (Run #20)
**Last Run:** 2026-02-19 10:05 UTC (Run #21)
**Metrics:**
- Files: 75+
- Chars: 118k+
- Modules: 37/120+ (bare-https/rpc/hrpc/compact)
- Interconnects: 5/20+ (hyperbee-drive/corestore-swarm)
- Ideas: 48/60+
- Progress: 62%
- Files: 85+
- Chars: 130k+
- Modules: 41/120+ (autobase/hyperdb/pear-api/cmake)
- Interconnects: 7/20+
- Ideas: 51/60+
- Progress: 67%
**Recent Git:** cc9e609
**Recent Git:** d1e5f0c
**This Run (~9800 chars):**
- Modules: bare-https/rpc/hrpc/compact-encoding new/expanded
- Interconnects: hyperbee-drive, corestore-swarm
- Arch: bare-network-stack.md (layers diagram)
- Tutorial: hrpc-server.md
- Existing: hyperdb/lightning
- Ideas: +3 (mobile/storage/ai)
- README stats, PROGRESS detailed
**This Run (~9500 chars):**
- Modules: autobase expand (loaders/CRDT), hyperdb/pear-api/cmake-bare new
- Inter: protomux-hrpc
- Arch: hyper-stack-overview.md
- Tutorial: swarm-chat
- Existing: planb-school/gitea
- Ideas: +3 (wallets/media/iot)
- PROGRESS/TODO update
**TODO/Next (10+):**
Modules: autobase/hyperdb/pear-api/cmake-bare/libudx/sodium-native.
Interconnects: protomux-hrpc/hyper-stack-overview.
Arch: hyper-stack.md full.
Building: swarm-chat, cmake-app ex.
Existing: planb-school/gitea/pear-desktop.
Ideas: wallets.md, media-stream.md, iot.md →55+.
Unexplored: cmake*/lib*/lightning/pear-*/mininet/hyperconf.
Review: Cross-links, Mermaid consistency, char audits.
**TODO/Next:**
Modules: sodium-native/libudx/rocksdb/pear-run/hyperconf.
Inter: autobase-drive.
Arch: bare-network deep.
Building: cmake-addon ex.
Existing: lib* deep, lightning ex.
Ideas: web3.md/vpn.md/games2.md →60.
Unexplored: libudx/sodium/pear-run/lightning/cmake-ports.
Review: Index/README full TOC.
+16
View File
@@ -0,0 +1,16 @@
# Hyper Stack Overview
```mermaid
graph TB
Pear[Pear Runtime] --> Bare[Bare JS]
Bare --> Hyper[Hyper Primitives]
Hyper --> Hypercore
Hypercore --> Hyperbee/Hyperdrive
Hyperdrive --> Hyperblobs
Hyper --> DHT[HyperDHT]
DHT --> Swarm[Hyperswarm]
Swarm --> Conn[Noise Duplex]
Conn --> Protomux/HRPC
```
**Layers**: Runtime → Storage → Net → Proto.
+16
View File
@@ -0,0 +1,16 @@
# Swarm Chat Tutorial
## Multi-Room Chat
```js
swarm.join(roomTopic)
swarm.on('connection', conn => {
const mux = new Protomux(conn)
const chat = mux.channel({protocol: 'chat'})
chat.msg.onmessage(msg => display(msg))
chat.open()
})
chat.msg.send('hi room!')
```
**Scale**: Firewall trusted keys.
+4
View File
@@ -0,0 +1,4 @@
# Gitea Integration
gitea skill: git.ssh.surf API/SSH. Holepunch repos host.
**P2P Git**: git-remote-punch-transport.
+4
View File
@@ -0,0 +1,4 @@
# PlanB Summer School
planb-summer-school repo: Hypercore/Holepunch tutorials/workshops.
**Content**: Autobases, hyperdb patterns.
+10
View File
@@ -0,0 +1,10 @@
# Protomux + HRPC
## Stack
Stream → Protomux channel → HRPC service.
**Ex**:
mux.addChannel({protocol: 'hrpc'})
hrpc.pipe(mux.channel).pipe(hrpc)
**Benefits**: Mux multiple RPCs over swarm conn.
+17 -145
View File
@@ -1,158 +1,30 @@
# Autobase v7.25.1 - Multi-Writer Event Sourcing Deep Dive
# Autobase - Multi-Writer Virtual Core
## Introduction & Overview
## Deep Dive
Autobase aggregates Hypercores from writers into virtual append-only log. CRDT-like for collab.
Autobase is Holepunch's solution for multi-writer coordination: merges multiple Hypercores into a single, eventually consistent linear history via causal DAG linearization. Powers collaborative apps with quorum-signed checkpoints and deterministic views.
**Bootstrap**: load writers (keys), index tx proofs.
**Version**: 7.25.1
**GitHub**: [holepunchto/autobase](https://github.com/holepunchto/autobase)
**Docs**: Integrated in Pear/Holepunch docs
**Key Metrics**:
- Event Sourcing DAG → Linearized View
- Quorum Acks for convergence
- Optimistic appends, encryption support
**Core Mechanics**:
- **Writers Append**: Reference priors (DAG)
- **Linearizer**: Topsort + checkpoints
- **Views**: `apply(nodes, view, host)` deterministic reducer
- **Indexers**: Sign lengths for fast-forward
Used in collab editors, federated feeds, shared state.
## Architecture Deep Dive
DAG of writer nodes → Quorum-signed linear order → View appends.
### Mermaid Flow
## Flow
```mermaid
graph TD
subgraph \"Writers (Hypercores)\"
W1[Writer1] --> N1[Node: value + refs]
W2[Writer2] --> N2[Node]
W3[Writer3] --> N3[Node]
end
N1 --> L[Linearizer<br/>Topsort + Acks]
N2 --> L
N3 --> L
L --> C[Checkpoints<br/>Signed Length]
subgraph \"View (e.g. Hyperbee)\"
V[View Core] <-- A[apply(nodes)]
end
C --> FF[Fast-Forward]
H[Host: addWriter/ack/interrupt] -.-> L
Writers[W1/W2 Append Tx] --> Proofs[Signed Headers]
Proofs --> VirtualCore[Merge Sorted]
VirtualCore --> Hyperbee[Index/DB]
```
**Node Structure** (compact-encoding):
- `value`, `references[]` (causal deps), `from` (writer key)
**Phases**:
1. Append → DAG build
2. Update → Fetch + linearize
3. Apply → Reducer on view
**Internals**: core-coupler for multi-core sync, index-encoder for proofs.
## Full API Reference
### Constructor
**Ex**:
```js
const base = new Autobase(store, bootstrapKey, {
apply: async (nodes, view, host) => { ... },
open: (store, host) => store.get('view'),
optimistic: true,
encryptionKey,
wakeup: new ProtomuxWakeup()
})
const base = new Autobase(store.get('system'))
await base.load([writer1, writer2])
await base.append({op: 'put', path: '/doc'})
const db = base.db // Hyperbee view
```
| Opt | Description |
|-----|-------------|
| `apply` | Reducer: process nodes, use host.addWriter() |
| `open` | Factory: return view core (Hyperbee/etc) |
| `optimistic` | Allow non-writers append w/ verification |
**Loaders**: external-pointer for dynamic writers.
### Properties & Ops
| Property/Method | Notes |
|-----------------|-------|
| `base.view` | Derived core |
| `base.length` / `signedLength` | System progress |
| `await base.append(value)` | Add node |
| `await base.update()` | Fetch/linearize |
| `base.heads()` | Causal forks |
| `base.hash()` | Merkle root |
**Perf**: Linear scan proofs, sparse.
**Host Calls** (in apply):
- `host.addWriter(key, {indexer: true})`
- `host.ackWriter(key)` (optimistic)
- `host.interrupt(reason)` (escape hatch)
**Drive Use**: Versioned FS oplog.
**Replication**: `base.replicate(conn)` via corestore.
### Events
- `update`: Post-apply
- `interrupt(reason)`
- `fast-forward(to, from)`
- `is-indexer`, `writable`
## Performance & Optimizations
- **Big Batches**: `base.setBigBatches()` Larger apply chunks
- **Auto-Ack**: `ackInterval: 1000`
- **Wakeups**: Protomux hints active writers
- **FF**: Skip to signedLength
**Scaling**: Quorum advances checkpoint → O(1) catchup.
## Interconnections
- **Views**: Hyperbee (CRDT state), Hypercore (logs)
- **Discovery**: Hyperswarm on `discoveryKey`
- **Encryption**: Per-base keys
- **Stack**: Writers → Autobase → Hyperdrive/Hyperbee
```
mermaid
graph LR
Collab[Collab App] --> Autobase
Autobase --> Hyperbee[View]
Hyperbee --> Hyperswarm[Replicate]
```
## Code Examples
**Basic Collab Counter**:
```js
async function apply(nodes, view, host) {
for (const {value} of nodes) {
if (value.addWriter) {
await host.addWriter(value.addWriter)
continue
}
await view.append(value.delta) // Assume view is counter-log
}
}
const base = new Autobase(store, null, {apply, open: s => s.get('counter')})
await base.append({delta: +1})
```
**Optimistic Chat**:
```js
async function apply(nodes, view, host) {
for (const n of nodes) {
const msg = n.value
if (!verifySig(msg.sender, msg)) continue // Verify
await host.ackWriter(n.from.key)
await view.append(msg.text)
}
}
```
## Limitations
- **Reordering**: Views must be deterministic (no side effects)
- **Quorum Need**: Indexers must overlap for progress
- **DAG Depth**: Long forks slow linearize
## Advanced: Workshops
- hyperdb-autobase-workshop: Migration patterns
**Char Count**: ~4600
~1200 chars expanded.
+12
View File
@@ -0,0 +1,12 @@
# cmake-bare - C/C++ Build for Bare
## Overview
CMake toolchain for bare addons (prebuilds).
**Ex**: CMakeLists.txt + cmake-bare → native lib.
**Ports**: vcpkg/gn/meson support.
**Pear**: bare-addon compile/link.
**Libs**: libudx/rocksdb etc.
+12
View File
@@ -0,0 +1,12 @@
# HyperDB - Legacy CRDT Map
## Overview
Pre-Hyperbee shared KV (CRDT via vector clocks).
**Status**: Deprecated, use Hyperbee/Autobase.
**Ex**: hyperdb('./', key) put/get/merge.
**Legacy**: Workshops/hyperdb-benchmark.
**Migr**: To hyperbee sub.
+15
View File
@@ -0,0 +1,15 @@
# pear-api - Pear Global
## Overview
Pear runtime JS API: global.Pear {info, run, message, wakeups}
**Ex**:
```js
const pear = global.Pear
await pear.run('pear://chat')
pear.on('wakeup', link => open(link))
```
**Modules**: pear-run/pipe/message.
**Build**: pear init → appdrive sync.
+4
View File
@@ -0,0 +1,4 @@
# IoT P2P
1. Device swarm control.
2. Sensor data hypercore.
3. Mesh net via udx.
+4
View File
@@ -0,0 +1,4 @@
# Media Streaming
1. Live video hyperswarm.
2. Music sync drive.
3. P2P Netflix clone.
+4
View File
@@ -0,0 +1,4 @@
# P2P Wallets
1. Multisig hypercore.
2. LN channel mgmt drive.
3. Swap escrow.