diff --git a/BOOTSTRAP.md b/BOOTSTRAP.md index 4591ea9..445b00d 100644 --- a/BOOTSTRAP.md +++ b/BOOTSTRAP.md @@ -1,93 +1,63 @@ -## TRI-PI Blockchain Bootstrap +## Blockchain Bootstrap -Fast-sync your Raspberry Pi node with pre-synced blockchain data. +Fast-sync your Triangles node with a pre-synced blockchain snapshot instead of syncing from genesis (which takes days/weeks on a Pi). -### Why Use Bootstrap? +### During Installation -**Without bootstrap:** -- Sync from genesis block (block 0) -- Takes days/weeks on Raspberry Pi -- Heavy CPU/disk usage during sync -- Network bandwidth intensive +Both `install.sh` and `bootstrap.sh` offer automatic bootstrap download. Choose option 1 when prompted. -**With bootstrap:** -- Start from latest block height -- Ready to mine in minutes -- Minimal resource usage -- Download current blockchain snapshot +### Manual Bootstrap -### Installation - -The TRI-PI installer offers automatic blockchain bootstrap during setup: +If the automatic download failed (e.g., server unreachable from your network), transfer the snapshot manually: ```bash -curl -sSL https://raw.githubusercontent.com/SamiAhmed7777/tri-pi/main/bootstrap.sh | bash +# On a machine that can reach the bootstrap server: +curl -O http://194.233.88.206:8085/triangles-bootstrap.tar.gz + +# Transfer to your Pi: +scp triangles-bootstrap.tar.gz pi@your-pi:/tmp/ + +# On the Pi: +sudo systemctl stop triangles +cd /root/.triangles +tar xzf /tmp/triangles-bootstrap.tar.gz +sudo systemctl start triangles ``` -When prompted, choose **option 1** to download the pre-synced blockchain. +### What's in the Snapshot -### What Gets Downloaded +**Included:** +- `blk*.dat` — Blockchain data +- `txleveldb/` — Transaction/block index +- `database/` — BerkeleyDB environment +- `peers.dat` — Known peer cache -The bootstrap package includes: -- `blk*.dat` - Blockchain data files -- `database/` - Block index -- `txleveldb/` - Transaction index -- `smsgDB/` - Secure messaging database -- `peers.dat` - Known peer cache -- `smsg.ini` - Messaging config +**Not included (generated fresh):** +- `wallet.dat` — Created on first run +- `onion/` — Tor hidden service keys +- `tor_data/` — Tor state +- `debug.log` — Runtime log -**Not included (for security):** -- `wallet.dat` - Your wallet is created fresh on first run -- `debug.log` - Generated during operation -- `onion/` - Hidden service keys generated automatically -- `tor_data/` - Tor state regenerated on startup +### After Bootstrap -### After Installation +Your node will: +1. Load the snapshot blockchain +2. Fast-import and verify blocks +3. Sync remaining blocks from peers +4. Generate a fresh wallet and Tor identity -Start your node: +Watch progress: ```bash -trianglesd +tail -f /root/.triangles/debug.log # See FastImport progress +trianglesd -datadir=/root/.triangles getinfo # Check block height ``` -Check synchronization status: -```bash -trianglesd getinfo -``` +### Snapshot Updates -The blockchain will continue syncing from the bootstrap snapshot's block height to the current network tip. +The bootstrap server updates automatically every Sunday at 4:00 AM UTC. The snapshot is always within a week of current. -### First Run +### Security -On first startup, trianglesd will: -1. Load the bootstrap blockchain data -2. Generate a fresh wallet.dat -3. Create Tor hidden service keys -4. Begin syncing remaining blocks -5. Connect to the network via onion seeds - -**Tip:** Watch sync progress with: -```bash -watch -n5 'trianglesd getinfo | grep blocks' -``` - -### Security Notes - -1. **Fresh wallet** - Always generated locally, never downloaded -2. **Verify source** - Only use bootstrap from trusted URLs -3. **Network sync** - Remaining blocks verified via network consensus -4. **Regular updates** - Bootstrap snapshot updated weekly - -### Troubleshooting - -**If bootstrap download fails:** -- Installer automatically falls back to full sync from genesis -- You can manually download and extract: - ```bash - cd ~/.triangles - curl -O http://194.233.88.206:8085/triangles-bootstrap.tar.gz - tar xzf triangles-bootstrap.tar.gz - ``` - -**Snapshot too old?** -- No problem! Your node will sync the remaining blocks automatically -- This is still much faster than syncing from block 0 +- Wallet is **never** included — always generated locally +- Blockchain data is verified against network consensus during import +- Use only the official bootstrap URL or transfer from a trusted source diff --git a/README.md b/README.md index 95fd9d2..0783c32 100644 --- a/README.md +++ b/README.md @@ -1,121 +1,138 @@ -# TRI-PI v5.4.4 - ARM64 Edition +# TRI-PI — Triangles Node for ARM64 [![Latest Release](https://img.shields.io/github/v/release/SamiAhmed7777/tri-pi?label=Latest%20Release)](https://github.com/SamiAhmed7777/tri-pi/releases/latest) [![Build Status](https://img.shields.io/github/actions/workflow/status/SamiAhmed7777/tri-pi/build-arm64.yml?label=ARM64%20Build)](https://github.com/SamiAhmed7777/tri-pi/actions) [![Platform](https://img.shields.io/badge/platform-ARM64-blue)](https://github.com/SamiAhmed7777/tri-pi) -Complete Triangles (TRI) cryptocurrency node package for Raspberry Pi 4/5 (64-bit) and ARM64 servers. +Run a [Triangles (TRI)](https://github.com/SamiAhmed7777/triangles_v5) cryptocurrency node on Raspberry Pi 4/5 or any ARM64 server. Includes Tor integration, systemd service, and optional blockchain bootstrap. ## Quick Start -### 🚀 Bootstrap Installer (Recommended - Only 1.6MB!) +### One-liner install ```bash curl -sSL https://raw.githubusercontent.com/SamiAhmed7777/tri-pi/main/bootstrap.sh | sudo bash ``` -**Ultra-fast setup:** -- Downloads compressed binary (1.6MB vs 5.1MB) -- Auto-installs all dependencies -- Generates secure config -- Enables Tor integration -- Ready to mine in 60 seconds! +Downloads the latest release, installs dependencies, creates a systemd service, and offers blockchain bootstrap. Ready in ~60 seconds. -### 📦 Full Package Download +### Manual install ```bash -# Get latest version -wget https://github.com/SamiAhmed7777/tri-pi/releases/latest/download/tri-pi-v5.4.4-arm64.tar.gz -tar xzf tri-pi-v5.4.4-arm64.tar.gz -cd tri-pi-v5.4.4-arm64 +# Download latest release +wget https://github.com/SamiAhmed7777/tri-pi/releases/latest/download/tri-pi-v5.5.0-arm64.tar.gz +tar xzf tri-pi-v5.5.0-arm64.tar.gz # Install sudo ./install.sh - -# Start node -trianglesd -``` - -### 🔧 Build from Source - -```bash -git clone https://github.com/SamiAhmed7777/tri-pi.git -cd tri-pi -sudo ./install.sh ``` ## What's Included -- **trianglesd** v5.4.4 - Native ARM64 binary (85MB) -- **Tor integration** - Built-in hidden service support -- **Updated seed nodes** - Latest v5.4.4 onion addresses -- **Auto-installer** - One-command setup -- **Full documentation** - Build instructions and usage guide +| File | Purpose | +|------|---------| +| `bin/trianglesd` | Native ARM64 binary (stripped, ~5MB) | +| `install.sh` | Interactive installer with bootstrap option | +| `bootstrap.sh` | One-liner installer (fetches latest release) | +| `BOOTSTRAP.md` | Blockchain bootstrap guide | +| `docs/BUILD.md` | Build-from-source instructions | -## System Requirements +## After Installation -- **Platform:** Raspberry Pi 4/5 (64-bit) or any ARM64 Linux server -- **OS:** Ubuntu 24.04 ARM64, Raspberry Pi OS 64-bit, or compatible -- **RAM:** 2GB minimum (4GB recommended) -- **Storage:** 10GB free space (blockchain grows over time) -- **Network:** Internet connection (Tor supported) - -## Automated Builds - -New releases are automatically built via GitHub Actions whenever upstream trianglesd is updated. - -**Manual trigger:** Go to [Actions](https://github.com/SamiAhmed7777/tri-pi/actions) → "Build TRI-PI ARM64" → "Run workflow" - -## Usage - -### Start the node ```bash -trianglesd -``` +# Start the node +sudo systemctl start triangles -### Check node status -```bash -trianglesd getinfo +# Check status +trianglesd -datadir=/root/.triangles getinfo + +# Watch sync progress +watch -n5 'trianglesd -datadir=/root/.triangles getinfo | grep blocks' + +# View logs +journalctl -u triangles -f +tail -f /root/.triangles/debug.log + +# View Tor onion address +cat /root/.triangles/onion/hostname ``` ### Common commands + ```bash -trianglesd getblockcount # Current block height -trianglesd getpeerinfo # Connected peers -trianglesd getstakinginfo # Staking status -trianglesd getnewaddress # Generate new address -trianglesd getbalance # Wallet balance +trianglesd -datadir=/root/.triangles getblockcount # Current block height +trianglesd -datadir=/root/.triangles getpeerinfo # Connected peers +trianglesd -datadir=/root/.triangles getstakinginfo # Staking status +trianglesd -datadir=/root/.triangles getnewaddress # New address +trianglesd -datadir=/root/.triangles getbalance # Wallet balance ``` -## Documentation +> **Tip:** Create an alias to save typing: +> ```bash +> echo 'alias tri="trianglesd -datadir=/root/.triangles"' >> ~/.bashrc && source ~/.bashrc +> tri getinfo +> ``` -- **[Build Guide](docs/BUILD.md)** - Complete build instructions from source -- **[Installation](install.sh)** - Automated installer script -- **[Releases](https://github.com/SamiAhmed7777/tri-pi/releases)** - Download pre-built packages +## System Requirements + +| | Minimum | Recommended | +|---|---------|-------------| +| **Platform** | Raspberry Pi 4 (64-bit) | Raspberry Pi 5 or ARM64 VPS | +| **OS** | Ubuntu 24.04, Pi OS 64-bit | Ubuntu 24.04 LTS | +| **RAM** | 2 GB | 4 GB | +| **Storage** | 5 GB free | 10 GB free | +| **Network** | Internet (Tor supported) | Wired ethernet | + +## Blockchain Bootstrap + +Syncing from genesis takes days/weeks on a Pi. The installer offers a pre-synced blockchain download (~1.3 GB) that gets you running in minutes. + +If bootstrap fails during install (server unreachable from your network), you can manually transfer: + +```bash +# From a machine that can reach the bootstrap server: +curl -O http://194.233.88.206:8085/triangles-bootstrap.tar.gz +scp triangles-bootstrap.tar.gz pi@your-pi:/tmp/ + +# On the Pi: +sudo systemctl stop triangles +cd /root/.triangles +tar xzf /tmp/triangles-bootstrap.tar.gz +sudo systemctl start triangles +``` ## Tor Integration -trianglesd v5.4.4 includes built-in Tor management: +trianglesd manages Tor automatically: +- Starts Tor as a child process on port 19099 +- Generates a `.onion` hidden service address +- Connects to onion seed nodes +- No manual Tor configuration needed -- **Automatic Tor startup** - No manual configuration needed -- **Hidden service generation** - Creates .onion address automatically -- **SOCKS proxy** - Built-in at port 19099 -- **Peer connectivity** - Connects to onion seed nodes +**Do NOT** set `onion=` or `tor=` in the config — the daemon handles everything. -**Check your onion address:** -```bash -trianglesd getinfo | grep onion -``` +## Automated Builds -## Support +New releases are built automatically via GitHub Actions when upstream triangles_v5 publishes a release. The CI uses QEMU ARM64 emulation on GitHub-hosted runners. -- **GitHub Issues:** [Report bugs or request features](https://github.com/SamiAhmed7777/tri-pi/issues) -- **Upstream:** [triangles_v5](https://github.com/SamiAhmed7777/triangles_v5) +**Manual trigger:** [Actions](https://github.com/SamiAhmed7777/tri-pi/actions) → "Build TRI-PI ARM64" → "Run workflow" + +## Network + +| Port | Protocol | Purpose | +|------|----------|---------| +| 24112 | TCP | P2P network | +| 19199 | TCP | RPC (localhost only) | +| 19099 | TCP | Tor SOCKS (internal) | + +## Building from Source + +See [docs/BUILD.md](docs/BUILD.md) for complete build instructions. ## License -See LICENSE file in the source repository. +See LICENSE file in the [source repository](https://github.com/SamiAhmed7777/triangles_v5). --- -Built with ❤️ for the Raspberry Pi and ARM64 community +Built with ❤️ for the Raspberry Pi community diff --git a/VERSION b/VERSION index 6ad4ab4..268fccb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v5.4.4 \ No newline at end of file +v5.5.0 diff --git a/bootstrap.sh b/bootstrap.sh index f2e0cb8..91b34b3 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,18 +1,23 @@ #!/bin/bash # TRI-PI Bootstrap Installer -# Ultra-lightweight initial download with optional blockchain bootstrap +# One-liner: curl -sSL https://raw.githubusercontent.com/SamiAhmed7777/tri-pi/main/bootstrap.sh | sudo bash +# +# Downloads the latest release, installs dependencies, creates systemd service, +# and optionally bootstraps the blockchain. ~60 second setup. set -e -VERSION="v5.4.4" -BINARY_URL="https://github.com/SamiAhmed7777/tri-pi/raw/main/releases/trianglesd-upx" -BLOCKCHAIN_URL="http://194.233.88.206:8085/triangles-bootstrap.tar.gz" - echo "╔═══════════════════════════════════════╗" -echo "║ TRI-PI $VERSION Bootstrap Installer ║" +echo "║ TRI-PI Bootstrap Installer ║" echo "╚═══════════════════════════════════════╝" echo "" +# Must be root +if [ "$(id -u)" != "0" ]; then + echo "❌ Error: Run as root (use sudo)" + exit 1 +fi + # Check ARM64 ARCH=$(uname -m) if [[ "$ARCH" != "aarch64" ]]; then @@ -21,135 +26,162 @@ if [[ "$ARCH" != "aarch64" ]]; then exit 1 fi -echo "✓ ARM64 architecture detected" +echo "✓ ARM64 detected" + +# Get latest release version from GitHub +echo "🔍 Checking latest release..." +VERSION=$(curl -sL https://api.github.com/repos/SamiAhmed7777/tri-pi/releases/latest | grep '"tag_name"' | cut -d'"' -f4) +if [ -z "$VERSION" ]; then + echo "⚠️ Could not detect latest version, using v5.5.0" + VERSION="v5.5.0" +fi +echo " Latest: $VERSION" # Install dependencies echo "" echo "📦 Installing dependencies..." -sudo apt-get update -qq -sudo apt-get install -y tor curl bc > /dev/null 2>&1 - +apt-get update -qq +apt-get install -y -qq tor curl > /dev/null 2>&1 echo "✓ Dependencies installed" -# Download binary +# Download release package echo "" -echo "⬇️ Downloading trianglesd binary (1.6MB, UPX-compressed)..." +PACKAGE_URL="https://github.com/SamiAhmed7777/tri-pi/releases/download/$VERSION/tri-pi-${VERSION}-arm64.tar.gz" +echo "⬇️ Downloading TRI-PI $VERSION..." TMP_DIR=$(mktemp -d) cd "$TMP_DIR" -if ! curl -L -o trianglesd "$BINARY_URL" 2>/dev/null; then - echo "❌ Download failed. Falling back to full package..." - PACKAGE_URL="https://github.com/SamiAhmed7777/tri-pi/releases/download/$VERSION/tri-pi-$VERSION-arm64.tar.gz" - curl -L -o tri-pi.tar.gz "$PACKAGE_URL" - tar xzf tri-pi.tar.gz - cd tri-pi-$VERSION-arm64 - sudo cp bin/trianglesd /usr/local/bin/ -else - echo "✓ Binary downloaded" - chmod +x trianglesd - sudo cp trianglesd /usr/local/bin/ +if ! curl -sL -o tri-pi.tar.gz "$PACKAGE_URL"; then + echo "❌ Download failed: $PACKAGE_URL" + rm -rf "$TMP_DIR" + exit 1 fi -# Verify installation -echo "" -echo "✅ Binary installed!" -trianglesd --version +DL_SIZE=$(du -sh tri-pi.tar.gz | cut -f1) +echo "✓ Downloaded ($DL_SIZE)" -# Create config directory -mkdir -p ~/.triangles +# Extract and install +echo "" +echo "📦 Installing..." +tar xzf tri-pi.tar.gz -# Blockchain bootstrap option -echo "" -echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -echo " Blockchain Sync Options" -echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" -echo "" -echo "Choose sync method:" -echo " [1] Download bootstrap blockchain (FAST - recommended for Pi)" -echo " ~500MB download, start at current block height" -echo "" -echo " [2] Sync from scratch (SLOW - may take days on Pi)" -echo " Start from genesis block" -echo "" -read -p "Your choice [1/2]: " SYNC_CHOICE +cp bin/trianglesd /usr/local/bin/ +chmod +x /usr/local/bin/trianglesd +echo "✓ Binary installed" -if [[ "$SYNC_CHOICE" == "1" ]]; then - echo "" - echo "⬇️ Downloading blockchain bootstrap..." - echo " This will save hours/days of initial sync!" - echo "" +# Data directory +DATA_DIR="/root/.triangles" +mkdir -p "$DATA_DIR" + +# Generate config +if [ ! -f "$DATA_DIR/triangles.conf" ]; then + RPC_PASS=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32) - if curl -L -o blockchain.tar.gz "$BLOCKCHAIN_URL" 2>/dev/null; then - echo "✓ Blockchain downloaded" - echo "📦 Extracting to ~/.triangles/ ..." - - tar xzf blockchain.tar.gz -C ~/ - - BLOCK_HEIGHT=$(grep -oP 'Block Height: \K[0-9]+' ~/snapshot-info.txt 2>/dev/null || echo "latest") - echo "✓ Blockchain extracted (starting from block $BLOCK_HEIGHT)" - rm -f blockchain.tar.gz ~/snapshot-info.txt - else - echo "⚠️ Bootstrap download failed, will sync from scratch" - fi -else - echo "✓ Will sync from genesis block" -fi - -# Generate random RPC password -RPC_PASS=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32) - -# Create config if needed -if [[ ! -f ~/.triangles/triangles.conf ]]; then - echo "" - echo "📝 Creating configuration..." - cat > ~/.triangles/triangles.conf << CONFIG + cat > "$DATA_DIR/triangles.conf" << CONFIG +# TRI-PI $VERSION Configuration server=1 -daemon=1 listen=1 -txindex=1 -# RPC settings -rpcuser=trianglesrpc +# RPC +rpcuser=tripi rpcpassword=$RPC_PASS rpcallowip=127.0.0.1 -rpcport=8332 +rpcport=19199 # Network -port=8333 +port=24112 maxconnections=50 -# Performance tuning for Raspberry Pi +# Performance tuning for ARM/Pi dbcache=100 maxmempool=50 + +# Seed nodes +addnode=194.233.88.206 +addnode=74.208.167.19 +addnode=179.189.35.51 CONFIG + chmod 600 "$DATA_DIR/triangles.conf" echo "✓ Configuration created" +else + echo "✓ Existing config preserved" fi -# Enable Tor service -sudo systemctl enable tor > /dev/null 2>&1 -sudo systemctl start tor > /dev/null 2>&1 -echo "✓ Tor service enabled" +# Systemd service +cat > /etc/systemd/system/triangles.service << SERVICE +[Unit] +Description=Triangles Cryptocurrency Node +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/trianglesd -daemon=0 -datadir=$DATA_DIR +ExecStop=/usr/local/bin/trianglesd -datadir=$DATA_DIR stop +Restart=on-failure +RestartSec=30 +TimeoutStopSec=120 +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target +SERVICE + +systemctl daemon-reload +systemctl enable triangles > /dev/null 2>&1 +echo "✓ Systemd service installed" + +# Blockchain bootstrap +echo "" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo " Blockchain Sync" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "" +echo " [1] Download bootstrap (~1.3GB) — FAST, recommended" +echo " [2] Sync from peers — slow (days/weeks on Pi)" +echo "" +read -p " Choice [1/2]: " SYNC_CHOICE + +if [[ "$SYNC_CHOICE" == "1" ]]; then + BOOTSTRAP_URL="http://194.233.88.206:8085/triangles-bootstrap.tar.gz" + echo "" + echo "⬇️ Downloading blockchain bootstrap..." + + if curl -L --connect-timeout 30 --max-time 600 -o /tmp/triangles-bootstrap.tar.gz "$BOOTSTRAP_URL" 2>/dev/null; then + echo "✓ Downloaded" + echo "📦 Extracting..." + tar xzf /tmp/triangles-bootstrap.tar.gz -C "$DATA_DIR/" + rm -f /tmp/triangles-bootstrap.tar.gz + echo "✓ Blockchain deployed" + else + echo "⚠️ Bootstrap unreachable — will sync from peers" + fi +fi # Cleanup -cd ~ +cd / rm -rf "$TMP_DIR" +# Start the node +echo "" +echo "🚀 Starting Triangles node..." +systemctl start triangles +sleep 3 + +if systemctl is-active --quiet triangles; then + echo "✓ Node is running!" +else + echo "⚠️ Node may still be starting — check: journalctl -u triangles -f" +fi + echo "" echo "╔═══════════════════════════════════════╗" -echo "║ Installation Complete! ║" +echo "║ ✅ Installation Complete! ║" echo "╚═══════════════════════════════════════╝" echo "" -echo "🚀 Start your node:" -echo " trianglesd" +echo "📊 Check status: trianglesd -datadir=$DATA_DIR getinfo" +echo "📋 View logs: journalctl -u triangles -f" +echo "🧅 Onion address: cat $DATA_DIR/onion/hostname" +echo "🔄 Auto-starts on boot" echo "" -echo "📊 Check status:" -echo " trianglesd getinfo" -echo "" -echo "🔍 View your onion address (after first run):" -echo " cat ~/.triangles/onion/private_key" -echo "" -echo "💡 Tip: First sync may take a while. Check progress with:" -echo " watch -n5 'trianglesd getinfo | grep blocks'" -echo "" -echo "Happy mining! 🎯" diff --git a/install.sh b/install.sh index 9660451..29c8698 100755 --- a/install.sh +++ b/install.sh @@ -1,11 +1,14 @@ #!/bin/bash -# TRI-PI v5.4.4 ARM64 Installation Script +# TRI-PI ARM64 Installation Script # For Raspberry Pi 4/5 (64-bit) and ARM64 servers set -e +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +VERSION=$(cat "$SCRIPT_DIR/VERSION" 2>/dev/null || echo "unknown") + echo "=====================================" -echo "TRI-PI v5.4.4 ARM64 Installer" +echo " TRI-PI $VERSION ARM64 Installer" echo "=====================================" if [ "$(id -u)" != "0" ]; then @@ -25,80 +28,154 @@ echo "✓ ARM64 architecture detected" # Install dependencies echo "Installing dependencies..." -apt-get update -apt-get install -y tor curl +apt-get update -qq +apt-get install -y -qq tor curl > /dev/null 2>&1 echo "✓ Dependencies installed" # Install binary echo "Installing trianglesd..." -cp bin/trianglesd /usr/local/bin/ +cp "$SCRIPT_DIR/bin/trianglesd" /usr/local/bin/ chmod +x /usr/local/bin/trianglesd echo "✓ Binary installed to /usr/local/bin/trianglesd" -# Create data directory -mkdir -p ~/.triangles +# Determine data directory +DATA_DIR="/root/.triangles" +mkdir -p "$DATA_DIR" # Create config -if [ ! -f ~/.triangles/triangles.conf ]; then +if [ ! -f "$DATA_DIR/triangles.conf" ]; then echo "Creating default configuration..." RPC_PASS=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32) - cat > ~/.triangles/triangles.conf << CONFIG -# TRI-PI v5.4.4 Configuration + cat > "$DATA_DIR/triangles.conf" << CONFIG +# TRI-PI $VERSION Configuration server=1 -daemon=1 listen=1 -txindex=1 - -# Tor integration (trianglesd manages tor automatically) -# Do NOT set onion= or tor= - let trianglesd handle it - -# Seed nodes (updated v5.4.4) -addnode=gxvrhv3qitnc6kobrhsrse46bmcfitnybapor3or3oczzuxn6hfzxyid.onion -addnode=i6tk7soznftvoibtskwlezviskiererhjndpsmrff4kaxw7jnd5izfqd.onion -addnode=uddaxjbo3lh2zskg7w6gwln4ty5cel7q4c5jbx7fdtv6zf2j47gdlyad.onion -addnode=el5sirhhleecuctpeeprelzubpqmoqivvra3rzlwbjttinxa4fq3wnid.onion -addnode=sj5dhybnlp3v4y5niyc5unrnd6s43lyx5ibup7rolyosjbi2u2hsbvyd.onion -addnode=i3kr5meha7se4ns3wss3h7v46m6uksfzv4wrohdqxpj6n35wyo2bvlid.onion -addnode=futmtrvh6j34t7s6yjdxfia6iwuyfzwh4k5eqfof5kfhoqk3xmi3qoqd.onion # RPC settings rpcuser=tripi rpcpassword=$RPC_PASS rpcallowip=127.0.0.1 -rpcport=24113 +rpcport=19199 -# Performance -maxconnections=125 +# Network +port=24112 +maxconnections=50 + +# Performance tuning for ARM/Pi +dbcache=100 +maxmempool=50 + +# Seed nodes +addnode=194.233.88.206 +addnode=74.208.167.19 +addnode=179.189.35.51 CONFIG - chmod 600 ~/.triangles/triangles.conf - echo "✓ Configuration created at ~/.triangles/triangles.conf" + chmod 600 "$DATA_DIR/triangles.conf" + echo "✓ Configuration created at $DATA_DIR/triangles.conf" else echo "✓ Existing configuration found" fi -# Enable Tor -echo "Enabling Tor service..." -systemctl enable tor -systemctl start tor +# Install systemd service +echo "Installing systemd service..." +cat > /etc/systemd/system/triangles.service << SERVICE +[Unit] +Description=Triangles Cryptocurrency Node +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/trianglesd -daemon=0 -datadir=$DATA_DIR +ExecStop=/usr/local/bin/trianglesd -datadir=$DATA_DIR stop +Restart=on-failure +RestartSec=30 +TimeoutStopSec=120 +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target +SERVICE + +systemctl daemon-reload +systemctl enable triangles > /dev/null 2>&1 +echo "✓ Systemd service installed and enabled" + +# Offer blockchain bootstrap +echo "" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo " Blockchain Sync Options" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "" + +if [ -f "$DATA_DIR/blk0001.dat" ]; then + EXISTING_SIZE=$(du -sh "$DATA_DIR/blk0001.dat" | cut -f1) + echo " Existing blockchain data found ($EXISTING_SIZE)" + echo "" + read -p " Skip bootstrap and keep existing data? [Y/n]: " KEEP_EXISTING + if [[ "$KEEP_EXISTING" =~ ^[Nn] ]]; then + DO_BOOTSTRAP=1 + else + DO_BOOTSTRAP=0 + fi +else + echo " [1] Download bootstrap blockchain (FAST — recommended)" + echo " ~1.3GB download, starts near current block height" + echo "" + echo " [2] Sync from scratch (SLOW — days/weeks on Pi)" + echo " Start from genesis block" + echo "" + read -p " Your choice [1/2]: " SYNC_CHOICE + [[ "$SYNC_CHOICE" == "1" ]] && DO_BOOTSTRAP=1 || DO_BOOTSTRAP=0 +fi + +if [ "$DO_BOOTSTRAP" -eq 1 ]; then + BOOTSTRAP_URL="http://194.233.88.206:8085/triangles-bootstrap.tar.gz" + echo "" + echo "⬇️ Downloading blockchain bootstrap (~1.3GB)..." + echo " This will save days of initial sync time." + echo "" + + if curl -L --connect-timeout 30 --max-time 600 -o /tmp/triangles-bootstrap.tar.gz "$BOOTSTRAP_URL" 2>/dev/null; then + DL_SIZE=$(du -sh /tmp/triangles-bootstrap.tar.gz | cut -f1) + echo "✓ Downloaded ($DL_SIZE)" + echo "📦 Extracting to $DATA_DIR/ ..." + + # Remove old blockchain data before extracting + rm -rf "$DATA_DIR/blk0001.dat" "$DATA_DIR/txleveldb" "$DATA_DIR/database" + tar xzf /tmp/triangles-bootstrap.tar.gz -C "$DATA_DIR/" + rm -f /tmp/triangles-bootstrap.tar.gz + + echo "✓ Blockchain bootstrap deployed" + else + echo "⚠️ Bootstrap download failed (server unreachable)" + echo " No worries — your node will sync from peers instead." + echo " Tip: you can manually scp a bootstrap later." + fi +fi echo "" echo "=====================================" -echo "✅ TRI-PI v5.4.4 Installation Complete!" +echo " ✅ TRI-PI $VERSION Installed!" echo "=====================================" echo "" -echo "Quick Start:" -echo " trianglesd # Start daemon" -echo " trianglesd getinfo # Check status" -echo " trianglesd help # List commands" +echo "🚀 Start your node:" +echo " sudo systemctl start triangles" echo "" -echo "Data directory: ~/.triangles" -echo "Config file: ~/.triangles/triangles.conf" +echo "📊 Check status:" +echo " trianglesd -datadir=$DATA_DIR getinfo" echo "" -echo "Tor will generate onion address on first run." -echo "Check onion address with: trianglesd getinfo" +echo "📋 View logs:" +echo " journalctl -u triangles -f" +echo " tail -f $DATA_DIR/debug.log" +echo "" +echo "🧅 Tor onion address (generated on first run):" +echo " cat $DATA_DIR/onion/hostname" +echo "" +echo "🔄 The node will auto-start on boot." echo ""