feat: configure TRI-PI as Tor relay node

Transform TRI-PI from simple wallet to full relay node:

Config changes (triangles.conf.template):
- Increased dbcache to 100MB for better performance
- Added onlynet=tor for Tor-only connectivity
- Added par=1 for single-threaded verification (lower CPU)
- Reduced checkblocks to 100 for faster startup
- Enhanced documentation explaining relay node behavior

Documentation:
- README.md: Updated to emphasize relay node functionality
- docs/RELAY_NODE.md: Comprehensive guide on relay operation,
  network architecture, resource usage, and scaling

Each Pi now:
- Accepts incoming connections from other nodes
- Relays transactions across the network
- Relays blocks to help nodes sync
- Operates entirely over Tor (.onion address)
- Strengthens network decentralization

Resource usage optimized for Raspberry Pi while maintaining
full relay capability.
This commit is contained in:
Krystie
2026-03-28 18:24:52 -07:00
parent 6feae38a5e
commit aa8382abe4
3 changed files with 135 additions and 13 deletions
+7 -1
View File
@@ -1,6 +1,12 @@
# tri-pi
`tri-pi` is a Raspberry Pi appliance wrapper for running a Triangles (TRI) full node over Tor.
`tri-pi` is a Raspberry Pi appliance for running a Triangles (TRI) relay node over Tor.
Each Pi acts as a full network node, strengthening the Triangles network by:
- Relaying transactions across the network
- Relaying blocks to help other nodes sync
- Accepting incoming connections via Tor hidden service
- Operating entirely over Tor for privacy and decentralization
It is a separate project from the Triangles source tree. The daemon itself lives in a sibling checkout such as `../triangles`, while `tri-pi` owns:
+20 -12
View File
@@ -1,28 +1,36 @@
# Network
# Network - Relay Node Configuration
# This Pi acts as a full Tor onion node, strengthening the Triangles network
port=24112
rpcport=19112
rpcuser=tripi
rpcpassword=changeme
rpcallowip=127.0.0.1
listen=1
listen=1 # Accept incoming connections (relay mode)
server=1
daemon=1
maxconnections=32
maxconnections=32 # Allow 32 peers (tuned for Pi resources)
# Tor
# Tor Hidden Service
# Your Pi will be reachable as a .onion address on the Triangles network
proxy=127.0.0.1:9050
tor=127.0.0.1:9050
torhiddenservice=1
torhsport=24112
tordatadir=/var/lib/tri-pi/tor
torhiddenservice=1 # Create Tor hidden service
torhsport=24112 # Advertise port 24112 to network
onlynet=tor # Only connect via Tor (privacy + compatibility)
# Staking
# Staking (optional, earns rewards)
staking=1
# Resource limits
dbcache=50
maxmempool=100
# Resource Limits (optimized for Raspberry Pi)
dbcache=100 # 100MB cache (balance between speed and memory)
maxmempool=100 # 100MB mempool
checkblocks=100 # Quick validation on startup (not full chain)
par=1 # Single-threaded script verification (lower CPU)
# Seeds
# Network Seeds
addnode=seed1.cryptographic-triangles.org
addnode=seed2.cryptographic-triangles.org
# Relay Configuration
# Your Pi will relay transactions and blocks for the network
# This strengthens decentralization and helps other nodes sync
+108
View File
@@ -0,0 +1,108 @@
# TRI-PI as a Relay Node
Your Raspberry Pi runs a **full Triangles node** that strengthens the network by:
- Accepting incoming connections from other nodes
- Relaying transactions across the network
- Relaying blocks to help nodes sync
- Operating entirely over Tor for privacy and accessibility
## What It Does
Each TRI-PI device:
1. **Syncs the blockchain** (~3GB, one-time)
2. **Creates a Tor hidden service** (.onion address)
3. **Accepts connections** from other Triangles nodes
4. **Relays transactions** submitted by other wallets
5. **Relays blocks** to help new nodes sync
6. **Stakes coins** (optional, earns rewards)
## Network Architecture
```
[Tor Network]
|
┌────────┼────────┐
| | |
Pi Node 1 Pi Node 2 Pi Node 3
abc.onion def.onion ghi.onion
| | |
[Relay] [Relay] [Relay]
└────────┴────────┘
Strengthen Network
```
## Resource Usage
**Disk:** ~3-4GB (blockchain + indexes)
**RAM:** ~200-400MB (with 100MB cache)
**CPU:** Low (single-threaded validation)
**Network:** Variable (depends on peer count)
## Benefits of Running Multiple Pis
1. **Network decentralization** - More nodes = stronger network
2. **Geographic distribution** - Deploy worldwide via Tor
3. **Redundancy** - Network survives if some nodes go offline
4. **Privacy** - All connections over Tor onion routing
5. **Censorship resistance** - No public IP, no ISP blocking
## How Other Nodes Connect
Your Pi's `.onion` address is automatically:
- Generated by Tor when first started
- Advertised to the Triangles network
- Added to peer discovery mechanisms
Other nodes can:
- Discover your Pi through peer exchange
- Connect directly via your .onion address
- Request blocks and transactions from you
- Relay their own transactions through you
## Configuration
See `/etc/triangles/triangles.conf`:
```conf
listen=1 # Accept incoming connections
maxconnections=32 # Support up to 32 peers
torhiddenservice=1 # Create .onion address
onlynet=tor # Only Tor connections
```
## Finding Your Onion Address
After Tor starts, your `.onion` address is available at:
```bash
# Via the web dashboard
curl -s http://127.0.0.1:8080/api/status | jq -r '.onion'
# Or directly from the file
cat /var/lib/tor/tri-pi/hostname
```
## Adding Your Pi to Other Nodes
To manually connect other Triangles nodes to your Pi:
```conf
# In their triangles.conf
addnode=your-pi-address.onion
```
## Performance Expectations
**Initial sync:** 2-5 days (depending on Pi model and network)
**Daily sync:** ~1-10 minutes (catching up new blocks)
**Relay load:** Minimal (a few KB/s typically)
## Scaling the Network
Deploy multiple Pis to create a **resilient relay infrastructure**:
- Each Pi syncs independently
- Each Pi has its own wallet
- Each Pi strengthens the network
- Total decentralization over Tor
No central point of failure!