Skip to content

Add production-ready FCT auto-miner#1

Open
RogerPodacter wants to merge 3 commits into
mainfrom
auto-miner-feature
Open

Add production-ready FCT auto-miner#1
RogerPodacter wants to merge 3 commits into
mainfrom
auto-miner-feature

Conversation

@RogerPodacter

Copy link
Copy Markdown
Member

Summary

  • Adds a production-ready auto-mining system with intelligent strategies
  • Replaces SQLite with JSON for zero native dependencies
  • Fixes critical FCT calculation bug (SDK's calculateInputGasCost was wrong)

How to Try It

Quick Start

# Install dependencies
pnpm install

# Basic auto-mining with cost limit and budget
pnpm auto --max-cost 0.0005 --budget 0.01

# Mine during off-peak hours (2-6 AM)
pnpm auto -H 2-6 --budget 0.02

# Arbitrage mode - only mine when cheaper than DEX
pnpm auto --strategy arbitrage

# View analytics and performance
pnpm auto:analyze

Key Features

  • Smart Mining: Automatically mines when conditions are favorable
  • Budget Control: Set daily ETH budgets to limit exposure
  • Cost Optimization: Focus on cost/FCT (the only metric that matters)
  • Schedule Mining: Mine during specific hours
  • Crash Recovery: Persists state to JSON, resumes after restarts
  • Real Analytics: Track efficiency, best hours, ROI

Available Commands

pnpm auto              # Start auto-miner with default settings
pnpm auto:profiles     # View example configurations
pnpm auto:analyze      # View mining statistics

Configuration Options

  • --max-cost <usd> - Maximum cost per FCT in USD (e.g., 0.0005)
  • --budget <eth> - Daily budget in ETH (e.g., 0.01)
  • -H, --hours <range> - Hours to mine (e.g., '2-6,14-18')
  • --strategy <type> - Mining strategy: auto or arbitrage
  • --target <fct> - Stop after mining this much FCT
  • --min-efficiency <percent> - Minimum mining efficiency

Important Fix

This PR fixes a critical bug where we were using the SDK's calculateInputGasCost which underestimates gas by ~60%. Now using the correct formula: non_zero_bytes * 40 + zero_bytes * 10 gas.

Test Plan

  • Tested auto-mining on mainnet
  • Verified cost calculations match actual L1 receipts
  • Tested crash recovery and session persistence
  • Verified budget limits work correctly
  • Tested schedule-based mining

RogerPodacter and others added 3 commits August 8, 2025 10:34
Major Features:
- Auto-mining engine with configurable rules and strategies
- JSON-based persistence (no native dependencies)
- Budget-aware data sizing optimization
- Real-time efficiency tracking and analytics
- Graceful shutdown and crash recovery

Key Improvements:
- Fixed FCT calculation to use correct calldata gas formula (40 gas per non-zero byte)
- Removed SDK's broken calculateInputGasCost dependency
- Simplified strategies to focus on cost/FCT (the only metric that matters)
- Added budget-aware sizing to prevent overspending
- Session persistence for crash recovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants