apow-cli 0.11.18 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/skill.md CHANGED
@@ -1,868 +1,92 @@
1
1
  ---
2
- name: apow-mine
3
- description: Set up and start mining AGENT tokens on Base L2 using apow-cli. Easy Mode uses x402 for RPC, LLM, and GPU grinding with no config beyond wallet funding.
4
- allowed-tools: Bash(npx:*), Bash(node:*), Bash(npm:*), Bash(curl:*), Bash(cat:*), Bash(echo:*), Bash(ls:*), Bash(mkdir:*)
5
- argument-hint: [setup|mint|mine|stats]
2
+ name: apow-mining
3
+ description: This skill teaches your agent how to mine $AGENT coin via the apow-cli.
4
+ allowed-tools: Bash(npx --yes apow-cli@0.12.0 start --easy)
6
5
  metadata:
7
6
  openclaw:
8
7
  requires:
9
8
  anyBins:
10
9
  - npx
11
- - node
12
10
  ---
13
11
 
14
- # APoW Mining Skill
12
+ # APoW Mining
15
13
 
16
- > A self-contained guide for any AI agent to go from zero knowledge to actively mining AGENT tokens on Base.
14
+ Use this skill only to set up a fresh APoW mining wallet and run the official APoW miner. It is deliberately limited to that workflow.
17
15
 
18
- **For AI agents:** You are the operator. You can generate wallets, configure the miner, mint,
19
- and mine autonomously. The only step that requires your user is funding the wallet with ETH + USDC
20
- on Base. Everything else you handle yourself.
16
+ APoW mining uses real assets on Base. Use a fresh, low-balance hot wallet dedicated to APoW. The CLI stores generated wallets as password-protected JSON keystores and applies a local signing policy with spend caps.
21
17
 
22
- > **Mode guide**
23
- > - **Easy Mode** (recommended / beginner path): run `npx apow-cli start` or `npx apow-cli setup`, choose `Easy Mode`, let the CLI generate a wallet and private key if needed, then hand the user the funding address. No API keys or pre-existing `PRIVATE_KEY` are required up front.
24
- > - **Advanced Mode:** bring your own wallet, RPC, LLM, and grinder settings via `.env` or the interactive setup flow.
18
+ ## Required approval
25
19
 
26
- ---
27
-
28
- ## Quick Start (TL;DR)
29
-
30
- **Via npm (recommended):**
31
- ```bash
32
- npx apow-cli start # zero-config happy path: setup -> funding checks -> mint -> mine
33
- ```
34
-
35
- **Via source:**
36
- ```bash
37
- git clone https://github.com/Agentoshi/apow-cli.git
38
- cd apow-cli && npm install
39
- npx tsx src/index.ts start
40
- ```
41
-
42
- ### Recommended Agent Flow — Easy Mode
43
-
44
- For OpenClaw and other interactive agents, start here. Do not ask the user for a `PRIVATE_KEY`
45
- before running Easy Mode.
46
-
47
- ```bash
48
- npx apow-cli start
49
- ```
50
-
51
- 1. Choose `Easy Mode`
52
- 2. If no wallet exists yet, let the CLI generate it and show the new Base address
53
- 3. Hand the funding address to the user and explain they need ETH for gas + minting and USDC for the x402 stack
54
- 4. If they want the built-in bridge, use `npx apow-cli fund`; otherwise let them fund the wallet manually
55
- 5. After funding arrives, rerun `npx apow-cli start` to continue through minting and mining
56
-
57
- Easy Mode writes the x402-backed config for the user. The manual requirement is funding the newly
58
- generated wallet, not bringing a private key or API keys ahead of time.
59
-
60
- ### Headless Fallback — Reproduce Easy Mode Defaults Manually
61
-
62
- Only use this if the environment cannot drive the interactive CLI prompts. This reproduces the
63
- same zero-credential x402 stack that Easy Mode would write for you.
64
-
65
- ```bash
66
- # 1. Generate a wallet
67
- npx apow-cli wallet new
68
- # Captures address + private key from output (and can save a plaintext import helper plus encrypted keystore)
69
-
70
- # 2. Write .env directly — headless fallback for Easy Mode
71
- # Contract addresses are built-in defaults — no need to specify them
72
- cat > .env << 'EOF'
73
- PRIVATE_KEY=0x<from step 1>
74
- USE_X402=true
75
- USE_X402_GRIND=true
76
- LLM_PROVIDER=clawrouter
77
- LLM_MODEL=blockrun/eco
78
- ALLOW_LOCAL_FALLBACK_WITH_X402=false
79
- EOF
80
-
81
- # 3. Start mining — the CLI handles funding checks, minting, and mining
82
- npx apow-cli start
83
- ```
84
-
85
- In headless shells like OpenClaw, treat funding as a user handoff. Do not run `apow fund`
86
- without explicit `--chain` and `--token` flags. If `npx apow-cli start` reports that funding
87
- is needed, show the wallet address, explain the funding options, wait for the user to fund the
88
- wallet or pick a route, then rerun `npx apow-cli start`.
89
-
90
- ### Advanced Mode / Manual Flow
91
-
92
- If you prefer to use your own LLM API key instead of ClawRouter:
93
-
94
- ```bash
95
- cat > .env << 'EOF'
96
- PRIVATE_KEY=0x<your key>
97
- RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_KEY # Free from alchemy.com
98
- LLM_PROVIDER=openai
99
- LLM_MODEL=gpt-4o-mini
100
- LLM_API_KEY=<your key>
101
- MINING_AGENT_ADDRESS=0xB7caD3ca5F2BD8aEC2Eb67d6E8D448099B3bC03D
102
- AGENT_COIN_ADDRESS=0x12577CF0D8a07363224D6909c54C056A183e13b3
103
- EOF
104
-
105
- npx apow-cli mint
106
- npx apow-cli mine
107
- ```
108
-
109
- ---
110
-
111
- ## 1. What is APoW?
112
-
113
- Agent Proof-of-Work (APoW) is a mining protocol on Base L2 where AI agents prove their identity once by minting an ERC-721 Mining Rig NFT (requires LLM to solve an SMHL challenge), then compete on hash power to mine AGENT tokens. Mining requires owning a Miner NFT (ERC-721 with rarity-based hashpower) and no LLM is needed after minting. Rewards start at 3 AGENT per mine (scaled by hashpower) and decay by 10% every 500,000 total network mines, with a hard cap of 21,000,000 AGENT.
114
-
115
- ### SMHL Challenge Format
116
-
117
- SMHL ("Show Me Human Language") serves two different roles in APoW:
118
-
119
- **SMHL for Minting (identity verification):** When minting a Mining Rig, your LLM solves an SMHL challenge to prove agent capability. This is the "prove yourself" gate: your agent demonstrates it can solve constrained text generation. The LLM receives a prompt like: "Generate a sentence that is approximately N characters long, contains approximately W words, and includes the letter 'X'."
120
-
121
- **SMHL for Mining (algorithmic):** During mining, SMHL solutions are generated algorithmically in microseconds, with no LLM needed. Your AI was already proven when you minted your Mining Rig. Mining is a hash power competition, not a language puzzle.
122
-
123
- On-chain verification checks (both minting and mining):
124
- 1. **Length** (in bytes): within ±5 of the target
125
- 2. **Word count**: within ±2 of the target
126
- 3. **Character presence**: the specified letter appears at least once
127
-
128
- The miner client validates locally before submitting.
129
-
130
- ---
131
-
132
- ## 2. Prerequisites
133
-
134
- | Requirement | Details |
135
- |---|---|
136
- | **Node.js** | v20 or higher |
137
- | **Base wallet** | Easy Mode: none up front, the CLI can create one for you. Advanced Mode: existing private key with ETH on Base for gas + mint fee. |
138
- | **USDC on Base** | 2.00 USDC minimum starting balance in the mining wallet for x402 RPC / ClawRouter / remote grind; more gives headroom |
139
- | **LLM access** | Easy Mode: none up front, uses ClawRouter via x402. Advanced Mode: API key (OpenAI, Gemini, etc.) or local Ollama for minting. |
140
- | **git** | Only if installing from source (not needed for npm) |
141
-
142
- ---
143
-
144
- ## 3. Step 1: Create a Mining Wallet
145
-
146
- In Easy Mode, the normal path is to let `apow start` or `apow setup` create the mining wallet for
147
- you. You do not need to arrive with a `PRIVATE_KEY`.
148
-
149
- ```bash
150
- npx apow-cli start
151
- # Choose "Easy Mode"
152
- # Select "No" when asked if you have a wallet → generates one automatically
153
- ```
154
-
155
- You can also generate one directly (useful for agents, headless shells, or Advanced Mode):
156
-
157
- ```bash
158
- npx apow-cli wallet new
159
- ```
160
-
161
- This outputs a private key (0x + 64 hex chars) and Base address, saves a plaintext `wallet-<address>.txt` import helper to the current directory, and can also create an encrypted `wallet-<address>.json` keystore under `~/.apow/keystores/` when a password is available. If you are using a manual or headless flow, put that key in your `.env` as `PRIVATE_KEY`.
162
-
163
- **Exporting an existing wallet:** If you've already set up a wallet and need to retrieve the key:
164
-
165
- ```bash
166
- npx apow-cli wallet export
167
- ```
168
-
169
- This prompts for confirmation, then displays your address and private key. It can save a plaintext `wallet-<address>.txt` import helper and/or an encrypted JSON keystore backup.
170
-
171
- **Exporting to a wallet app:** The user can import this private key into Phantom, MetaMask, Rainbow, or any EVM-compatible wallet to view their AGENT tokens and Mining Rig NFT alongside their other assets.
172
-
173
- ---
174
-
175
- ## 4. Funding Your Wallet
176
-
177
- Your mining wallet needs ETH on Base for gas and the mint fee.
178
- **Minimum:** 0.005 ETH (~$15) covers minting + several mining cycles.
179
-
180
- ### Built-in Bridge: `apow fund` (Recommended)
181
-
182
- The CLI bridges from Solana or Ethereum via [Squid Router](https://squidrouter.com/) (Chainflip), or accepts deposits directly on Base. `apow start` can use this flow automatically. Auto-splits into ETH (gas) + USDC (x402 RPC):
183
-
184
- ```bash
185
- npx apow-cli fund # Interactive: choose chain + token
186
- npx apow-cli fund --chain solana --token sol # Bridge SOL → ETH+USDC on Base
187
- npx apow-cli fund --chain solana --token usdc # Bridge Solana USDC → Base
188
- npx apow-cli fund --chain ethereum # Bridge ETH from Ethereum mainnet → Base
189
- npx apow-cli fund --chain base # Show address, wait for deposit
190
- npx apow-cli fund --chain base --no-swap # Skip auto-split
191
- ```
192
-
193
- **Solana/Ethereum bridging:** Generates a one-time deposit address with QR code. Send tokens from any wallet (Phantom, MetaMask, etc.). Requires `SQUID_INTEGRATOR_ID` in `.env` (free at [squidrouter.com](https://app.squidrouter.com/)). Bridge time: ~1-3 minutes via Chainflip.
194
-
195
- **Auto-split:** After bridging, the CLI checks ETH and USDC balances. If either is below the minimum (0.003 ETH for gas, 2.00 USDC for the x402 starting balance), it swaps the needed amount via Uniswap V3 on Base. Use `--no-swap` to skip.
196
-
197
- ### Manual Funding Options
198
-
199
- If you prefer not to use the built-in bridge:
200
-
201
- #### From Solana (Phantom Wallet)
202
- Phantom natively supports Base. Tell your user:
203
- 1. Open Phantom → tap the **Swap** icon
204
- 2. Set **From:** SOL (Solana) → **To:** ETH (Base)
205
- 3. Enter amount (≥0.005 ETH worth of SOL)
206
- 4. Tap **Review** → **Swap**
207
- 5. Once ETH arrives on Base, tap **Send** → paste the mining wallet address
208
- 6. Confirm the transfer
209
-
210
- #### From an Exchange (Coinbase, Binance, etc.)
211
- 1. Buy ETH on Base (Coinbase supports Base withdrawals natively)
212
- 2. Withdraw to the mining wallet address
213
- 3. Select **Base** as the network. Do NOT send on Ethereum mainnet
214
-
215
- #### From Ethereum Mainnet
216
- Bridge ETH to Base via [bridge.base.org](https://bridge.base.org):
217
- 1. Connect source wallet → enter mining wallet address as recipient
218
- 2. Bridge ≥0.005 ETH → arrives on Base in ~10 minutes
219
-
220
- #### From Another Base Wallet
221
- Send ETH directly to the mining wallet address on Base.
222
-
223
- ### Verifying Funds
224
- After funding, verify the balance:
225
- ```bash
226
- npx apow-cli stats
227
- # Shows wallet balance; must be ≥0.005 ETH to proceed
228
- ```
229
-
230
- ---
231
-
232
- ## 5. Step 2: Install Miner Client
233
-
234
- **Via npm (no install needed):**
235
- ```bash
236
- npx apow-cli start
237
- # or: npx apow-cli setup
238
- ```
239
- All `apow` commands work via `npx` with no global install required.
240
-
241
- **Via source (for developers):**
242
- ```bash
243
- git clone https://github.com/Agentoshi/apow-cli.git
244
- cd apow-cli && npm install
245
- # Use `npx tsx src/index.ts` instead of `npx apow-cli` for all commands
246
- ```
247
-
248
- ---
249
-
250
- ## 6. Step 3: Configure Environment (Advanced Mode / Manual Setup)
251
-
252
- Skip this section for Easy Mode. The CLI writes the equivalent config for you during `apow start`
253
- or `apow setup`. Use a manual `.env` only when you want full control or need a headless fallback.
254
-
255
- Run `npx apow-cli setup` for interactive configuration, or create a `.env` file manually in your working directory:
256
-
257
- ```bash
258
- # === Required ===
259
-
260
- # Your wallet private key (0x-prefixed, 64 hex chars)
261
- # Required for manual / headless minting and mining commands
262
- PRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE
263
-
264
- # Built-in Base mainnet defaults. Only override if you want a different deployment.
265
- MINING_AGENT_ADDRESS=0xB7caD3ca5F2BD8aEC2Eb67d6E8D448099B3bC03D
266
- AGENT_COIN_ADDRESS=0x12577CF0D8a07363224D6909c54C056A183e13b3
267
-
268
- # === LLM Configuration (required for minting only; mining uses optimized solving) ===
269
-
270
- # Provider: "clawrouter" (recommended) | "openai" | "gemini" | "deepseek" | "qwen" | "anthropic" | "ollama" | "claude-code" | "codex"
271
- # clawrouter: zero credentials, pays with USDC from your wallet via x402
272
- LLM_PROVIDER=clawrouter
273
-
274
- # API key (not required if LLM_PROVIDER=clawrouter, ollama, claude-code, or codex)
275
- # LLM_API_KEY=sk-your-api-key
276
-
277
- # Model name (provider-specific)
278
- LLM_MODEL=blockrun/eco
279
-
280
- # === Network ===
281
-
282
- # Base RPC endpoint (optional if USE_X402=true). Get a free URL from alchemy.com (no credit card).
283
- # Or set USE_X402=true instead for auto-pay via QuickNode (2.00 USDC minimum starting balance; add more for headroom).
284
- RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_KEY
285
-
286
- # Chain: "base" | "baseSepolia" (auto-detected from RPC_URL if omitted)
287
- CHAIN=base
288
- ```
289
-
290
- ### Environment Variable Reference
291
-
292
- | Variable | Required | Default | Description |
293
- |---|---|---|---|
294
- | `PRIVATE_KEY` | Manual / headless only | - | Wallet private key (0x + 64 hex chars). Easy Mode generates this for you if no wallet exists yet. |
295
- | `KEYSTORE_PASSWORD` | No | unset | If set, `wallet new`/`wallet export` also create an encrypted JSON keystore backup under `~/.apow/keystores/` |
296
- | `MINING_AGENT_ADDRESS` | No | built-in Base mainnet address | MiningAgent contract address. Override only for another deployment or network. |
297
- | `AGENT_COIN_ADDRESS` | No | built-in Base mainnet address | AgentCoin contract address. Override only for another deployment or network. |
298
- | `LLM_PROVIDER` | No | `clawrouter` if `USE_X402=true`, else `openai` | LLM provider for minting: `clawrouter` (recommended, zero credentials), `openai`, `gemini`, `deepseek`, `qwen`, `anthropic`, `ollama`, `claude-code`, `codex`. Not needed for mining. |
299
- | `LLM_API_KEY` | Only for cloud providers that require one | - | API key for minting. Not needed for `clawrouter`, `ollama`, `claude-code`, `codex`, or mining. Falls back to `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `DEEPSEEK_API_KEY`, `DASHSCOPE_API_KEY`. |
300
- | `LLM_MODEL` | No | per-provider default (e.g. `blockrun/eco`, `gpt-4o-mini`) | Model identifier passed to the provider (minting only). Auto-detected from provider if omitted. |
301
- | `CLAWROUTER_PORT` | No | `8402` | Port for ClawRouter local proxy (only if default is in use) |
302
- | `MINER_THREADS` | No | All CPU cores | Threads for JS nonce grinding (fallback if no native GPU/CPU grinder detected) |
303
- | `RPC_URL` | No* | — | Base JSON-RPC endpoint. Get a free URL from Alchemy or QuickNode. *Not needed if `USE_X402=true`. |
304
- | `USE_X402` | No | `false` | Set to `true` to auto-pay via QuickNode x402 (2.00 USDC minimum starting balance; add more for headroom). Replaces `RPC_URL`. |
305
- | `CHAIN` | No | `base` | Network selector; auto-detects `baseSepolia` if RPC URL contains "sepolia" |
306
- | `SOLANA_RPC_URL` | No | `https://api.mainnet-beta.solana.com` | Solana RPC endpoint (only for `apow fund --chain solana`) |
307
- | `ETHEREUM_RPC_URL` | No | `https://cloudflare-eth.com` | Ethereum mainnet RPC (only for `apow fund --chain ethereum`) |
308
- | `OLLAMA_URL` | No | `http://127.0.0.1:11434` | Ollama server URL (only if `LLM_PROVIDER=ollama`) |
309
- | `GRINDER_MODE` | No | `auto` | Grinder mode: `auto` (detect native binaries) or `js` (force JS worker_threads) |
310
- | `GPU_GRINDER_PATH` | No | auto-detected | Explicit path to Metal GPU grinder binary |
311
- | `CUDA_GRINDER_PATH` | No | auto-detected | Explicit path to local CUDA grinder binary |
312
- | `CPU_GRINDER_PATH` | No | auto-detected | Explicit path to CPU-C grinder binary |
313
- | `CPU_THREADS` | No | All CPU cores | Thread count for CPU-C grinder |
314
- | `USE_X402_GRIND` | No | same as `USE_X402` | Enable remote GPU grinding via x402 (dynamic pricing, ~$0.006/grind). Set `false` to disable even when `USE_X402=true`. |
315
- | `GRIND_URL` | No | `https://grind.apow.io/grind` | Custom GrindProxy endpoint URL (for self-hosted grinding) |
316
- | `VAST_IP` | No | - | Remote VAST.ai GPU host IP (for remote CUDA mining) |
317
- | `VAST_PORT` | No | - | Remote VAST.ai GPU SSH port |
318
- | `REMOTE_GRINDER` | No | `/root/grinder-cuda` | Path to CUDA binary on remote host |
319
- | `SQUID_INTEGRATOR_ID` | No | - | Squid Router integrator ID for deposit address flow (free at [squidrouter.com](https://app.squidrouter.com/)) |
320
-
321
- ### LLM Provider Recommendations (for Minting)
322
-
323
- > An LLM is only needed for **minting** your Mining Rig NFT (one-time identity verification). Mining uses optimized algorithmic SMHL solving, with no LLM needed. Use a fast, non-thinking model to stay within the 20-second challenge window.
324
-
325
- | Provider | Model | Cost per call | Notes |
326
- |---|---|---|---|
327
- | ClawRouter | `blockrun/eco` | ~$0.006 | **Recommended.** Zero credentials, pays with USDC via x402 |
328
- | OpenAI | `gpt-4o-mini` | ~$0.001 | Cheapest API key option, fast, reliable |
329
- | Gemini | `gemini-2.5-flash` | ~$0.001 | Fast, good accuracy |
330
- | DeepSeek | `deepseek-chat` | ~$0.001 | Fast, accessible in China |
331
- | Qwen | `qwen-plus` | ~$0.002 | Alibaba Cloud, accessible in China |
332
- | Anthropic | `claude-sonnet-4-5-20250929` | ~$0.005 | Works but slower and more expensive |
333
- | Ollama | `llama3.1` | Free (local) | Requires local GPU; variable accuracy |
334
-
335
- ### RPC Recommendations
336
-
337
- You need a dedicated RPC endpoint. The public `https://mainnet.base.org` has aggressive rate limits and **will** fail during sustained mining. All providers below offer a **free tier** that is more than sufficient for mining. Alternatively, set `USE_X402=true` for zero-setup auto-pay via QuickNode (2.00 USDC minimum starting balance; add more for headroom).
338
-
339
- #### Option 1: Alchemy (Recommended)
340
-
341
- 1. Go to [alchemy.com](https://www.alchemy.com/) and sign up (free, no credit card)
342
- 2. Click **Create new app** → Name: `apow-miner` → Chain: **Base** → Network: **Base Mainnet**
343
- 3. On the app dashboard, copy the **HTTPS** URL. It looks like:
344
- ```
345
- https://base-mainnet.g.alchemy.com/v2/YOUR_API_KEY
346
- ```
347
- 4. Set in your `.env`:
348
- ```
349
- RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_API_KEY
350
- ```
351
-
352
- **Free tier:** 300M compute units/month (~millions of RPC calls). More than enough for mining.
353
-
354
- #### Option 2: QuickNode
355
-
356
- 1. Go to [quicknode.com](https://www.quicknode.com/) and sign up (free, no credit card)
357
- 2. Click **Create Endpoint** → Chain: **Base** → Network: **Mainnet**
358
- 3. Copy the **HTTP Provider** URL. It looks like:
359
- ```
360
- https://something-something.base-mainnet.quiknode.pro/YOUR_TOKEN/
361
- ```
362
- 4. Set in your `.env`:
363
- ```
364
- RPC_URL=https://something-something.base-mainnet.quiknode.pro/YOUR_TOKEN/
365
- ```
366
-
367
- **Free tier:** 10M API credits/month. Sufficient for a few miners.
368
-
369
- #### Option 3: Other Free RPCs
370
-
371
- | Provider | Free Tier | URL Pattern |
372
- |---|---|---|
373
- | [Infura](https://infura.io/) | 100K req/day | `https://base-mainnet.infura.io/v3/KEY` |
374
- | [Ankr](https://www.ankr.com/) | 30 req/s | `https://rpc.ankr.com/base` (no key needed) |
375
- | [Blast](https://blastapi.io/) | 40 req/s | `https://base-mainnet.blastapi.io/KEY` |
376
-
377
- #### Troubleshooting RPC Issues
378
-
379
- | Symptom | Cause | Fix |
380
- |---|---|---|
381
- | `429 Too Many Requests` | Public RPC rate limit | Switch to a dedicated RPC (Alchemy/QuickNode) |
382
- | `Timed out waiting for next block (60s)` | RPC not responding | Check endpoint URL; try a different provider |
383
- | `fetch failed` / `ECONNREFUSED` | RPC URL is wrong or down | Verify URL; test with `curl YOUR_RPC_URL -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'` |
384
- | Stale data / missed mines | RPC caching or slow sync | Alchemy and QuickNode are fastest; avoid free community RPCs |
385
-
386
- ---
387
-
388
- ## 7. Step 4: Mint a Mining Rig
389
-
390
- **One rig per wallet.** The CLI enforces a one-rig-per-wallet rule. Only one rig can mine competitively per wallet (one mine per block globally), so extra rigs in the same wallet waste ETH. To scale, create additional wallets (see [Scaling with Multiple Wallets](#scaling-with-multiple-wallets) below).
391
-
392
- ```bash
393
- npx apow-cli mint
394
- ```
395
-
396
- **What happens:**
397
- 1. The client calls `getChallenge(yourAddress)` on the MiningAgent contract, which generates a random SMHL challenge and stores the seed on-chain. This is a write transaction (costs gas).
398
- 2. The client derives the challenge parameters from the stored seed and sends them to your LLM.
399
- 3. The LLM generates a sentence matching the constraints (approximate length, approximate word count, must contain a specific letter).
400
- 4. The client calls `mint(solution)` with the mint fee attached. The contract verifies the SMHL solution on-chain.
401
- 5. On success, an ERC-721 Miner NFT is minted to your wallet with a randomly determined rarity and hashpower.
402
- 6. The mint fee is forwarded to the LPVault (used for AGENT/USDC liquidity: initial LP deployment at threshold, then ongoing `addLiquidity()` to deepen the position).
403
-
404
- **Challenge expiry:** 20 seconds from `getChallenge` to `mint`. The LLM must solve quickly. Use a fast, non-thinking model (gpt-4o-mini, gemini-2.5-flash, deepseek-chat).
20
+ Before running the miner, show the user this scope and wait for an explicit approval:
405
21
 
406
- ### Mint Price
22
+ > Approve APoW to create or use one fresh encrypted low-balance wallet; spend up to the local policy caps for one rig mint and x402 RPC, SMHL, and grinding services; submit Base mining transactions continuously until stopped; and sweep mined AGENT only if a payout address and automatic sweep were already configured?
407
23
 
408
- The mint price starts at 0.002 ETH and decays exponentially:
409
- - Decreases by 5% every 100 mints
410
- - Floors at 0.0002 ETH
411
- - Formula: `price = max(0.002 * 0.95^(totalMinted / 100), 0.0002)` ETH
24
+ Do not infer approval from funding, installation, prior mining, or a general request to inspect the project. Run the command only after the user approves the scope above.
412
25
 
413
- ### Rarity Table
414
-
415
- | Tier | Name | Hashpower | Reward Multiplier | Probability |
416
- |---|---|---|---|---|
417
- | 0 | Common | 100 | 1.00x | 60% |
418
- | 1 | Uncommon | 150 | 1.50x | 25% |
419
- | 2 | Rare | 200 | 2.00x | 10% |
420
- | 3 | Epic | 300 | 3.00x | 4% |
421
- | 4 | Mythic | 500 | 5.00x | 1% |
422
-
423
- **Max supply:** 10,000 Miner NFTs.
424
-
425
- ---
426
-
427
- ## 8. Step 5: Start Mining
428
-
429
- ```bash
430
- npx apow-cli mine # auto-detects your best rig
431
- npx apow-cli mine <tokenId> # or specify a rig by token ID
432
- ```
433
-
434
- ### What Each Mining Cycle Does
435
-
436
- 1. **Ownership check:** verifies your wallet owns the specified token.
437
- 2. **Supply check:** confirms mineable supply is not exhausted.
438
- 3. **Fetch challenge:** reads `getMiningChallenge()` from the AgentCoin contract, which returns:
439
- - `challengeNumber` (bytes32): the current PoW challenge hash
440
- - `miningTarget` (uint256): the difficulty target
441
- - `smhl`: the SMHL format challenge
442
- 4. **Solve SMHL:** generates a valid SMHL solution algorithmically (sub-millisecond, no LLM needed).
443
- 5. **Grind nonce:** brute-force search for a `nonce` where `keccak256(challengeNumber, minerAddress, nonce) < miningTarget`. Works on any CPU out of the box. Add a GPU for 100x+ faster grinding.
444
- 6. **Submit proof:** calls `mine(nonce, smhlSolution, tokenId)` on AgentCoin. The contract verifies both the hash and SMHL solution on-chain.
445
- 7. **Collect reward:** AGENT tokens are minted directly to your wallet.
446
- 8. **Wait for next block:** the protocol enforces one mine per block network-wide. The client waits for block advancement before the next cycle.
447
-
448
- ### Reward Economics
449
-
450
- **One mine per block, network-wide.** The protocol allows exactly one successful `mine()` per Base block across the entire network, not per wallet. All miners compete for each block's reward. If two miners submit in the same block, only the first transaction to be included succeeds; the other reverts (and still costs gas).
451
-
452
- | Parameter | Value |
453
- |---|---|
454
- | Base reward | 3 AGENT |
455
- | Hashpower scaling | `reward = baseReward * hashpower / 100` |
456
- | Era interval | Every 500,000 total mines |
457
- | Era decay | 10% reduction per era (`reward * 90 / 100`) |
458
- | Max mineable supply | 18,900,000 AGENT (21M total - 2.1M LP reserve) |
459
- | Difficulty adjustment | Every 64 mines, targeting 5 blocks between mines |
460
-
461
- **Example rewards (Common miner, 100 hashpower = 1.00x):**
462
-
463
- | Era | Total Network Mines | Reward per Mine |
464
- |---|---|---|
465
- | 0 | 0 to 499,999 | 3.00 AGENT |
466
- | 1 | 500,000 to 999,999 | 2.70 AGENT |
467
- | 2 | 1,000,000 to 1,499,999 | 2.43 AGENT |
468
- | 3 | 1,500,000 to 1,999,999 | 2.187 AGENT |
469
-
470
- A Mythic miner (5.00x) earns 15.00 AGENT per mine in Era 0.
471
-
472
- ### Cost Per Mine
473
-
474
- - **Gas:** ~0.001 ETH per `mine()` transaction on Base
475
- - **LLM:** $0 (mining uses algorithmic SMHL, no LLM calls)
476
- - **Total:** ~$0.003 to $0.005 per mining cycle (gas only)
477
-
478
- ### Error Handling
479
-
480
- The miner has built-in resilience:
481
- - **Flat retry delay** on transient failures (about 2s with a small jitter)
482
- - **Max 10 consecutive failures** before the miner exits
483
- - **Fatal errors** cause immediate exit: `"Not your miner"`, `"Supply exhausted"`, `"No contracts"`
484
- - **Block timing** is handled automatically: if the block hasn't advanced, the miner waits
485
-
486
- ---
487
-
488
- ## 9. Step 6: Monitor
26
+ Once approved, select the CLI's existing Easy Mode with the pinned package:
489
27
 
490
28
  ```bash
491
- npx apow-cli stats # network stats + auto-detect your rig
492
- npx apow-cli stats <tokenId> # stats for a specific rig
29
+ npx --yes apow-cli@0.12.0 start --easy
493
30
  ```
494
31
 
495
- **Network stats output:**
496
- - Total mines (network-wide)
497
- - Total AGENT minted
498
- - Current mining target (difficulty)
499
- - Your wallet's AGENT balance
500
-
501
- **Miner stats output (when tokenId provided):**
502
- - Rarity tier and name
503
- - Hashpower multiplier
504
- - Mint block number
505
- - Total mine count for this rig
506
- - Total AGENT earned by this rig
32
+ Funding is a mandatory external prerequisite: the CLI cannot mint or mine until
33
+ the dedicated wallet has ETH and USDC on Base. The same command handles the two
34
+ phases around that checkpoint:
507
35
 
508
- ---
36
+ - before funding, it creates an encrypted APoW wallet if needed, configures Easy
37
+ Mode, prints the complete Base address and required balances, then stops;
38
+ - after the user funds that address and confirms funding, rerunning it detects
39
+ an existing rig or mints one within the configured cap, starts continuous
40
+ mining, retries normal transient failures, and keeps signing behind the local
41
+ enforce-mode policy.
509
42
 
510
- ## 10. Advanced
43
+ The user's approval authorizes this Easy Mode invocation; Wallet Protocol v2 remains the sole runtime opsec and signing-policy layer. The user can stop mining with Ctrl+C.
511
44
 
512
- ### Competitive Mining & Scaling
45
+ ## Funding handoff
513
46
 
514
- **How mining competition works:** The protocol enforces exactly ONE successful mine per block, network-wide. This is controlled by `lastMineBlockNumber`: once any miner's `mine()` transaction is confirmed in a block, all other `mine()` calls in that same block revert. This is the same winner-takes-all model as Bitcoin: every miner competes for each block's reward, and only one wins.
47
+ If the CLI pauses because the wallet needs funds:
515
48
 
516
- **One rig per wallet (CLI-enforced).** The CLI prevents minting more than one rig per wallet. Only one rig can mine competitively per wallet since only one `mine()` can succeed per block and all rigs in the same wallet share the same address. Extra rigs waste ETH on mint fees with no advantage.
49
+ 1. Return the complete Base wallet address and the ETH and USDC minimums printed by the CLI.
50
+ 2. Tell the user to send those assets to that address on Base.
51
+ 3. Stop. Do not move, convert, or source funds for the user.
52
+ 4. After the user confirms funding, resume the same Easy Mode flow with the pinned `start --easy` command.
517
53
 
518
- ### Scaling with Multiple Wallets
54
+ Funding is a handoff, not permission to operate another wallet or move assets.
519
55
 
520
- To increase your chances of winning each block, run separate wallets, each with its own rig and its own miner process. More wallets = more independent chances to land the winning transaction in each block.
56
+ ## Security boundaries
521
57
 
522
- **The user only funds one wallet.** Use `apow wallet fund` to distribute ETH from the main wallet to sub-wallets. The default amount covers the current mint price + gas buffer, so no manual calculation is needed.
58
+ - Never request, read, reveal, copy, or transmit wallet secrets.
59
+ - Never search files, directories, environment variables, shell history, mounted drives, or other machines for wallets or credentials.
60
+ - Never import or operate a main wallet for this skill.
61
+ - Never create a raw-key file or place a raw wallet secret in project configuration.
62
+ - Invoke only the single pinned `start --easy` command in this skill; every other CLI command is out of scope.
63
+ - Never change the signing policy from `enforce`.
64
+ - Never raise the mint, transfer, sweep, or x402 spend caps.
65
+ - Never install or execute an unpinned package version.
66
+ - Never continue if the package version, contract addresses, chain, approval scope, or policy state differs from what the CLI displays.
523
67
 
524
- **Autonomous agent flow for multi-wallet mining:**
68
+ If setup asks for a keystore password, the user must enter it directly into their local terminal or provide it through their own secret manager. Never ask them to paste it into chat.
525
69
 
526
- ```bash
527
- # 1. Generate sub-wallets (main wallet is already configured in .env)
528
- npx apow-cli wallet new # → address A + key A
529
- npx apow-cli wallet new # → address B + key B
530
- npx apow-cli wallet new # → address C + key C
70
+ ## Expected policy caps
531
71
 
532
- # 2. Fund each sub-wallet from the main wallet (default: mint price + 0.003 ETH gas)
533
- npx apow-cli wallet fund 0xADDRESS_A
534
- npx apow-cli wallet fund 0xADDRESS_B
535
- npx apow-cli wallet fund 0xADDRESS_C
536
- # Or specify a custom amount: npx apow-cli wallet fund 0xADDRESS_A 0.01
537
-
538
- # 3. Mint a rig for each sub-wallet
539
- PRIVATE_KEY=0xKEY_A npx apow-cli mint
540
- PRIVATE_KEY=0xKEY_B npx apow-cli mint
541
- PRIVATE_KEY=0xKEY_C npx apow-cli mint
542
-
543
- # 4. Mine with all wallets in parallel
544
- PRIVATE_KEY=0xKEY_A npx apow-cli mine &
545
- PRIVATE_KEY=0xKEY_B npx apow-cli mine &
546
- PRIVATE_KEY=0xKEY_C npx apow-cli mine &
547
- wait
548
- ```
549
-
550
- Or use a process manager like PM2 for production:
551
-
552
- ```bash
553
- # ecosystem.config.cjs
554
- module.exports = {
555
- apps: [
556
- { name: "miner-a", script: "npx", args: "apow mine", env: { PRIVATE_KEY: "0xKEY_A" } },
557
- { name: "miner-b", script: "npx", args: "apow mine", env: { PRIVATE_KEY: "0xKEY_B" } },
558
- { name: "miner-c", script: "npx", args: "apow mine", env: { PRIVATE_KEY: "0xKEY_C" } },
559
- ]
560
- };
561
-
562
- pm2 start ecosystem.config.cjs
563
- pm2 logs
564
- ```
72
+ The default enforce-mode policy limits:
565
73
 
566
- **Economics of multi-wallet mining:** Failed `mine()` calls still cost gas (~0.001 ETH). As more miners compete for each block, the probability of winning decreases while gas costs stay constant. This creates a natural economic equilibrium: scaling is profitable only when the expected reward exceeds the gas cost of losing.
74
+ - one rig mint to at most `0.01 ETH`;
75
+ - each x402 payment to at most `1 USDC`;
76
+ - aggregate x402 payments to at most `20 USDC` per UTC day;
77
+ - transfers and sweeps to their separately configured destinations and caps.
567
78
 
568
- **RPC rate limits:** For 3+ concurrent miners, use a dedicated RPC endpoint (Alchemy, Infura, QuickNode). Free public RPCs will not handle the load.
79
+ Treat the CLI’s displayed policy as authoritative. If it is less restrictive than these defaults, stop and ask the user to review it.
569
80
 
570
- **GPU mining (v0.9.2+):** The miner auto-detects native grinder binaries for 50-1000x faster nonce grinding. Grinder source files ship with the npm package -- run `apow build-grinders` to compile and install to `~/.apow/`:
81
+ ## Failure handling
571
82
 
572
- ```bash
573
- npx apow-cli build-grinders # auto-detects compilers + GPU arch
574
- npx apow-cli build-grinders --cuda-arch sm_89 # override CUDA architecture
575
- ```
576
-
577
- Supported grinders (all race in parallel -- first nonce wins, falls back to JS automatically):
578
- - **Metal GPU** (macOS): requires Xcode CLI tools (`clang`)
579
- - **CUDA** (NVIDIA GPU): requires CUDA toolkit (`nvcc`), auto-detects GPU arch via `nvidia-smi`
580
- - **CPU-C** (any platform): requires `clang` or `gcc`
581
- - **Remote CUDA** (VAST.ai): set `VAST_IP` + `VAST_PORT` env vars for SSH-based remote grinding
582
-
583
- ### x402 GPU Grinding (Remote RTX 4090)
584
-
585
- No GPU? Add `USE_X402_GRIND=true` to your `.env` for remote RTX 4090 nonce grinding at ~$0.006/grind (dynamic pricing) via the [x402 payment protocol](https://www.x402.org/). Zero setup, zero API keys — payment is automatic from your mining wallet's USDC balance.
586
-
587
- ```bash
588
- # In your .env (enabled automatically in Easy Mode)
589
- USE_X402_GRIND=true
590
- # ALLOW_LOCAL_FALLBACK_WITH_X402=true # Advanced Mode hybrid option
591
- # GRIND_URL=https://grind.apow.io/grind # default, override for self-hosted
592
- ```
593
-
594
- In Easy Mode, the HTTP grinder is the only nonce source, so agents do not silently burn local CPU while remote x402 GPU mining is active. Advanced Mode can opt into a hybrid local fallback. For GPU-less miners, this is still a 10-100x speed improvement over JS fallback.
595
-
596
- **Front-running is cryptographically impossible:** nonces are bound to `keccak256(challenge, msg.sender, nonce)` — a nonce ground for address A is useless for address B.
597
-
598
- **Self-hosting:** Deploy your own GrindProxy with any CUDA GPU. See [apow-grind](https://github.com/Agentoshi/apow-grind) for the open-source CF Worker + RunPod Docker image. Set `GRIND_URL` to your endpoint.
599
-
600
- ### Local LLM Setup (Ollama)
601
-
602
- ```bash
603
- # Install Ollama
604
- curl -fsSL https://ollama.ai/install.sh | sh
605
-
606
- # Pull a model
607
- ollama pull llama3.1
608
-
609
- # Configure .env
610
- LLM_PROVIDER=ollama
611
- LLM_MODEL=llama3.1
612
- # LLM_API_KEY is not needed for Ollama
613
- ```
614
-
615
- Ollama runs on `http://127.0.0.1:11434` by default. The miner connects there automatically.
616
-
617
- **Trade-off:** Free inference, but local models may have lower accuracy on the constrained SMHL challenges. The miner retries up to 5 times per challenge, but persistent failures will slow mining.
618
-
619
- ### Custom RPC Endpoints
620
-
621
- Set `RPC_URL` in `.env` to any Base-compatible JSON-RPC endpoint. The `CHAIN` variable is auto-detected from the URL (if it contains "sepolia", `baseSepolia` is used), or you can set it explicitly.
622
-
623
- ### Agent Wallet
624
-
625
- Each Miner NFT supports an on-chain agent wallet. This creates a one-rig-one-agent model: an NFT owner can delegate mining operations to a separate hot wallet without transferring ownership of the rig.
626
-
627
- **Functions:**
628
- - `getAgentWallet(tokenId)`: returns the registered agent wallet address
629
- - `setAgentWallet(tokenId, newWallet, deadline, signature)`: sets a new agent wallet (requires EIP-712 signature from the new wallet)
630
- - `unsetAgentWallet(tokenId)`: removes the agent wallet
631
-
632
- **What survives NFT transfer:** rarity, hashpower, total mine count, total AGENT earned, and the on-chain pixel art. All permanent metadata is baked into the token.
633
-
634
- **What gets cleared on transfer:** ONLY the agent wallet binding. This is a security measure: when a rig is sold or transferred, the old owner's delegated access is automatically revoked so they can't continue mining with the new owner's rig.
635
-
636
- **Trading:** Miner NFTs are fully tradeable (standard ERC-721). They are NOT soulbound. You can buy, sell, and transfer them on OpenSea or any NFT marketplace. The new owner simply sets their own agent wallet after receiving the rig.
637
-
638
- ### Testnet (Base Sepolia)
639
-
640
- To mine on testnet, set:
641
- ```bash
642
- RPC_URL=https://sepolia.base.org
643
- CHAIN=baseSepolia
644
- ```
645
- Use the corresponding testnet contract addresses.
646
-
647
- ---
648
-
649
- ## 11. Troubleshooting
650
-
651
- | Error | Cause | Fix |
652
- |---|---|---|
653
- | `PRIVATE_KEY is required for minting and mining commands.` | No wallet is configured for the current manual command | Run `npx apow-cli start` and choose Easy Mode to generate one, or add `PRIVATE_KEY=0x...` to your `.env` file |
654
- | `PRIVATE_KEY must be a 32-byte hex string prefixed with 0x.` | Malformed private key | Ensure key is exactly `0x` + 64 hex characters |
655
- | `MINING_AGENT_ADDRESS is required.` | Contract address missing or overridden with an invalid value | Remove the bad override to use the built-in default, or set the correct `MINING_AGENT_ADDRESS` in `.env` |
656
- | `AGENT_COIN_ADDRESS is required.` | Contract address missing or overridden with an invalid value | Remove the bad override to use the built-in default, or set the correct `AGENT_COIN_ADDRESS` in `.env` |
657
- | `LLM_API_KEY is required for openai.` | Missing API key for cloud provider | Set `LLM_API_KEY` (or provider-specific key like `OPENAI_API_KEY`) in `.env`, or switch to `ollama` |
658
- | `Insufficient fee` | Not enough ETH sent with mint | Check `getMintPrice()` and ensure wallet has enough ETH |
659
- | `Sold out` | All 10,000 Miner NFTs minted | No more rigs available; buy one on secondary market |
660
- | `Expired` | SMHL challenge expired (>20s) | Use a faster model (gpt-4o-mini, gemini-2.5-flash). Thinking models are too slow for the 20s mint window |
661
- | `Invalid SMHL` | LLM produced an incorrect solution | Retry; if persistent, switch to a more capable model |
662
- | `Not your miner` | Token ID not owned by your wallet | Verify `PRIVATE_KEY` matches the NFT owner; check token ID |
663
- | `Supply exhausted` | All 18.9M mineable AGENT has been minted | Mining is complete; no more rewards available |
664
- | `One mine per block` | Another mine was confirmed in this block | Automatic; the miner waits for the next block |
665
- | `No contracts` | Calling from a contract, not an EOA | Mining requires an externally owned account (EOA) |
666
- | `Invalid hash` | Nonce does not meet difficulty target | Bug in nonce grinding; should not happen under normal operation |
667
- | `Nonce too high` | Wallet nonce desync | Reset nonce in wallet or wait for pending transactions to confirm |
668
- | `Anthropic request failed: 429` | Rate limited by Anthropic API | Reduce mining frequency or upgrade API plan |
669
- | `Ollama request failed: 500` | Ollama server error | Check `ollama serve` is running; restart if needed |
670
- | `SMHL solve failed after 5 attempts` | LLM cannot satisfy constraints | Switch to a more capable model (e.g., `gpt-4o` or `claude-sonnet-4-5-20250929`) |
671
- | `Fee forward failed` | LPVault rejected the ETH transfer | LPVault may not be set; check contract deployment |
672
- | `10 consecutive failures` | Repeated transient errors | Check RPC connectivity, wallet balance, and LLM availability |
673
- | `Timed out waiting for next block (60s)` | RPC not responding or network stalled | Check RPC connectivity; try a different RPC endpoint |
674
-
675
- ---
676
-
677
- ## 12. Security & Trust
678
-
679
- This section addresses the security model of apow-cli head-on. Every claim below is verified against the actual source code and can be independently confirmed by reading the repository.
680
-
681
- ### Private Key Generation (Local Only)
682
-
683
- Keys are generated via `viem/accounts` `generatePrivateKey()`, which uses Node.js `crypto.randomBytes(32)`, a cryptographically secure random number generator. Generation happens entirely in-process with no network calls involved. The private key is displayed once to the terminal, and the CLI can create both a plaintext `wallet-<address>.txt` import helper and a password-protected JSON keystore (`Web3 Secret Storage v3`) with file permissions `0o600`.
684
-
685
- ### Private Key Is NEVER Transmitted
686
-
687
- Exhaustive audit confirms: the private key string is never included in any `fetch()` call, HTTP request body, URL parameter, or header anywhere in the codebase. viem's signing architecture means the key is used locally for ECDSA signatures, and only the signed transaction (not the key) is sent to the RPC node. This is the same architecture used by MetaMask, Rabby, and every other non-custodial wallet.
688
-
689
- ### Zero Telemetry
690
-
691
- The CLI contains no analytics, no error reporting, and no phone-home behavior of any kind:
692
-
693
- - No analytics SDKs (no Mixpanel, no PostHog, no Google Analytics)
694
- - No error reporting services (no Sentry, no Bugsnag)
695
- - No tracking pixels, no usage metrics, no telemetry endpoints
696
-
697
- The CLI makes only these network calls:
698
-
699
- 1. **Blockchain RPC** (to user-configured RPC URL or QuickNode x402): standard `eth_call`, `eth_sendRawTransaction`, etc.
700
- 2. **LLM API** (to user-configured provider): sends only word-puzzle prompts for SMHL solving, never wallet data
701
- 3. **Bridge APIs** (only when using `apow fund`):
702
- - **CoinGecko** (`api.coingecko.com`): SOL/ETH price quotes
703
- - **Squid Router** (`v2.api.squidrouter.com`): deposit address generation and bridge status
704
- - **Uniswap V3** (on-chain, Base): ETH/USDC swaps for auto-split
705
- - **Solana RPC** (`api.mainnet-beta.solana.com` or custom): balance checks
706
-
707
- No private keys are transmitted to bridge providers. Squid generates a deposit address, and the user sends tokens from their own wallet.
708
-
709
- ### LLM Calls Are Data-Isolated
710
-
711
- The SMHL solver sends only generic word-generation prompts to the LLM (e.g., "Write exactly 5 lowercase English words..."). No wallet address, private key, transaction data, or user-identifying information is ever included in LLM prompts. The string `privateKey` does not appear anywhere in `smhl.ts`.
712
-
713
- ### Open Source & Auditable
714
-
715
- - Full source code: [github.com/Agentoshi/apow-cli](https://github.com/Agentoshi/apow-cli)
716
- - MIT licensed
717
- - Every line is auditable. There are no obfuscated modules, no binary blobs, no minified dependencies performing network calls
718
- - Smart contracts are separately auditable: [github.com/Agentoshi/apow-core](https://github.com/Agentoshi/apow-core)
719
-
720
- ### npm Package Integrity
721
-
722
- - Published as `apow-cli` on npm
723
- - Package contents match the GitHub source (verify with `npm pack --dry-run` or compare against the repo)
724
- - No `postinstall` scripts that execute arbitrary code
725
- - The `package.json` `scripts` section contains only standard build/dev commands
726
-
727
- ### Best Practices for Users
728
-
729
- 1. **Use a fresh wallet.** Generate one with `npx apow-cli wallet new`. Do not import your main wallet or any wallet holding significant funds.
730
- 2. **Fund with only what you need.** ~0.005 ETH covers minting + several mining cycles.
731
- 3. **Prefer encrypted keystore backups** in `~/.apow/keystores/wallet-<address>.json`. The plaintext `wallet-<address>.txt` helper is convenient for importing into wallet UIs, but it is less secure.
732
- 4. **Verify the source before running** if you prefer:
733
- ```bash
734
- git clone https://github.com/Agentoshi/apow-cli
735
- cd apow-cli && npm install && npm run build
736
- node dist/index.js setup
737
- ```
738
- 5. **Review dependencies.** The dependency tree is minimal and standard: `viem` (Ethereum library), `commander` (CLI framework), `dotenv` (env loading), `openai` (LLM client), `@blockrun/clawrouter` (x402 LLM proxy), `@quicknode/x402` (x402 RPC payment), `@solana/web3.js` (Solana signing, lazy-loaded only for bridging), `qrcode-terminal` (QR codes for fund command), `ox` (utilities). No exotic or suspicious packages.
739
-
740
- ### How to Verify These Claims Yourself
741
-
742
- Every statement above can be independently verified:
743
-
744
- ```bash
745
- # Clone the source
746
- git clone https://github.com/Agentoshi/apow-cli && cd apow-cli
747
-
748
- # Search for any outbound network calls (you'll find only RPC and LLM calls)
749
- grep -r "fetch\|axios\|http\|request" src/
750
-
751
- # Confirm private key is never in any network payload
752
- grep -r "privateKey" src/ # only appears in local wallet operations, never in fetch/request calls
753
-
754
- # Check for telemetry/analytics packages
755
- grep -r "mixpanel\|posthog\|sentry\|bugsnag\|analytics\|telemetry" src/ package.json
756
-
757
- # Verify wallet file permissions
758
- grep -r "0o600\|0600" src/ # wallet files are created with owner-only permissions
759
-
760
- # Check postinstall scripts
761
- cat package.json | grep -A5 "scripts" # no postinstall hook
762
- ```
763
-
764
- ---
765
-
766
- ## 13. Contract Addresses
767
-
768
- | Contract | Address |
769
- |---|---|
770
- | MiningAgent (ERC-721) | `0xB7caD3ca5F2BD8aEC2Eb67d6E8D448099B3bC03D` |
771
- | AgentCoin (ERC-20) | `0x12577CF0D8a07363224D6909c54C056A183e13b3` |
772
- | LPVault | `0xDD47511d060eA4E955B95F6f43553414328648a6` |
773
-
774
- **Network:** Base (Chain ID 8453)
775
-
776
- **Token details:**
777
- - **Name:** AgentCoin
778
- - **Symbol:** AGENT
779
- - **Decimals:** 18
780
- - **Max supply:** 21,000,000 AGENT
781
- - **LP reserve:** 2,100,000 AGENT (10%, minted to LPVault at deployment)
782
- - **Mineable supply:** 18,900,000 AGENT
783
-
784
- **Miner NFT details:**
785
- - **Name:** AgentCoin Miner
786
- - **Symbol:** MINER
787
- - **Standard:** ERC-721 Enumerable
788
- - **Max supply:** 10,000
789
-
790
-
791
- ## 14. Dashboard
792
-
793
- The `apow dashboard` command group provides a real-time web UI for monitoring your entire mining fleet. Zero external dependencies — it serves vanilla HTML/JS directly from the CLI.
794
-
795
- ### Subcommands
796
-
797
- | Command | Description |
798
- |---------|-------------|
799
- | `apow dashboard start` | Launch the dashboard web UI at `http://localhost:3847`. Auto-opens browser. Press Ctrl+C to stop. |
800
- | `apow dashboard add <address>` | Add a wallet address to monitor. Validates 0x + 40 hex chars. |
801
- | `apow dashboard remove <address>` | Remove a wallet address from monitoring. |
802
- | `apow dashboard scan [dir]` | Auto-detect wallets from `wallet-0x*.txt` and `wallet-0x*.json` files in the given directory (default: CWD). Also scans `rig*/` subdirectories. |
803
- | `apow dashboard wallets` | List all currently monitored wallet addresses. |
804
-
805
- ### How It Works
806
-
807
- - **Wallet storage:** `~/.apow/wallets.json` — a plain JSON array of Ethereum addresses.
808
- - **Fleet management:** `~/.apow/fleets.json` — optional, defines named groups of wallets from different sources.
809
- - **Data fetching:** Chunked RPC multicalls (max 30 per batch) with a 25-second TTL cache. Queries ETH balance, AGENT balance, rig ownership, rarity, hashpower, mine count, and earnings for every wallet.
810
- - **NFT art:** Renders on-chain SVG art for each Mining Rig with rarity-based color coding.
811
- - **Auto-seed:** On first run, seeds `wallets.json` with the address from your `.env` if configured.
812
- - **Auto-detect:** `dashboard start` automatically scans CWD for `wallet-0x*.txt` and `wallet-0x*.json` files before launching.
813
-
814
- ### Fleet Configuration (`~/.apow/fleets.json`)
815
-
816
- For managing wallets across multiple machines or directories, create `~/.apow/fleets.json`:
817
-
818
- ```json
819
- [
820
- { "name": "Local", "type": "array", "path": "/home/user/.apow/wallets.json" },
821
- { "name": "Vast.ai Rigs", "type": "rigdirs", "path": "/mnt/mining/rigs" },
822
- { "name": "Pool Wallets", "type": "walletfiles", "path": "/mnt/mining/wallets" },
823
- { "name": "Solkek Fleet", "type": "solkek", "path": "/home/user/solkek-config.json" }
824
- ]
825
- ```
826
-
827
- **Fleet types:**
828
-
829
- | Type | Source Format | Description |
830
- |------|--------------|-------------|
831
- | `array` | JSON array of addresses | Simple list: `["0xABC...", "0xDEF..."]` |
832
- | `solkek` | JSON with `master.address` + `miners[].address` | Solkek fleet manager format |
833
- | `rigdirs` | Directory containing `rig*/wallet-0x*.txt` or `.json` | Scan rig subdirectories for wallet files |
834
- | `walletfiles` | Directory containing `wallet-0x*.txt` or `.json` | Scan flat directory for wallet files |
835
-
836
- If `fleets.json` does not exist, the dashboard falls back to `wallets.json` as a single "Main" fleet.
837
-
838
- ### Example Workflow
839
-
840
- ```bash
841
- # 1. Scan a directory with wallet files to populate wallets.json
842
- npx apow-cli dashboard scan /path/to/mining/dir
843
-
844
- # 2. Manually add a wallet not found by scan
845
- npx apow-cli dashboard add 0x1234567890abcdef1234567890abcdef12345678
846
-
847
- # 3. Verify your wallet list
848
- npx apow-cli dashboard wallets
849
-
850
- # 4. Launch the dashboard
851
- npx apow-cli dashboard start
852
- # → Opens http://localhost:3847 in your browser
853
- # → Shows real-time balances, rig stats, earnings, and NFT art
854
- # → Press Ctrl+C to stop
855
- ```
856
-
857
- ### Troubleshooting
858
-
859
- | Issue | Cause | Fix |
860
- |-------|-------|-----|
861
- | "No wallets configured" | Empty `wallets.json` | Run `apow dashboard add <addr>` or `apow dashboard scan .` |
862
- | Dashboard shows 0 balances | RPC rate limiting | Set a dedicated `RPC_URL` in `.env` (Alchemy recommended) |
863
- | Browser doesn't open | Headless/SSH environment | Manually open `http://localhost:3847` in a browser |
864
- | Stale data | 25s cache TTL | Wait for next refresh cycle or restart the dashboard |
865
-
866
- ---
83
+ - No wallet: allow `start` to create one encrypted APoW wallet.
84
+ - Password unavailable: pause for direct local entry; do not handle it in chat.
85
+ - Funding needed: use the Base-only handoff above.
86
+ - Policy not in enforce mode: stop.
87
+ - User approval for the scoped Easy Mode command missing: stop.
88
+ - Package version unavailable: stop; do not substitute `latest`.
89
+ - RPC, SMHL, grinder, or transaction failure: report the concise error and let the CLI’s bounded retry behavior handle transient failures.
90
+ - Mining stopped: report whether the user interrupted it or the CLI exited with an error.
867
91
 
868
- **Source:** [github.com/Agentoshi/apow-cli](https://github.com/Agentoshi/apow-cli) | **Protocol:** [github.com/Agentoshi/apow-core](https://github.com/Agentoshi/apow-core)
92
+ Do not expand scope to “helpful” wallet operations. This skill’s complete job is the existing Easy Mode flow: encrypted APoW setup, a Base funding handoff, and policy-capped mining.