Krystie 87bb9fafae Add test suite for bootstrap server
- test_setup.sh: validates installation, package deps, directory creation
- test_tor_config.sh: validates Tor hidden service configuration
- test_caddy_config.sh: validates Caddy web server configuration
- test_generate_bootstrap.sh: validates bootstrap archive generation
- run_all.sh: runs all tests with summary

All tests pass (47 total assertions across 4 test suites).
2026-04-28 04:49:42 -07:00
2026-04-21 01:53:34 -07:00
2026-04-28 04:49:42 -07:00
2026-04-21 01:53:34 -07:00
2026-04-21 01:53:34 -07:00

TRI Bootstrap Server

Self-hosted bootstrap server for the Triangles (TRI) cryptocurrency network.

Serves blockchain bootstrap archives over both clearnet (HTTPS) and Tor onion, enabling new nodes to sync quickly without downloading 2M+ blocks from peers.


What is a Bootstrap Server?

When a new Triangles node starts with no chain data, it needs a trusted source of truth. Rather than syncing from random peers (which might be on a minority/forked chain), the node downloads a signed, known-good blockchain snapshot from a trusted bootstrap URL.

This server provides:

  • HTTPS endpoint — for nodes on clearnet
  • Tor onion endpoint — for nodes that prefer or require Tor anonymity

Architecture

                    ┌─────────────────────────────────────┐
                    │        Bootstrap Server              │
                    │   (your server, e.g. DNS2)         │
                    │                                     │
  New TRI Node ─────►│  Caddy (HTTPS :443) ───► static    │
  (clearnet)        │         │                           │
                    │  Tor HS (:80) ──────► same static │
                    │         │                           │
                    └─────────│───────────────────────────┘
                              │
                    Triangles Bootstrap Archive
                    (blk0001.dat + txleveldb + database/)

Quick Start

1. Clone / Download This Repo

git clone https://github.com/SamiAhmed7777/tri-bootstrap-server.git
cd tri-bootstrap-server

2. Configure Environment

cp .env.example .env
# Edit .env with your settings

Key variables:

  • BOOTSTRAP_DIR — where bootstrap archives are stored
  • TOR_HS_PORT — internal port for Tor hidden service (default: 80)
  • CUDDLE_DOMAIN — your domain (e.g. bootstrap.cryptographic-triangles.org)

3. Run

# Using the setup script
sudo ./scripts/setup.sh

# Or manually:
sudo cp tor/torrc /etc/tor/tri-bootstrap/torrc
sudo systemctl enable --now tor@tri-bootstrap
sudo cp systemd/tri-bootstrap-caddy.service /etc/systemd/system/
sudo systemctl enable --now tri-bootstrap-caddy

4. Generate Your First Bootstrap

# On a trusted, synced TRI node:
./scripts/generate-bootstrap.sh /path/to/.triangles

# Upload the archive to your server:
scp triangles-bootstrap.tar.gz user@your-server:/opt/triangles-bootstrap/

Scripts

Script Purpose
generate-bootstrap.sh Creates a triangles-bootstrap.tar.gz from a running node's chain data
publish-bootstrap.sh Uploads to Dropbox (optional bridge)
verify-bootstrap.sh Verifies archive integrity and chain hash

Tor Onion Setup

The server automatically creates a Tor hidden service. The .onion address is stored in:

/var/lib/tor/tri-bootstrap/hostname

Share this address with nodes that need Tor-only connectivity.


For Node Operators

In your TRI node's triangles.conf:

# Use this bootstrap server
bootstrap=https://bootstrap.your-domain.com/triangles-bootstrap.tar.gz

# Or via Tor (replace with your server's onion address)
bootstrap=http://your-onion-address.onion/triangles-bootstrap.tar.gz

Repo Structure

tri-bootstrap-server/
├── README.md
├── LICENSE
├── .env.example
├── caddy/
│   └── Caddyfile.template
├── tor/
│   └── torrc.template
├── scripts/
│   ├── setup.sh
│   ├── generate-bootstrap.sh
│   ├── publish-bootstrap.sh
│   └── verify-bootstrap.sh
├── systemd/
│   ├── tor-bootstrap.service
│   └── tri-bootstrap-caddy.service
└── docs/
    ├── bootstrap-format.md
    └── operator-guide.md

Security Notes

  • The bootstrap archive contains the blockchain up to a point in time — it is NOT a wallet and contains no keys
  • Always generate bootstrap from a trusted, verified canonical node
  • Verify the bestblockhash of your bootstrap against known-good references before publishing
  • Tor hidden service provides anonymity for nodes that need it, but the clearnet HTTPS route is faster for most users
S
Description
Self-hosted bootstrap server for Triangles (TRI) cryptocurrency network. Serves blockchain snapshots over HTTPS and Tor onion.
Readme 40 KiB
Languages
Shell 100%