mirror of
https://github.com/hanzoai/bootnode.git
synced 2026-10-25 02:31:30 +00:00
Adds a Go subsystem alongside the existing Python FastAPI service so
bootnode can fold into `superbase` per HIP-0106. The Python service in
`api/bootnode/` stays untouched.
What landed:
- `schema/bootnode.zap` — public typed surface (chains, RPC, tokens,
NFTs, transfers, smart wallets, ERC-4337, gas, webhooks, fleets,
nodes, usage). No `.capnp` anywhere — ZAP only, per brand policy.
- `zap/gen/` — hand-rolled Go bindings that match what `zapc generate`
emits, so `go build` works without zapc installed locally.
- `api/mount.go` — the HIP-0106 contract:
func Mount(r chi.Router, deps Deps) error
mounts every FastAPI-parity route group through `api/handlers/`.
- `api/deps.go` — cross-subsystem ZAP client interfaces (IAM, KMS,
Base, O11y, Commerce). No business logic, no hard imports — keeps
the Bootnode module independent of sibling subsystems until they
ship their typed clients.
- `api/handlers/` — 149 chi routes mounted (Python has 150). Each
handler body is a 501 stub with a `TODO(bootnode-port)` pointing at
the Python file + symbol to port.
- `api/middleware/` — IAM-backed auth, OTEL-friendly telemetry,
per-org rate limit (stub).
- `api/store/` — per-tenant SQLite access via `deps.Base.Open(orgID,
"bootnode")` per HIP-0302.
- `api/web3/` — chain registry + RPC pool surface (production version
prefers luxfi/* over upstream go-ethereum).
- `cmd/bootnode/main.go` — standalone shim; same `api.Mount` superbase
calls in production.
- `docs/PYTHON_TO_GO_PORT.md` — endpoint-by-endpoint port map.
Build: `go build ./...` and `go vet ./...` clean. Standalone shim
smokes 200 on /health, /ready, /v1/chains; 401 on auth-required
endpoints with no JWT; 501 on every TODO route.
Out of scope (not in this commit):
- Handler bodies (Phase 2 — porting in RPC → tokens → NFTs → ...
priority order).
- superbase wiring (lands when the superbase repo opens its main).
- Python service removal (stays until handlers reach prod parity).
112 lines
3.1 KiB
Markdown
112 lines
3.1 KiB
Markdown
# Bootnode
|
|
|
|
**Web3 Backend in a Box** - Run locally or deploy to cloud.
|
|
|
|
> **Go rewrite (HIP-0106) in progress.** The current production
|
|
> service is the Python FastAPI app under [`api/`](api/). A Go
|
|
> scaffold that mounts into [`superbase`](../superbase) per HIP-0106
|
|
> lives alongside it — `api/`, `cmd/bootnode/`, `schema/`,
|
|
> `zap/`. See [`docs/PYTHON_TO_GO_PORT.md`](docs/PYTHON_TO_GO_PORT.md)
|
|
> for the endpoint-by-endpoint port map and the new
|
|
> [Go README section](#go-rewrite-hip-0106) below.
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
docker compose up -d
|
|
```
|
|
|
|
Done. Your Web3 backend is running:
|
|
- **API:** http://localhost:8000
|
|
- **Dashboard:** http://localhost:3001
|
|
- **API Docs:** http://localhost:8000/docs
|
|
|
|
## Features
|
|
|
|
| API | Description |
|
|
|-----|-------------|
|
|
| `POST /v1/rpc/{chain}` | Multi-chain JSON-RPC proxy |
|
|
| `WS /v1/ws/{chain}` | Real-time blockchain subscriptions |
|
|
| `GET /v1/tokens/{chain}/balances/{address}` | Token balances & metadata |
|
|
| `GET /v1/nfts/{chain}/owned/{address}` | NFT ownership & metadata |
|
|
| `POST /v1/webhooks` | Event-driven notifications |
|
|
| `POST /v1/wallets/create` | ERC-4337 smart wallets |
|
|
| `POST /v1/bundler/{chain}` | UserOp bundling |
|
|
| `POST /v1/gas/sponsor` | Gas sponsorship |
|
|
|
|
## Supported Chains
|
|
|
|
**L1:** Ethereum, BNB Chain, Avalanche, Solana, Bitcoin
|
|
|
|
**L2:** Arbitrum, Optimism, Base, Polygon, zkSync, Scroll, Linea, Blast
|
|
|
|
## Development
|
|
|
|
```bash
|
|
# API (Python 3.12+)
|
|
cd api && uv sync && uvicorn bootnode.main:app --reload --port 8000
|
|
|
|
# Dashboard (Node 22+)
|
|
cd web && pnpm install && pnpm dev
|
|
```
|
|
|
|
## Deploy
|
|
|
|
### Self-hosted
|
|
```bash
|
|
docker compose -f docker-compose.prod.yml up -d
|
|
# or
|
|
kubectl apply -f infra/k8s/
|
|
```
|
|
|
|
### Hanzo Cloud
|
|
```bash
|
|
hanzo deploy
|
|
```
|
|
|
|
Visit [web3.hanzo.ai](https://web3.hanzo.ai) for managed hosting.
|
|
|
|
## License
|
|
|
|
Apache-2.0
|
|
|
|
## Go rewrite (HIP-0106)
|
|
|
|
The Go subsystem mounts into `superbase` (the unified Hanzo Cloud
|
|
binary). It exposes a single `Mount(r chi.Router, deps api.Deps) error`
|
|
entry point and a public ZAP schema (`schema/bootnode.zap`) covering
|
|
every cross-subsystem type.
|
|
|
|
```
|
|
bootnode/
|
|
schema/bootnode.zap # public typed surface (ZAP)
|
|
zap/gen/ # zapc-generated Go (hand-stubs today)
|
|
api/ # subsystem code (chi handlers + store)
|
|
mount.go # HIP-0106 contract
|
|
deps.go # IAM/KMS/Base/O11y/Commerce interfaces
|
|
handlers/ # one MountXxx per FastAPI route group
|
|
middleware/ # auth, telemetry, rate-limit
|
|
store/ # per-tenant SQLite via deps.Base
|
|
web3/ # chain registry + RPC pool
|
|
cmd/bootnode/main.go # standalone dev shim
|
|
docs/PYTHON_TO_GO_PORT.md # endpoint-by-endpoint mapping
|
|
```
|
|
|
|
### Build
|
|
|
|
```bash
|
|
go build ./...
|
|
go vet ./...
|
|
go run ./cmd/bootnode # listens on :8100 (BOOTNODE_ADDR to override)
|
|
```
|
|
|
|
### Generate ZAP bindings
|
|
|
|
```bash
|
|
cd zap && make gen # no-op if zapc isn't installed
|
|
```
|
|
|
|
`zapc` lives at `~/work/hanzo/zap/zapc-rs/`. Brand policy: no
|
|
`.capnp` files, no "Cap'n Proto" references on the public surface
|
|
(HIP-0106).
|