feat: initial spike repo — node/API eval, infra cost, price oracle

- README.md: spike goals and repo structure
- docs/node-vs-api.md: BCH node vs hosted API evaluation with recommendation
- docs/infra-cost.md: revised infra cost estimate (revised $150 assumption down to $26-50/month)
- src/price-oracle.ts: BCH/USD historical price oracle (CoinGecko + Messari + CryptoCompare)
- src/demo.ts: multi-source variance comparison demo

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Mikael Berg
2026-05-17 16:18:30 +00:00
co-authored by Paperclip
commit a9dbfacce2
6 changed files with 707 additions and 0 deletions
+157
View File
@@ -0,0 +1,157 @@
# BCH Node vs Hosted API — Evaluation & Recommendation
_Spike task: PRO-61 | Evaluated: 2026-05-17_
---
## Overview
Two primary paths exist to access Bitcoin Cash on-chain data:
| | Option A: Self-Hosted Node | Option B: Hosted API |
|---|---|---|
| **Software** | BCHN v29.0.0 | Fullstack.cash / GetBlock.io / Tatum |
| **Time to first data** | 12–48 hours (initial sync) | Minutes |
| **Spike cost** | $22–50/month | $0–15/month |
| **Production cost** | $22–50/month | $15–100/month |
| **Rate limits** | None | Tier-dependent |
| **Reliability** | Self-managed | Provider SLA |
| **Data completeness** | Full | Full (indexer-dependent) |
| **Ops burden** | High | Low |
---
## Option A: Self-Hosted BCH Full Node (BCHN)
### What is BCHN?
[Bitcoin Cash Node (BCHN)](https://bitcoincashnode.org) is the reference implementation for
the BCH network. v29.0.0 (released May 2026) implements the May 2026 network upgrade.
### Technical Requirements (May 2026)
| Resource | Minimum | Recommended |
|---|---|---|
| **Blockchain size** | 222 GB (and growing ~30 GB/year) | — |
| **Storage total** | 280–350 GB (blockchain + indexes) | 500 GB SSD |
| **RAM** | 4 GB | 8 GB |
| **CPU** | 2 vCPU | 4 vCPU |
| **Bandwidth** | 50 KB/s sustained | 10 Mbps |
| **Initial sync time** | 12–48 hours | — |
### Estimated Monthly VPS Costs
| Provider | Spec | Cost/month | Notes |
|---|---|---|---|
| **Hetzner** (recommended) | CX32 (4 vCPU, 8 GB, 40 GB SSD) + 300 GB Volume | ~€24 (~$26) | Best value; EU-only |
| **Hetzner** | CPX41 (8 vCPU, 16 GB, 240 GB SSD) | ~€29 (~$32) | Marginal storage for growth |
| **Vultr** | 4 vCPU, 8 GB, 320 GB NVMe | ~$40 | US/global availability |
| **DigitalOcean** | 4 GB Droplet + 300 GB Block Storage | ~$54 | Premium pricing |
**Best spike option:** Hetzner CX22 (2 vCPU, 4 GB, 40 GB) + 300 GB Volume ≈ **€19/month (~$21)**
### Pros
- No rate limits; unlimited queries
- Full blockchain data including mempool
- Complete indexing control (can add xpub watch, custom filters)
- No third-party dependency; runs as long as you pay for the VPS
- Privacy — no API key, no traffic logging by third party
### Cons
- 12–48 hour initial sync blocks development start
- Must monitor node health, upgrades (e.g., May 2026 network upgrade required)
- Storage grows ~30 GB/year; must plan capacity
- Higher fixed cost vs. free API tiers
- No managed xpub indexing out of the box — requires Electrum X or similar sidecar
---
## Option B: Hosted Public API
### Providers Evaluated
#### 1. Fullstack.cash ⭐ Recommended for spike
- **URL:** https://fullstack.cash
- **What it is:** BCH-as-a-Service built on top of BCHN + ElectrumX + SLPDB
- **Pricing:**
- Free: 20 req/min (sufficient for development and low-traffic use)
- Tier 1: $9.99–14.99/month → ~100 req/min, up to 2M req/day on shared infra
- Enterprise: Custom private infra (dedicated node, isolated)
- **Capabilities:** REST API, xpub balance/tx history, SLP token support, WebSocket notifications
- **Reliability:** Good; maintained by Permissionless Software Foundation
- **Rate limits:** Manageable for a spike; free tier is workable for low volume
#### 2. GetBlock.io
- **URL:** https://getblock.io/nodes/bch/
- **What it is:** Managed node-as-a-service for many blockchains
- **Pricing:** Free tier (limited requests), paid plans from ~$29/month
- **Capabilities:** Standard BCH RPC (getblock, getrawtransaction, etc.)
- **Limitations:** RPC-only; no built-in xpub indexing; need ElectrumX separately for address watching
#### 3. Tatum.io
- **URL:** https://tatum.io/chain/bitcoin-cash
- **What it is:** Multi-chain developer platform
- **Pricing:** Free tier available; paid plans for higher throughput
- **Capabilities:** BCH RPC + wallet/address monitoring APIs
- **Best for:** Developers who want a unified API across many chains
#### 4. Mainnet.cash
- **URL:** https://mainnet.cash
- **What it is:** BCH-focused REST API + webhook support
- **Pricing:** Self-hosted open source; hosted option available
- **Capabilities:** Address watching, webhooks for incoming transactions — directly relevant to our xpub ingestion requirement
### Pros (Hosted API)
- **Zero setup time** — start querying in minutes
- **Lowest cost for spike** — free tier sufficient for development
- **No ops burden** — provider handles node upgrades, syncing, monitoring
- **Fullstack.cash specifically** supports xpub watching out of the box
### Cons
- Rate limits could become a bottleneck at scale
- Vendor dependency — if provider sunsets service, migration needed
- Limited customization (e.g., can't add custom indexes)
- Privacy: query patterns visible to provider
---
## Recommendation
### For the Spike: **Option B — Fullstack.cash (free tier)**
Start with Fullstack.cash free tier for the spike. Rationale:
1. **Speed**: Development starts in minutes, not 12–48 hours.
2. **Cost**: $0 during spike vs $21–26/month for a VPS node.
3. **xpub support**: Fullstack.cash provides xpub transaction history via ElectrumX — directly needed for the transaction ingestion deliverable.
4. **Low risk for 2-week spike**: 20 req/min is fine for functional testing.
### For Production: **Option A — Self-Hosted BCHN on Hetzner**
Once the spike proves the concept, migrate to a self-hosted BCHN node on Hetzner for production:
1. **No rate limits** — critical for payment monitoring at scale.
2. **Cost-effective** — ~$22–26/month is less than premium API tiers at volume.
3. **Reliability** — no external dependency; we control uptime.
4. **Auditability** — full transaction data locally.
Consider pairing BCHN with [Fulcrum](https://github.com/cculianu/Fulcrum) (high-performance ElectrumX implementation) for xpub indexing. Total stack: BCHN + Fulcrum on a single Hetzner CX32 + 300 GB volume.
---
## Migration Path
```
Spike (week 1-2) → Production MVP → Full Production
Fullstack.cash free tier Self-hosted BCHN on BCHN + Fulcrum on
$0/month Hetzner + volume Hetzner + monitoring
~$26/month ~$35-50/month
```