AutoMiner
AutoMiner is MINERAL's automated play system for Block Mining. Instead of manually deploying every ~60 seconds, you deposit ETH, choose a strategy, and an executor bot handles every round on your behalf.
Quick Start
- Configure — Pick a strategy (SPREAD, RANDOM, or SELECT) and set your budget per round
- Deposit — Send ETH to the AutoMiner contract
- Let it run — The executor bot deploys for you each round automatically
- Claim winnings — Call
claim(roundId)on BlockMining directly when you win
Strategies
SPREAD (Safest)
Deploys your budget equally across all 25 squares every round.
- You always have a position on the winning square
- Your share per win is smaller (split across all squares)
- Best for: passive players who want consistent participation
RANDOM
Deploys to N random squares each round (you choose N from 1–25).
- Square selection changes every round (pseudo-random based on your address + round ID)
- Higher concentration = higher payout when you win, but less frequent wins
- Best for: players who want variety without manual effort
SELECT
Deploys to your chosen squares every round.
- You select specific square indices (e.g.,
[0, 6, 12, 18, 24]) - Same squares every round — useful if you have a favorite pattern
- Best for: players with a specific strategy in mind
How It Works
┌─────────────────────────────────────────────────────────────┐
│ USER │
│ │
│ 1. configure(SPREAD, [], 0, 0.025 ETH) + deposit 5 ETH │
│ 2. Sits back and waits │
│ 3. Claims from BlockMining when they win │
└──────────────────────┬───────────────────────────────────────┘
│
┌──────────────────────▼───────────────────────────────────────┐
│ AUTO MINER CONTRACT │
│ │
│ Holds: 5 ETH balance │
│ Config: SPREAD, 0.025 ETH/round │
│ Status: ACTIVE │
└──────────────────────┬───────────────────────────────────────┘
│
┌──────────────────────▼───────────────────────────────────────┐
│ EXECUTOR BOT (off-chain) │
│ │
│ Every ~60s: │
│ 1. Check if round is active │
│ 2. Call executeAll() on AutoMiner │
│ 3. AutoMiner calls BlockMining.deployFor(user, squares) │
│ 4. When round ends: call settle() │
└──────────────────────┬───────────────────────────────────────┘
│
┌──────────────────────▼───────────────────────────────────────┐
│ BLOCK MINING CONTRACT │
│ │
│ Position recorded under user's address (not AutoMiner) │
│ User claims winnings directly │
└─────────────────────────────────────────────────────────────┘
Parameters
| Parameter | Value |
|---|---|
| Minimum Budget | 0.001 ETH per round |
| Maximum Budget | 10 ETH per round |
| Auto-deactivation | When balance < budget per round |
| Re-activation | Deposit more or call activate() |
Contract Functions
User Functions
| Function | Description |
|---|---|
configure(strategy, squares, numSquares, budgetPerRound) | Set strategy and optionally deposit ETH |
deposit() | Add more ETH to your balance |
withdraw(amount) | Withdraw ETH from your balance |
activate() | Re-enable auto-mining after deactivation |
deactivate() | Pause auto-mining (keeps your balance) |
View Functions
| Function | Description |
|---|---|
getMinerConfig(address) | Get a miner's strategy, budget, balance, and status |
getSelectedSquares(address) | Get squares for SELECT strategy |
getActiveMinerCount() | Total number of active auto-miners |
getActiveMiners() | List all active miner addresses |
Key Design Decisions
Positions belong to users, not AutoMiner
When AutoMiner calls deployFor(user, squares), the position is recorded under the user's address in BlockMining — not AutoMiner's address. This means:
- Users claim winnings directly from BlockMining
- Winnings go to the user's wallet, not back to AutoMiner
- If AutoMiner is paused or upgraded, user positions are unaffected
Executor-gated execution
Only the authorized executor address can call executeRound() or executeAll(). This prevents griefing attacks where someone could drain user balances by repeatedly executing with bad timing.
Auto-deactivation
When a miner's balance drops below their budget per round, they are automatically deactivated and removed from the active list. This prevents the executor from wasting gas on failed deploys.
Receive() accepts deposits
Sending ETH directly to the AutoMiner contract is treated as a deposit for the sender. If the sender has a configured strategy and the deposit brings their balance above the budget threshold, they are automatically re-activated.
Security
- ReentrancyGuard on all state-modifying functions
- Pausable — Owner can pause in emergencies
- Ownable2Step — Two-step ownership transfer
- No user funds at risk — Users can always
withdraw()their balance - Executor isolation — Only the authorized executor can trigger deploys
- Active miner list — Efficient O(1) add/remove with swap-and-pop pattern