ESP32 Mining Guide - odelyzid/.AI3 GitHub Wiki

ESP32 Mining Guide

The ESP32 is the cornerstone of .AI3's vision for democratized mining. With devices costing as little as $5-10, anyone can participate in the .AI3 network and earn rewards through AI3 tensor computation mining.

🎯 Why ESP32 Mining?

Revolutionary Low-Cost Mining

  • Hardware Cost: ESP32 development boards start at $5-10
  • Power Consumption: 0.5-3W typical operation
  • 24/7 Operation: Designed for continuous operation
  • Global Accessibility: Available worldwide through distributors

AI3 Advantage

  • Reduced Difficulty: AI3 tensor tasks have lower difficulty than pure PoW
  • Enhanced Rewards: Bonus rewards for completing AI computations
  • Optimized Algorithms: Custom algorithms designed for ESP32 capabilities
  • Smart Task Distribution: Automatic assignment of suitable tasks

🛠️ Hardware Requirements

Minimum Requirements (ESP32)

Component Specification Cost
MCU ESP32 (240MHz dual-core) $5-8
RAM 520KB SRAM Included
Flash 4MB minimum Included
WiFi 802.11 b/g/n 2.4GHz Included
Power 3.3V, 500mA $2-3
Total Complete mining setup $7-11

Recommended Setup (ESP32-S3)

Component Specification Cost
MCU ESP32-S3 (240MHz dual-core) $8-12
RAM 512KB SRAM + 8MB PSRAM Included
Flash 8MB+ recommended Included
WiFi 802.11 b/g/n 2.4GHz Included
Antenna External antenna (optional) $2-3
Heat Sink Thermal management $1-2
Power 3.3V, 1A stable supply $3-5
Total Optimized mining setup $14-22

Supported ESP32 Variants

  • ESP32 - Original, fully supported
  • ESP32-S2 - Single core, basic mining
  • ESP32-S3 - Recommended for best performance
  • ESP32-C3 - RISC-V based, experimental support
  • ⚠️ ESP8266 - Limited support, basic operations only

🚀 Quick Start

1. Hardware Setup

# Connect ESP32 to computer via USB
# No additional wiring required for basic setup

2. Install .AI3

# Clone repository
git clone https://github.com/BitTribe/.AI3.git
cd .AI3

# Build for ESP32
cargo build --release --target xtensa-esp32-none-elf

3. Configure WiFi

# Set WiFi credentials
export WIFI_SSID="YourNetworkName"
export WIFI_PASSWORD="YourPassword"

4. Start Mining

# Flash and start mining
cargo run -- esp32 mine \
  --device-id "ESP32_MINER_001" \
  --wifi-ssid "$WIFI_SSID" \
  --wifi-password "$WIFI_PASSWORD" \
  --ai3-enabled

⚙️ Configuration Options

Basic Configuration

pub struct ESP32Config {
    pub device_id: String,           // Unique miner identifier
    pub wifi_ssid: String,           // WiFi network name
    pub wifi_password: String,       // WiFi password
    pub node_url: String,            // .AI3 node URL
    pub mining_threads: u8,          // 1-2 for ESP32
    pub ai3_enabled: bool,           // Enable AI3 mining
    pub power_limit: f32,            // Power limit in watts
    pub temperature_limit: f32,      // Max temperature (°C)
}

Advanced Settings

# Mining with custom parameters
tribechain esp32 mine \
  --device-id "ESP32_PRO_001" \
  --wifi-ssid "MyNetwork" \
  --wifi-password "SecurePassword" \
  --node-url "http://192.168.1.100:8333" \
  --threads 2 \
  --ai3-enabled \
  --power-limit 2.5 \
  --temperature-limit 75 \
  --sync-interval 60 \
  --difficulty-adjustment auto

🧠 AI3 Tensor Operations

Supported Operations

The ESP32 can perform various AI computations optimized for its hardware:

Matrix Operations

// 4x4 matrix multiplication (optimized for ESP32)
let matrix_a = [[1.0, 2.0, 3.0, 4.0],
                [5.0, 6.0, 7.0, 8.0],
                [9.0, 10.0, 11.0, 12.0],
                [13.0, 14.0, 15.0, 16.0]];

let matrix_b = [[0.1, 0.2, 0.3, 0.4],
                [0.5, 0.6, 0.7, 0.8],
                [0.9, 1.0, 1.1, 1.2],
                [1.3, 1.4, 1.5, 1.6]];

// Result computed on ESP32
let result = esp32_matrix_multiply(matrix_a, matrix_b);

Convolution Operations

// 1D convolution with smoothing kernel
let signal = [1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 3.0, 2.0, 1.0];
let kernel = [0.25, 0.5, 0.25]; // Smoothing kernel

let convolved = esp32_convolution_1d(signal, kernel);

Neural Network Forward Pass

// Simple neural network inference
let input = [0.5, 0.3, 0.8, 0.2];
let weights = [0.1, 0.2], [0.3, 0.4], [0.5, 0.6], [0.7, 0.8](/odelyzid/.AI3/wiki/0.1,-0.2],-[0.3,-0.4],-[0.5,-0.6],-[0.7,-0.8);
let bias = [0.1, 0.2];

let output = esp32_neural_forward(input, weights, bias);

Performance Characteristics

Operation ESP32 Time ESP32-S3 Time Reward Multiplier
Matrix 4x4 ~50ms ~30ms 1.5x
Convolution 1D ~20ms ~15ms 1.3x
Neural Forward ~30ms ~20ms 1.4x
Vector Ops ~10ms ~8ms 1.2x

💡 Power Optimization

Power Management Strategies

// Dynamic power scaling based on temperature
if temperature > 70.0 {
    mining_intensity = 0.5; // Reduce to 50%
} else if temperature > 60.0 {
    mining_intensity = 0.75; // Reduce to 75%
} else {
    mining_intensity = 1.0; // Full power
}

Energy Efficiency Tips

  1. Use External Antenna: Improves WiFi signal, reduces power consumption
  2. Stable Power Supply: Prevents voltage drops and instability
  3. Heat Management: Add heat sinks to maintain optimal temperature
  4. WiFi Optimization: Place near router for strong signal
  5. Task Scheduling: Mine during off-peak hours for better rewards

Power Consumption Analysis

Mode Power Draw Daily Cost* Monthly Earnings**
Idle 0.1W $0.003 -
Basic Mining 1.5W $0.04 $2-5
AI3 Mining 2.5W $0.07 $5-12
Max Performance 3.0W $0.08 $8-15

*Based on $0.12/kWh electricity cost **Estimated based on network conditions

📊 Mining Performance

Expected Hash Rates

Device Hash Rate AI3 Tasks/Hour Daily TRIBE Earnings
ESP32 50-100 H/s 20-40 0.5-2.0 TRIBE
ESP32-S2 30-60 H/s 15-25 0.3-1.2 TRIBE
ESP32-S3 80-150 H/s 30-60 0.8-3.0 TRIBE
ESP32-C3 40-80 H/s 18-35 0.4-1.8 TRIBE

Profitability Calculator

# Check current profitability
tribechain esp32 profitability \
  --device-type ESP32-S3 \
  --power-cost 0.12 \
  --power-draw 2.5

🔧 Troubleshooting

Common Issues

WiFi Connection Problems

❌ Error: WiFi connection failed
✅ Solutions:
   - Verify SSID and password
   - Ensure 2.4GHz network (ESP32 doesn't support 5GHz)
   - Check signal strength
   - Try different WiFi channel

Memory Issues

❌ Error: Out of memory
✅ Solutions:
   - Reduce blockchain cache size
   - Disable unnecessary features
   - Use ESP32-S3 with PSRAM
   - Restart device periodically

Mining Difficulty Too High

❌ Warning: No blocks found in 24 hours
✅ Solutions:
   - Enable AI3 mining for reduced difficulty
   - Join a mining pool
   - Check network connectivity
   - Verify miner configuration

Overheating Issues

❌ Warning: Temperature limit exceeded
✅ Solutions:
   - Add heat sink
   - Improve ventilation
   - Reduce mining intensity
   - Lower ambient temperature

Debug Commands

# Check ESP32 status
tribechain esp32 status --device-id "ESP32_001"

# Monitor performance
tribechain esp32 monitor --device-id "ESP32_001" --interval 10

# Test AI3 operations
tribechain esp32 test-ai3 --operation matrix_multiply

# Network diagnostics
tribechain esp32 network-test --node-url "http://192.168.1.100:8333"

🏭 Mining Pool Setup

Joining a Pool

# Connect to .AI3 mining pool
tribechain esp32 mine \
  --device-id "ESP32_POOL_001" \
  --pool-url "stratum+tcp://pool.tribechain.io:4444" \
  --pool-user "your_wallet_address" \
  --pool-password "x"

Pool Benefits for ESP32

  • Consistent Rewards: Regular payouts instead of sporadic block rewards
  • Lower Variance: Reduced income volatility
  • Shared Resources: Pool handles blockchain synchronization
  • Technical Support: Pool operators provide assistance

📈 Scaling Your Operation

Multi-Device Setup

# Manage multiple ESP32 devices
tribechain esp32 fleet \
  --config-file "esp32_fleet.json" \
  --auto-discovery \
  --load-balancing

Fleet Configuration

{
  "fleet_name": "Home_Mining_Farm",
  "devices": [
    {
      "device_id": "ESP32_001",
      "location": "Living Room",
      "wifi_ssid": "HomeNetwork",
      "ai3_enabled": true
    },
    {
      "device_id": "ESP32_002", 
      "location": "Bedroom",
      "wifi_ssid": "HomeNetwork",
      "ai3_enabled": true
    }
  ],
  "global_settings": {
    "power_limit": 2.5,
    "temperature_limit": 70,
    "sync_interval": 60
  }
}

🔮 Future Enhancements

Planned Features

  • Mesh Networking: ESP32 devices forming local mining networks
  • Edge AI Models: More sophisticated AI computations
  • Solar Power Integration: Renewable energy mining setups
  • Mobile App: Remote monitoring and control
  • Hardware Acceleration: Custom ASIC integration

Community Projects

  • 3D Printed Cases: Custom enclosures for ESP32 miners
  • Solar Mining Kits: Complete off-grid mining solutions
  • Educational Workshops: Teaching ESP32 mining in schools
  • Open Hardware: Community-designed mining boards

📚 Additional Resources

Ready to start mining? Get your ESP32 and join the .AI3 revolution!