Skip to content

Replace bitcoin electrs/esplora with fulcrum + mempool stack#257

Open
Kukks wants to merge 2 commits into
masterfrom
fulcrum-mempool
Open

Replace bitcoin electrs/esplora with fulcrum + mempool stack#257
Kukks wants to merge 2 commits into
masterfrom
fulcrum-mempool

Conversation

@Kukks
Copy link
Copy Markdown
Collaborator

@Kukks Kukks commented Apr 26, 2026

Summary

Drops the legacy bitcoin-side electrs and esplora services in favour of fulcrum (modern Electrum protocol) and the mempool stack (esplora-compatible REST + UI). The Liquid services (electrs-liquid, esplora-liquid, chopsticks-liquid) are deliberately left untouched.

Architecture

                  ┌──> fulcrum (Electrum TCP 50000, WS 50003)
bitcoin (RPC) ────┤
                  └──> mempool-api (REST /api/*) <─┬── mempool-web (UI :5000)
                          ↑                        │
                          └── mempool-mariadb      │
                                                   │
chopsticks ──> esplora-relay (nginx :30000) ──[rewrite ^→/api]──┘

Why the nginx relay

chopsticks reverse-proxies its --electrs-addr verbatim with no path manipulation (verified by reading nigiri-chopsticks/router/electrs_handler.go). Mempool serves esplora-compat endpoints under /api/* while electrs served them at the root. The esplora-relay (nginx) sits between chopsticks and mempool-api, prepending /api so:

  • nigiri faucet / mint / push CLI commands keep working
  • arkd's ARKD_ESPLORA_URL: http://chopsticks:3000 keeps working with no env-var change

Port mapping (legacy host ports preserved)

Old (electrs/esplora) New
30000 electrs HTTP esplora esplora-relay (nginx) → mempool-api
50000 electrs Electrum TCP fulcrum Electrum TCP
5000 esplora UI mempool-web UI

New ports added: 50003 (fulcrum WS), 8999 (mempool-api).

Files touched

  • cmd/nigiri/resources/docker-compose.yml — service swap
  • cmd/nigiri/resources/esplora-relay.conf — new nginx config (path rewrite to /api/*)
  • cmd/nigiri/main.go — embed + provision the new resource and per-service volume dirs
  • cmd/nigiri/start.go — bitcoin explorer service list (CI / non-CI)
  • internal/docker/mock_client.go — updated mock endpoints/ports
  • test/start_stop_test.go — updated fixtures and expected service lists

Test plan

  • go build ./...
  • go vet ./...
  • go test ./test/... -run 'TestDataDirSetup|TestBasicStartStop|TestServiceCombinations|TestStateManagement' — all green
  • docker compose -f cmd/nigiri/resources/docker-compose.yml config --quiet — valid
  • End-to-end smoke: nigiri start boots the new stack; nigiri faucet <addr> works (chopsticks → relay → mempool-api round-trip)
  • nigiri start --liquid — liquid stack untouched, still works
  • nigiri start --ark — arkd's ESPLORA_URL still resolves; wallet creation/funding flow works
  • nigiri start --ci — headless explorer stack starts (no mempool-web)

Notes / follow-ups

  • Existing nigiri datadirs need nigiri forget before upgrade so the new docker-compose.yml and the esplora-relay/default.conf resource are re-provisioned.
  • Mempool's frontend is configured with BACKEND_MAINNET_HTTP_HOST=mempool-api — the UI will label things as mainnet but talk to the regtest backend. We can revisit this if a regtest-native UX is needed.
  • STATISTICS_ENABLED and LIGHTNING_ENABLED are both set to false to keep the regtest stack lean; toggle if needed.

Drops the legacy `electrs` (bitcoin) and `esplora` (bitcoin) services in
favour of:

- `fulcrum` for the modern Electrum protocol (TCP + WebSocket)
- `mempool-api` + `mempool-mariadb` for the esplora-compatible REST API
- `mempool-web` for the block explorer UI
- `esplora-relay` (nginx) that rewrites unprefixed paths to /api/* so
  `chopsticks` (and arkd, via ARKD_ESPLORA_URL) keep talking to an
  esplora-shaped surface unchanged

Liquid stack (electrs-liquid, esplora-liquid, chopsticks-liquid) is
untouched. Legacy host ports preserved for backward compatibility:
30000 (HTTP esplora -> nginx relay) and 50000 (Electrum TCP -> fulcrum).
fulcrum publishes Electrum on both TCP (50000) and WebSocket (50003).
GetEndpoints auto-derives the first port mapping only, so the WS URL
was previously invisible. Add an explicit "fulcrum (ws): ws://..."
line alongside the TCP one so browser/JS Electrum clients know which
URL to use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant