Skip to content

CryptoGnome/orb_miner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– ORB Autonomous Mining Bot

TypeScript Solana License

Fully autonomous Solana mining bot with Monte Carlo-optimized bet sizing, real-time profitability analysis, and Next.js dashboard. image

+139% Avg ROI β€’ Monte Carlo Optimized β€’ Real-Time EV β€’ Dynamic Scaling


πŸ“š New to Node.js, Servers, or Mining Bots?

Complete Beginner's Installation Guide: INSTALLATION_GUIDE.md

This comprehensive guide covers everything step-by-step:

  • βœ… Installing prerequisites (Node.js, Git, etc.)
  • βœ… Creating and securing your Solana wallet
  • βœ… Detailed installation for Windows, Mac, and Linux
  • βœ… First-time setup with screenshots explanations
  • βœ… Monitoring, updating, and troubleshooting
  • βœ… 24/7 server deployment guide

Already familiar with Node.js? Continue with the Quick Start below.


What is ORB?

ORB is a lottery-style mining game on Solana where miners deploy SOL to a 5x5 grid (25 blocks). One random block wins each round, and all miners on that block share the rewards: SOL from losers + 4 ORB + motherload bonus (1/625 chance).

This bot deploys to all 25 blocks to maximize win probability and uses mathematical optimization to determine optimal bet sizing.


Quick Start

⚠️ Use a FRESH, dedicated wallet - Never use your main wallet!

Option 1: Local Development (Easiest)

For running on your local computer with automatic browser setup:

# 1. Clone and install
git clone https://github.com/CryptoGnome/orb_miner.git
cd orb_miner
npm run setup

# 2. Fund wallet with 1-5+ SOL

# 3. Start bot + dashboard together
npm start

# 4. Browser opens automatically to setup wizard
# Enter your PRIVATE_KEY (encrypted & stored securely)
# Optional: Custom RPC endpoint
# Optional: Dashboard password

# 5. That's it! Mining starts automatically

The bot handles everything: deployments, claims, swaps, and restarts. Press Ctrl+C to stop.

Monitor Dashboard: http://localhost:3888 Change Settings: http://localhost:3888/settings (no restart needed!)


Option 2: Server Deployment (Production)

For running 24/7 on a Linux server (VPS, dedicated server, etc.):

# 1. Clone and install
git clone https://github.com/CryptoGnome/orb_miner.git
cd orb_miner
npm run setup

# 2. Fund wallet with 1-5+ SOL

# 3. Start DASHBOARD FIRST (for initial setup)
npm run start:dashboard
# Dashboard runs on http://YOUR_SERVER_IP:3888

# 4. Access setup wizard from your browser
# Visit: http://YOUR_SERVER_IP:3888/setup
# Enter your PRIVATE_KEY (encrypted & stored securely)
# IMPORTANT: Set a strong dashboard password for remote access!
# Optional: Custom RPC endpoint

# 5. Stop dashboard (Ctrl+C) after setup is complete

# 6. Start with PM2 for 24/7 operation
npm install -g pm2
pm2 start npm --name "orb-bot" -- run start:bot && pm2 start npm --name "orb-dashboard" -- run start:dashboard
pm2 save
pm2 startup  # Follow the instructions it gives you

# 7. Monitor with PM2
pm2 logs              # View all logs (real-time)
pm2 logs orb-bot      # Bot logs only
pm2 logs orb-dashboard # Dashboard logs only
pm2 status            # Check status
pm2 restart orb-bot orb-dashboard    # Restart both processes (SAFE)

Access Dashboard Remotely: http://YOUR_SERVER_IP:3888

Why dashboard first? The bot requires PRIVATE_KEY to be configured before it can run. The dashboard provides a secure web interface to configure this and other critical settings.

πŸ“‹ Detailed Setup Instructions

Prerequisites

  • Node.js v16+ (Download)
  • Fresh Solana wallet (create new, don't reuse existing)
  • 1-5+ SOL for mining
  • Base58 private key

Setup Steps

  1. Clone repository

    git clone https://github.com/CryptoGnome/orb_miner.git
    cd orb_miner
  2. Install dependencies

    npm run setup  # Installs bot + dashboard dependencies
  3. Fund wallet

    • Minimum: 1 SOL (testing)
    • Recommended: 5+ SOL (sustained mining)
  4. Start bot + dashboard

    npm start  # Runs bot AND dashboard

    Browser automatically opens to setup wizard

  5. Complete setup wizard

    • Enter your Base58 private key (encrypted with AES-256-GCM)
    • Optional: Custom RPC endpoint (has default)
    • Click "Complete Setup"

    Export private key from Phantom: Settings β†’ Show Private Key

  6. Bot starts mining automatically!

    Or run components separately:

    npm run start:bot        # Bot only
    npm run start:dashboard  # Dashboard only
  7. Monitor logs (optional, new terminal)

    tail -f logs/combined.log

Key Features

🧠 Intelligence

  • Monte Carlo optimized (10,000 simulations per tier)
  • Real-time EV calculation before every deployment
  • Kelly Criterion-inspired bankroll management
  • Dynamic scaling with motherload changes

⚑ Automation

  • Fully autonomous operation
  • Web-based setup wizard (auto-opens browser)
  • Live settings updates (no restart needed!)
  • Auto-claim rewards (SOL/ORB)
  • Auto-swap ORB β†’ SOL with price floor protection
  • Auto-restart when motherload changes 40-50%+
  • Dynamic priority fees (saves 90%+ during quiet periods)

πŸ›‘οΈ Safety

  • Only mines when EV > 0
  • Motherload threshold gating
  • Price floor protection
  • Balance reserves
  • Full transaction transparency

πŸ“Š Monitoring & Management

  • Next.js 16 dashboard with real-time stats
  • User-friendly settings page (60+ options)
  • SQLite-based configuration & PnL tracking
  • Transaction history
  • Round analytics
  • No .env files needed!

Essential Commands

# Running
npm start                  # Start bot + dashboard
npm run start:bot          # Bot only
npm run start:dashboard    # Dashboard only (port 3888)

# Building
npm run build             # Compile TypeScript bot
npm run build:dashboard   # Build Next.js dashboard

# Testing
npx ts-node tests/test-query.ts              # Check balances & status
npx ts-node tests/test-live-profitability.ts # Check profitability
npx ts-node tests/test-fee-estimation.ts     # Test RPC fee support

# Utilities
npm run pnl:reconcile     # Reconcile P&L data
npm run simulate          # Run Monte Carlo simulations
πŸ› οΈ More Commands
# Manual Operations
npx ts-node tests/test-deploy.ts        # Manual deploy to all 25 squares
npx ts-node tests/test-claim.ts         # Claim rewards manually
npx ts-node tests/test-swap.ts          # Swap ORB to SOL
npx ts-node tests/test-stake.ts         # Stake ORB tokens
npx ts-node tests/test-close-automation.ts  # Close automation account

# Profitability Analysis
npx ts-node tests/test-accurate-profitability.ts  # Detailed EV breakdown

# Account Management
npx ts-node tests/check-automation-account.ts     # Check automation status

# Development
npm run dev               # Bot with nodemon auto-reload
npm run clean            # Remove dist/ directory
npm run pnl:reset        # Reset P&L tracking

πŸš€ Production Deployment with PM2

For running the bot 24/7 on a Linux server, see Option 2: Server Deployment above for complete setup instructions.

Important Setup Order for Servers

  1. βœ… Dashboard first - Run npm run start:dashboard to access setup wizard
  2. βœ… Configure settings - Visit http://YOUR_SERVER_IP:3888/setup and set PRIVATE_KEY + password
  3. βœ… Start with PM2 - Use the PM2 start command below for 24/7 operation

Why this order? The bot cannot start without PRIVATE_KEY configured. The dashboard provides a secure web interface to set this up remotely.

PM2 Start Command

pm2 start npm --name "orb-bot" -- run start:bot && pm2 start npm --name "orb-dashboard" -- run start:dashboard
pm2 save

Updating & Restarting

When new features are released, update your bot safely:

Quick Update (Recommended):

cd ~/orb_miner
git pull
npm run update  # Installs deps, rebuilds, auto-restarts PM2 if running

The npm run update script automatically:

  • βœ… Installs/updates dependencies (root + dashboard)
  • βœ… Clears Next.js cache
  • βœ… Rebuilds TypeScript
  • βœ… Restarts PM2 processes if running (orb-bot & orb-dashboard)

Manual Update (Alternative):

cd ~/orb_miner

# 1. Pull latest changes
git pull

# 2. Install any new dependencies (if package.json changed)
npm install
cd dashboard && npm install && cd ..

# 3. Rebuild (if code changed)
npm run build
npm run build:dashboard

# 4. Restart ONLY orb miner processes (safe for shared servers)
pm2 restart orb-bot orb-dashboard

# 5. Verify it's working
pm2 logs orb-bot --lines 20

Important: Use pm2 restart orb-bot orb-dashboard instead of pm2 restart all if you have other PM2 processes running. This ensures only the bot is restarted, not your other services!

PM2 Management Commands

# View status
pm2 list
pm2 status

# View logs (real-time)
pm2 logs                # All processes
pm2 logs orb-bot        # Bot only
pm2 logs orb-dashboard  # Dashboard only

# Restart processes (recommended - safe methods)
pm2 restart orb-bot orb-dashboard    # Restart only orb miner by name (RECOMMENDED)
# CAUTION: Only use 'pm2 restart all' if no other PM2 processes are running!
pm2 stop orb-bot orb-dashboard       # Stop only orb miner
pm2 delete orb-bot orb-dashboard     # Remove from PM2

# Save and auto-start on reboot
pm2 save
pm2 startup  # Follow the instructions it outputs

# Monitor resources
pm2 monit

PM2 Logs

All logs are automatically captured by PM2 and stored in ~/.pm2/logs/:

  • ~/.pm2/logs/orb-bot-out.log - Bot output
  • ~/.pm2/logs/orb-bot-error.log - Bot errors
  • ~/.pm2/logs/orb-dashboard-out.log - Dashboard output
  • ~/.pm2/logs/orb-dashboard-error.log - Dashboard errors

View logs in real-time: pm2 logs or pm2 logs orb-bot or pm2 logs orb-dashboard


πŸ“Š Monitoring

Real-Time Dashboard

Open http://localhost:3888 when bot is running to see:

  • Live balances and PnL
  • Recent transactions
  • Round history
  • Analytics and charts

Log Files

tail -f logs/combined.log      # All logs
tail -f logs/error.log          # Errors only
tail -f logs/transactions.log   # Transaction signatures

Quick Status Check

npx ts-node tests/test-query.ts

Shows: Wallet balances, automation balance, claimable rewards, current round, motherload


🧠 How It Works

πŸ“ Monte Carlo Optimization

The bot uses 10,000-simulation Monte Carlo analysis to determine optimal bet sizing for each motherload tier.

Optimized Tiers

Motherload Rounds SOL/Round Avg ROI Strategy
1200+ ORB 60 ~1.67% +76% Ultra Aggressive
1000-1099 ORB 120 ~0.83% +125% Very Aggressive
700-799 ORB 240 ~0.42% +172% PEAK
500-599 ORB 320 ~0.31% +165% Conservative
300-399 ORB 400 ~0.25% +125% Ultra Conservative
200-299 ORB 440 ~0.23% +74% Maximum Safety

Based on 10,000 simulations per tier with 20x competition

Why This Matters:

  • Each tier was tested through thousands of simulations
  • Maximizes ROI while keeping risk of ruin < 5%
  • Accounts for 1/625 win chance, competition, and fees
  • Proven +139% average ROI vs +74% with naive strategies

Run simulations yourself: npm run simulate

πŸ“Š Real-Time EV Calculation

The bot calculates Expected Value (EV) before every deployment using live on-chain data:

  1. Fetches Live Competition - Reads totalDeployed from Round account
  2. Calculates Your Share - Determines exact % of total deployment
  3. Gets Current ORB Price - Fetches live price from Jupiter DEX
  4. Computes EV:
    Expected ORB = Your Share Γ— (4 ORB + Motherload/625)
    Expected ORB (post-fee) = Expected ORB Γ— 0.9
    Expected SOL Back = Your Deployment Γ— 0.95
    
    EV = (Expected ORB Γ— ORB Price) + Expected SOL Back - Your Deployment
    
  5. Only Mines When EV > 0 - Skips unprofitable rounds

Example Calculation

Your Deployment: 0.18 SOL
Total Competition: 7.77 SOL (live on-chain data)
Your Share: 2.3%
ORB Price: 0.124 SOL ($24.80)

Expected ORB: 0.112 ORB Γ— 0.124 = 0.014 SOL
Expected SOL Back: 0.174 SOL
Expected Value: +0.008 SOL (4.4% ROI) βœ… PROFITABLE

This protects you from mining when competition is too high or ORB price drops.

πŸ”„ Dynamic Scaling & Auto-Restart

The bot continuously monitors motherload and automatically adjusts:

  • 50%+ Increase: Closes automation, recreates with larger bets
    • Example: 300 β†’ 500 ORB = 67% larger bets to maximize EV
  • 40%+ Decrease: Closes automation, recreates with smaller bets
    • Example: 500 β†’ 280 ORB = 44% smaller bets to preserve capital

Benefits:

  • Always betting optimally for current conditions
  • No manual intervention needed
  • Reclaims remaining SOL before restart (nothing wasted)
πŸ›‘οΈ Safety Features

Multiple layers of protection prevent losses:

  1. Motherload Threshold - Won't mine unless rewards >= threshold (default: 100 ORB)
  2. EV Gating - Skips rounds where EV < 0
  3. Price Floor - Won't swap ORB below minimum USD price (default: $30)
  4. Balance Reserves - Maintains minimum SOL/ORB balances
  5. Fractional Betting - Never risks >1.67% per round (even at max aggression)
  6. Auto-Depletion Detection - Closes automation when budget exhausted
⚑ Dynamic Fee Optimization

The bot auto-detects RPC fee estimation support and optimizes transaction fees:

  • RPC Detection: Supports Helius, Triton, QuickNode fee APIs
  • Network-Based Fees: Adjusts based on real-time congestion
  • Cost Savings: 90%+ savings during quiet periods
  • Reliable Landing: Ensures txs land during busy periods

Test your RPC:

npx ts-node tests/test-fee-estimation.ts

Recommended RPCs:

See FEE_OPTIMIZATION.md for details.


βš™οΈ Configuration

Configuration Options

All settings managed via dashboard at http://localhost:3888/settings

No .env file needed! Key settings:

# Mining Thresholds
MOTHERLOAD_THRESHOLD: 100               # Min motherload to mine
ENABLE_PRODUCTION_COST_CHECK: true     # Gate on EV > 0 (recommended)
MIN_EXPECTED_VALUE: 0                  # Min EV in SOL

# Budget Allocation
INITIAL_AUTOMATION_BUDGET_PCT: 90      # % of wallet SOL for automation

# Auto-Claim
AUTO_CLAIM_SOL_THRESHOLD: 0.1          # Claim when >= 0.1 SOL
AUTO_CLAIM_ORB_THRESHOLD: 1.0          # Claim when >= 1.0 ORB

# Auto-Swap
AUTO_SWAP_ENABLED: true                # Auto-swap ORB β†’ SOL
WALLET_ORB_SWAP_THRESHOLD: 0.1         # Swap when >= 0.1 ORB
MIN_ORB_PRICE_USD: 30                  # Won't sell below $30

# Auto-Stake (optional)
AUTO_STAKE_ENABLED: false              # Enable ORB staking
STAKE_ORB_THRESHOLD: 50                # Stake when >= 50 ORB

# Priority Fees
PRIORITY_FEE_LEVEL: medium             # low/medium/high/veryHigh
MIN_PRIORITY_FEE_MICRO_LAMPORTS: 100
MAX_PRIORITY_FEE_MICRO_LAMPORTS: 50000

# Testing
DRY_RUN: false                         # Simulate without real txs

Configuration Features:

  • βœ… Web-based settings editor
  • βœ… AES-256 encryption for sensitive data
  • βœ… Live updates - changes take effect without restart!
  • βœ… 60+ configurable settings
  • βœ… Input validation & safety checks
  • βœ… Stored in SQLite database

See dashboard settings page for full list with descriptions.


πŸ’° Development Fee

This bot includes a 0.5% development fee on each deployment to support ongoing development and maintenance.

Example: Deploy 1 SOL β†’ 0.005 SOL fee (0.5%) + 0.995 SOL for mining


πŸ”§ Troubleshooting

Common Issues

Bot not deploying

  • Check profitability: npx ts-node tests/test-live-profitability.ts
  • Check logs: tail -f logs/combined.log
  • Possible reasons:
    • EV < 0 (competition too high or ORB price too low)
    • Motherload below threshold
    • Automation account depleted

"Insufficient funds" error

  • Check wallet balance: npx ts-node tests/test-query.ts
  • Lower INITIAL_AUTOMATION_BUDGET_PCT in dashboard settings
  • Fund wallet with more SOL

Automation account issues

# Check status
npx ts-node tests/check-automation-account.ts

# Close and restart (reclaims remaining balance)
npx ts-node tests/test-close-automation.ts

Transaction failures

  • Check RPC endpoint is working
  • View tx on Solscan
  • Tx signatures logged in logs/transactions.log

Test with dry run

Set DRY_RUN=true in dashboard settings to simulate without real transactions


πŸ§ͺ Testing Before Real Mining

  1. Set DRY_RUN=true in dashboard settings (http://localhost:3888/settings)
  2. Run npm start
  3. Bot will simulate all operations without sending real transactions

Profitability Check:

npx ts-node tests/test-live-profitability.ts

πŸ”’ Security

Best Practices

  • βœ… Use a FRESH, dedicated wallet - Create new wallet specifically for this bot
  • βœ… Never use your main wallet with significant holdings
  • βœ… Test with small amounts first (1-2 SOL)
  • βœ… Keep offline backup of private key
  • βœ… Monitor logs regularly
  • βœ… Use reputable RPC endpoints
  • βœ… Protect database file (data/orb_mining.db) with proper file permissions

Built-in Protections

  • AES-256-GCM encryption for sensitive data (PRIVATE_KEY)
  • Encryption key unique per installation
  • Multi-layer safety checks
  • Balance reserves
  • Price floor protection
  • EV-based gating
  • Input validation on all settings

⚠️ Disclaimer

BETA SOFTWARE - Use caution and start with small amounts.

Risks

  • πŸ’Έ Capital Risk - You can lose SOL if you don't win rounds
  • πŸ› Smart Contract Risk - Bugs or exploits in ORB/ORE contracts
  • 🌐 Network Risk - Transaction failures, congestion, RPC issues
  • πŸ“‰ Market Risk - ORB price volatility affects profitability
  • 🎲 Lottery Risk - No guaranteed returns (1/625 chance per round)

USE AT YOUR OWN RISK. Only mine with funds you can afford to lose.

This software is provided "as-is" without warranty of any kind. The developers are not responsible for any losses incurred.


πŸ’¬ Support

GitHub Issues ORB Protocol

Questions? Open an issue

Updates? Star/Watch this repo to stay notified


🌟 If this bot helps you win ORB, consider starring the repo!

Made with ❀️ by the community

GitHub stars GitHub forks


Happy Mining! πŸš€

Powered by Monte Carlo optimization and real-time EV analysis

About

A fully automated bot with advanced mathematical optimization for $ORB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages