Getting Started with Off-the-Grid Ergo Trading Bot

This guide provides a thorough walkthrough for setting up and operating the Off-the-Grid decentralized grid trading bot on the Ergo blockchain.

Prerequisites

  • Knowledge and Tools:
    • Basic understanding of the Ergo blockchain and grid trading strategies
    • Familiarity with Rust and CLI tools
  • Environment Setup:
    • Installed Rust and Cargo
    • Configured Ergo node and wallet
  • Nix Installation (Optional): For easier building, install Nix.

Overview of Off-the-Grid

  • Decentralized, automated grid trading on Ergo
  • Secure contract-based trading ensuring order safety
  • Off-chain bots for order tracking and execution
  • Compatible with Spectrum AMM for liquidity matching
Limitations: Contracts are not audited—exercise caution with significant assets. Profits are not guaranteed.

Step-by-Step Guide

  1. Clone and Build the Repository
    • Clone:git clone https://github.com/Telefragged/off-the-grid.git
    • Build with Nix (recommended):nix buildExecutable in ./result/bin/off-the-grid
    • Or with Cargo:cargo build --releaseExecutable in ./target/release/off-the-grid
  2. Node Setup
    • Update node_config.json with your node's API URL and API key:
      {
        "api_url": "http://127.0.0.1:9053",
        "api_key": "your-wallet-api-key"
      }
    • Set up and sync your Ergo wallet
    • Generate scans config:off-the-grid scans create-configAdd --rescan to include all boxes
  3. Fetch Token Information (Optional)
    • off-the-grid tokens updateFetches token details from Spectrum
  4. Create Grid Orders
    • Command:off-the-grid grid create -t <token_name> -v <total_value> -o <num_orders> -r <high>-<low> -i <grid_id>
    • Example:off-the-grid grid create -t COMET -v 10 -o 50 -r 50000-100000 -i comet
    • Review and confirm the transaction using on-screen prompts
  5. Manage and Monitor Grids
    • List active grids:off-the-grid grid list
    • View grid details:off-the-grid grid details -i <grid_id>
    • Redeem grid orders:off-the-grid grid redeem -i <grid_id>
  6. Run the Matching Bot
    • Configure matcher reward address in matcher_config.json:
      {
        "reward_address": "your_reward_address"
      }
      Or set as environment variable:export MATCHER_REWARD_ADDRESS="your_reward_address"
    • Start the matcher:off-the-grid matcher
    • The bot logs successful transactions and errors. Multiple matchers may compete for transactions.
  7. Optimize and Analyze
    • Monitor logs:off-the-grid logs tail
    • Experiment with parameters for optimal results
    • Integrate analytics (e.g., Spectrum) to track performance

Best Practices

  • Security: Safeguard your API keys and wallet credentials
  • Caution: Avoid over-investing in untested strategies or assets
  • Stay Updated: Keep the bot, tokens, and configs up-to-date

For additional assistance, consult the repository's documentation or contact the community.