Skip to content

Reprofilat/botj

Repository files navigation

OpenOracle Competitive Settlement Bot

⚠️ CRITICAL SECURITY WARNING ⚠️

  • NEVER use your main wallet for this bot
  • Create a dedicated bot wallet with minimal funds
  • Only deposit what you're willing to lose
  • This is experimental software - use at your own risk

Overview

This is a highly optimized settlement bot for the OpenOracle system on Arbitrum. The bot monitors for profitable settlement opportunities and executes them automatically.

Key Features

  1. Gas-Optimized Smart Contract (CompetitiveSettleBot.sol)

    • Assembly optimizations for minimal gas usage
    • Batch settlement capabilities
    • MEV protection mechanisms
    • Priority queue for maximum profitability
  2. Intelligent Bot Runner (bot-runner.js)

    • Real-time opportunity scanning
    • Dynamic gas price management
    • Concurrent transaction handling
    • Performance tracking and metrics
  3. Monitoring System (monitor.js)

    • Health checks and alerts
    • Discord notifications
    • Performance reporting
    • Error tracking

Quick Start

1. Setup

# Clone the repository
git clone <your-repo>
cd ClaudeCodeBOT

# Install dependencies
npm install

# Copy environment file
cp .env.example .env

2. Configuration

Edit .env file:

# REQUIRED - Bot wallet private key (create a new wallet!)
BOT_PRIVATE_KEY=your_private_key_here

# Optional - Deploy bot contract for better performance
BOT_CONTRACT=

# Optional - Discord alerts
DISCORD_WEBHOOK=your_webhook_url

3. Running the Bot

Option A: Direct Settlement (No contract deployment)

# Run simulation first to check profitability
npm run simulate

# Start the bot
npm start

Option B: Optimized with Smart Contract

# Deploy the contract
npm run deploy

# Add BOT_CONTRACT to .env

# Start the bot
npm start

4. Monitoring

In a separate terminal:

npm run monitor

Architecture

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│   Bot Runner    │────▶│ CompetitiveBot   │────▶│   OpenOracle    │
│  (bot-runner.js)│     │   (optional)     │     │    Contract     │
└─────────────────┘     └──────────────────┘     └─────────────────┘
        │                                                  │
        │                                                  │
        ▼                                                  ▼
┌─────────────────┐                              ┌─────────────────┐
│    Monitor      │                              │ SmartAutoBeacon │
│  (monitor.js)   │                              │   (fallback)    │
└─────────────────┘                              └─────────────────┘

RPC Redundancy

The bot includes multiple RPC endpoints for maximum reliability:

  • Primary: Your custom RPC (if set in .env)
  • Fallbacks:
    • Arbitrum Official
    • Lava Network
    • Blast API
    • Omnia Tech
    • Alchemy
    • BlockPI
    • 1RPC
    • Ankr
    • PublicNode

The bot automatically switches to the next RPC if one fails, ensuring continuous operation.

Bot Strategies

1. Flash Settlement (Fastest)

  • Minimal validation
  • Direct execution
  • Best for high-competition scenarios

2. Smart Settlement (Balanced)

  • Profitability analysis
  • Gas optimization
  • Recommended for normal operation

3. MEV Protected (Secure)

  • Commit-reveal mechanism
  • Anti-frontrunning
  • Use in high-value scenarios

Performance Optimization

Gas Savings Tips

  1. Use the bot contract for batch operations
  2. Monitor gas prices and set appropriate limits
  3. Focus on high-reward settlements
  4. Avoid settling during network congestion

Speed Optimization

  1. Run multiple bot instances with different strategies
  2. Use dedicated RPC endpoints
  3. Minimize logging in production
  4. Keep the processed reports cache small

Safety Guidelines

DO:

  • ✅ Use a dedicated bot wallet
  • ✅ Start with small amounts
  • ✅ Monitor bot performance
  • ✅ Keep private keys secure
  • ✅ Test on mainnet with tiny amounts first

DON'T:

  • ❌ Use your main wallet
  • ❌ Deposit large amounts
  • ❌ Share your private keys
  • ❌ Ignore error messages
  • ❌ Run without monitoring

Troubleshooting

Bot not finding opportunities

  • Check if there are active reports: npm run simulate
  • Verify gas price settings aren't too restrictive
  • Ensure wallet has sufficient balance

Transactions failing

  • Check wallet balance
  • Verify gas limits
  • Look for reverted transactions on Arbiscan

High gas costs

  • Adjust MAX_GAS_PRICE in config
  • Use batch settlements
  • Deploy and use the bot contract

Advanced Configuration

Custom Parameters

// In bot-runner.js CONFIG object
MAX_GAS_PRICE: ethers.utils.parseUnits('0.2', 'gwei'),
MIN_PROFIT_WEI: ethers.utils.parseEther('0.0005'),
SCAN_INTERVAL: 500, // Faster scanning
BATCH_SIZE: 20, // Larger batches

Multiple Instances

Run different strategies in parallel:

# Terminal 1 - Conservative
MIN_PROFIT_ETH=0.001 npm start

# Terminal 2 - Aggressive  
MIN_PROFIT_ETH=0.0001 SCAN_INTERVAL_MS=500 npm start

Resources

Support

For issues or questions:

  1. Check the troubleshooting section
  2. Review bot logs in bot.log
  3. Monitor health reports in ./reports/

License

MIT - Use at your own risk


Remember: This bot handles real money. Start small, monitor closely, and never risk more than you can afford to lose.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors