This guide covers deploying TSN (Trust Stack Network) nodes for you and your friends.
# macOS
brew install flyctl
# Linux
curl -L https://fly.io/install.sh | sh
# Login (create account if needed)
fly auth login# Clone the repo (if you haven't)
git clone <your-repo-url>
cd tsn
# Create the app (first time only)
fly launch --no-deploy
# Create persistent storage for blockchain data
fly volumes create tsn_data --region sjc --size 1
# Deploy!
fly deployAfter deployment, you'll get a URL like https://tsn-node.fly.dev
- Explorer:
https://tsn-node.fly.dev/explorer - Wallet:
https://tsn-node.fly.dev/wallet - API:
https://tsn-node.fly.dev/chain/info
For redundancy, deploy nodes in different regions:
# Node 1 (San Jose)
fly launch --name tsn-node-1 --region sjc
fly volumes create tsn_data --region sjc --size 1 -a tsn-node-1
fly deploy -a tsn-node-1
# Node 2 (New York) - connects to Node 1
fly launch --name tsn-node-2 --region ewr
fly volumes create tsn_data --region ewr --size 1 -a tsn-node-2
fly secrets set TSN_SEEDS=https://tsn-node-1.fly.dev -a tsn-node-2
fly deploy -a tsn-node-2To have your node mine blocks:
# Generate a wallet first
cargo run -- new-wallet -o my-wallet.json
# Set the mining address (use your wallet's address)
fly secrets set TSN_MINE_ADDRESS=<your-address> -a tsn-node-1
fly deploy -a tsn-node-1| Variable | Description | Default |
|---|---|---|
TSN_PORT |
Port to listen on | 8080 |
TSN_DATA_DIR |
Blockchain data directory | /app/data |
TSN_SEEDS |
Comma-separated seed node URLs | (none) |
TSN_MINE_ADDRESS |
Address to receive mining rewards | (disabled) |
RUST_LOG |
Log level (error/warn/info/debug) | info |
fly secrets set TSN_MINE_ADDRESS=abc123... -a your-app-name
fly secrets set TSN_SEEDS=https://node1.fly.dev,https://node2.fly.dev -a your-app-nameJust share the wallet URL:
https://your-node.fly.dev/wallet
They can:
- Create a wallet (keys stored in their browser)
- Send you their address
- You send them some coins
- They can send coins to others!
They can run a node that syncs with your network:
# Clone and build
git clone <your-repo-url>
cd tsn
cargo build --release
# Run node (connects to your seed node)
./target/release/tsn node --peer https://your-node.fly.devOr with Docker:
docker run -p 8333:8080 \
-e TSN_SEEDS=https://your-node.fly.dev \
-v tsn_data:/app/data \
your-docker-imageOnce you have your nodes deployed, update src/config.rs:
pub const SEED_NODES: &[&str] = &[
"https://tsn-node-1.fly.dev",
"https://tsn-node-2.fly.dev",
];Then rebuild and redeploy so new nodes automatically find the network.
# Terminal 1: First node with mining
cargo run -- node --port 8333 --data-dir ./data1 --mine <your-address>
# Terminal 2: Second node
cargo run -- node --port 8334 --data-dir ./data2 --peer http://localhost:8333# Start 3 nodes locally
docker-compose up
# Access nodes:
# - Node 1: http://localhost:8333 (mining)
# - Node 2: http://localhost:8334
# - Node 3: http://localhost:8335Check node health:
curl https://your-node.fly.dev/chain/infoView logs:
fly logs -a your-app-nameFly.io free tier includes:
- 3 shared-cpu-1x VMs
- 3GB persistent storage
- Unlimited outbound bandwidth
This is enough for a small network with 2-3 nodes!
- Check both nodes use the same genesis (GENESIS_DIFFICULTY = 12)
- Verify TSN_SEEDS is set correctly
- Check logs:
fly logs -a your-app-name
fly volumes extend tsn_data --size 5 -a your-app-namefly apps restart your-app-name