apow-cli 0.1.4 → 0.3.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
@@ -23,6 +23,15 @@ metadata:
23
23
  configure the miner, mint, and mine. The only step that requires your user is funding the wallet
24
24
  with ETH on Base. Everything else you handle yourself.
25
25
 
26
+ > **IMPORTANT — You need a dedicated RPC endpoint.** The default public RPC (`https://mainnet.base.org`) has aggressive rate limits and **will cause minting and mining to fail**. Before starting, get a free Alchemy endpoint:
27
+ >
28
+ > 1. Go to [alchemy.com](https://www.alchemy.com/) and sign up (free, no credit card)
29
+ > 2. Click **Create new app** → Name: `apow-miner` → Chain: **Base** → Network: **Base Mainnet**
30
+ > 3. Copy the **HTTPS** URL: `https://base-mainnet.g.alchemy.com/v2/YOUR_API_KEY`
31
+ > 4. Set `RPC_URL` to this URL in your `.env`
32
+ >
33
+ > Alchemy's free tier (300M compute units/month) is more than enough. See [RPC Recommendations](#rpc-recommendations) for alternatives.
34
+
26
35
  ---
27
36
 
28
37
  ## Quick Start (TL;DR)
@@ -30,6 +39,7 @@ with ETH on Base. Everything else you handle yourself.
30
39
  **Via npm (recommended):**
31
40
  ```bash
32
41
  npx apow-cli setup # interactive wizard — wallet, RPC, LLM config
42
+ npx apow-cli fund # fund wallet — bridge from Solana or show deposit address
33
43
  npx apow-cli mint # mint a mining rig NFT
34
44
  npx apow-cli mine # start mining (auto-detects your best rig)
35
45
  ```
@@ -55,6 +65,7 @@ npx apow-cli wallet new
55
65
  # 2. Write .env directly (no interactive prompts needed)
56
66
  # IMPORTANT: Use an API-based provider (openai/anthropic/gemini), NOT claude-code/codex.
57
67
  # Session-based providers are too slow for the 20-second mint challenge window.
68
+ # IMPORTANT: The public Base RPC is unreliable — get a free Alchemy URL (see RPC Recommendations).
58
69
  cat > .env << 'EOF'
59
70
  PRIVATE_KEY=0x<from step 1>
60
71
  RPC_URL=https://mainnet.base.org
@@ -65,8 +76,10 @@ MINING_AGENT_ADDRESS=0xB7caD3ca5F2BD8aEC2Eb67d6E8D448099B3bC03D
65
76
  AGENT_COIN_ADDRESS=0x12577CF0D8a07363224D6909c54C056A183e13b3
66
77
  EOF
67
78
 
68
- # 3. Ask your user to fund the wallet with ≥0.005 ETH on Base
69
- # This is the ONLY step that requires human action
79
+ # 3. Fund the wallet (bridge from Solana or send ETH on Base)
80
+ npx apow-cli fund --solana # interactive bridge SOL ETH on Base
81
+ # Or: npx apow-cli fund --solana --key <base58> # direct signing (~20s)
82
+ # Or: ask your user to send ≥0.005 ETH on Base directly
70
83
 
71
84
  # 4. Mint + mine (fully autonomous from here)
72
85
  npx apow-cli mint
@@ -138,9 +151,34 @@ This prompts for confirmation, then displays your address and private key. It al
138
151
  Your mining wallet needs ETH on Base for gas and the mint fee.
139
152
  **Minimum:** 0.005 ETH (~$15) covers minting + several mining cycles.
140
153
 
141
- Ask your user how they want to fund their wallet, then give them the appropriate instructions:
154
+ ### Built-in Bridge: `apow fund` (Recommended)
155
+
156
+ The CLI has a built-in cross-chain bridge for Solana users:
157
+
158
+ ```bash
159
+ npx apow-cli fund # Interactive: choose funding method
160
+ npx apow-cli fund --solana # Deposit address + QR code
161
+ npx apow-cli fund --solana --key <base58> # Direct Solana signing (~20s)
162
+ npx apow-cli fund --solana --amount 0.01 # Custom ETH target
163
+ ```
164
+
165
+ **Three funding paths:**
166
+
167
+ | Path | How it works | Speed | Requires Solana key? |
168
+ |------|-------------|-------|---------------------|
169
+ | Direct signing | deBridge DLN signs + submits via your Solana keypair | ~20 seconds | Yes (`--key`) |
170
+ | Deposit address | Squid Router generates a Solana address; send from any wallet | ~1-3 minutes | No |
171
+ | Manual | Shows your Base address + QR code | Varies | No |
172
+
173
+ **Direct signing (`--key`):** Provide your base58 Solana secret key. The CLI calls deBridge DLN to create a bridge order, signs the Solana transaction locally, submits it, and polls until ETH arrives on Base. No API key needed.
142
174
 
143
- ### From Solana (Phantom Wallet)
175
+ **Deposit address (`--solana` without `--key`):** Requires `SQUID_INTEGRATOR_ID` in `.env` (free, apply at [squidrouter.com](https://app.squidrouter.com/)). Generates a one-time Solana deposit address with a QR code. Send SOL from any wallet (Phantom, Backpack, etc.) and the bridge handles the rest.
176
+
177
+ ### Manual Funding Options
178
+
179
+ If you prefer not to use the built-in bridge:
180
+
181
+ #### From Solana (Phantom Wallet)
144
182
  Phantom natively supports Base. Tell your user:
145
183
  1. Open Phantom → tap the **Swap** icon
146
184
  2. Set **From:** SOL (Solana) → **To:** ETH (Base)
@@ -149,19 +187,17 @@ Phantom natively supports Base. Tell your user:
149
187
  5. Once ETH arrives on Base, tap **Send** → paste the mining wallet address
150
188
  6. Confirm the transfer
151
189
 
152
- Alternatively, use [relay.link/bridge/solana](https://relay.link/bridge/solana) to bridge SOL → ETH on Base directly to the mining wallet address.
153
-
154
- ### From an Exchange (Coinbase, Binance, etc.)
190
+ #### From an Exchange (Coinbase, Binance, etc.)
155
191
  1. Buy ETH on Base (Coinbase supports Base withdrawals natively)
156
192
  2. Withdraw to the mining wallet address
157
193
  3. Select **Base** as the network — do NOT send on Ethereum mainnet
158
194
 
159
- ### From Ethereum Mainnet
195
+ #### From Ethereum Mainnet
160
196
  Bridge ETH to Base via [bridge.base.org](https://bridge.base.org):
161
197
  1. Connect source wallet → enter mining wallet address as recipient
162
198
  2. Bridge ≥0.005 ETH → arrives on Base in ~10 minutes
163
199
 
164
- ### From Another Base Wallet
200
+ #### From Another Base Wallet
165
201
  Send ETH directly to the mining wallet address on Base.
166
202
 
167
203
  ### Verifying Funds
@@ -217,7 +253,8 @@ LLM_MODEL=gpt-4o-mini
217
253
 
218
254
  # === Network ===
219
255
 
220
- # Base RPC endpoint (default: https://mainnet.base.org)
256
+ # Base RPC endpoint — the public default is unreliable for sustained mining.
257
+ # Strongly recommend a free Alchemy key: https://www.alchemy.com/ (no credit card)
221
258
  RPC_URL=https://mainnet.base.org
222
259
 
223
260
  # Chain: "base" | "baseSepolia" (auto-detected from RPC_URL if omitted)
@@ -234,8 +271,10 @@ CHAIN=base
234
271
  | `LLM_PROVIDER` | No | `openai` | LLM provider: `openai`, `anthropic`, `ollama`, `gemini`, `claude-code`, or `codex` |
235
272
  | `LLM_API_KEY` | Conditional | -- | API key. Falls back to `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `GEMINI_API_KEY` per provider. Not needed for `ollama`, `claude-code`, or `codex` |
236
273
  | `LLM_MODEL` | No | `gpt-4o-mini` | Model identifier passed to the provider |
237
- | `RPC_URL` | No | `https://mainnet.base.org` | Base JSON-RPC endpoint |
274
+ | `RPC_URL` | **Strongly recommended** | `https://mainnet.base.org` | Base JSON-RPC endpoint. **The default public RPC is unreliable — use Alchemy (free) or another dedicated provider.** |
238
275
  | `CHAIN` | No | `base` | Network selector; auto-detects `baseSepolia` if RPC URL contains "sepolia" |
276
+ | `SOLANA_RPC_URL` | No | `https://api.mainnet-beta.solana.com` | Solana RPC endpoint (only for `apow fund --solana`) |
277
+ | `SQUID_INTEGRATOR_ID` | No | -- | Squid Router integrator ID for deposit address flow (free at [squidrouter.com](https://app.squidrouter.com/)) |
239
278
 
240
279
  ### LLM Provider Recommendations
241
280
 
@@ -253,10 +292,54 @@ CHAIN=base
253
292
 
254
293
  ### RPC Recommendations
255
294
 
256
- The default `https://mainnet.base.org` is rate-limited. For production mining, use a dedicated RPC:
257
- - [Alchemy](https://www.alchemy.com/) -- `https://base-mainnet.g.alchemy.com/v2/YOUR_KEY`
258
- - [Infura](https://infura.io/) -- `https://base-mainnet.infura.io/v3/YOUR_KEY`
259
- - [QuickNode](https://www.quicknode.com/) -- custom endpoint
295
+ The default `https://mainnet.base.org` is a public RPC with aggressive rate limits. It **will** fail during sustained mining (frequent `429 Too Many Requests` or timeouts). You need a dedicated RPC endpoint. All providers below offer a **free tier** that is more than sufficient for mining.
296
+
297
+ #### Option 1: Alchemy (Recommended)
298
+
299
+ 1. Go to [alchemy.com](https://www.alchemy.com/) and sign up (free, no credit card)
300
+ 2. Click **Create new app** → Name: `apow-miner` → Chain: **Base** → Network: **Base Mainnet**
301
+ 3. On the app dashboard, copy the **HTTPS** URL. It looks like:
302
+ ```
303
+ https://base-mainnet.g.alchemy.com/v2/YOUR_API_KEY
304
+ ```
305
+ 4. Set in your `.env`:
306
+ ```
307
+ RPC_URL=https://base-mainnet.g.alchemy.com/v2/YOUR_API_KEY
308
+ ```
309
+
310
+ **Free tier:** 300M compute units/month (~millions of RPC calls). More than enough for mining.
311
+
312
+ #### Option 2: QuickNode
313
+
314
+ 1. Go to [quicknode.com](https://www.quicknode.com/) and sign up (free, no credit card)
315
+ 2. Click **Create Endpoint** → Chain: **Base** → Network: **Mainnet**
316
+ 3. Copy the **HTTP Provider** URL. It looks like:
317
+ ```
318
+ https://something-something.base-mainnet.quiknode.pro/YOUR_TOKEN/
319
+ ```
320
+ 4. Set in your `.env`:
321
+ ```
322
+ RPC_URL=https://something-something.base-mainnet.quiknode.pro/YOUR_TOKEN/
323
+ ```
324
+
325
+ **Free tier:** 10M API credits/month. Sufficient for a few miners.
326
+
327
+ #### Option 3: Other Free RPCs
328
+
329
+ | Provider | Free Tier | URL Pattern |
330
+ |---|---|---|
331
+ | [Infura](https://infura.io/) | 100K req/day | `https://base-mainnet.infura.io/v3/KEY` |
332
+ | [Ankr](https://www.ankr.com/) | 30 req/s | `https://rpc.ankr.com/base` (no key needed) |
333
+ | [Blast](https://blastapi.io/) | 40 req/s | `https://base-mainnet.blastapi.io/KEY` |
334
+
335
+ #### Troubleshooting RPC Issues
336
+
337
+ | Symptom | Cause | Fix |
338
+ |---|---|---|
339
+ | `429 Too Many Requests` | Public RPC rate limit | Switch to a dedicated RPC (Alchemy/QuickNode) |
340
+ | `Timed out waiting for next block (60s)` | RPC not responding | Check endpoint URL; try a different provider |
341
+ | `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}'` |
342
+ | Stale data / missed mines | RPC caching or slow sync | Alchemy and QuickNode are fastest; avoid free community RPCs |
260
343
 
261
344
  ---
262
345
 
@@ -565,12 +648,17 @@ The CLI contains no analytics, no error reporting, and no phone-home behavior of
565
648
  - No error reporting services (no Sentry, no Bugsnag)
566
649
  - No tracking pixels, no usage metrics, no telemetry endpoints
567
650
 
568
- The CLI makes exactly two types of network calls:
651
+ The CLI makes only these network calls:
569
652
 
570
653
  1. **Blockchain RPC** (to user-configured RPC URL, default: `mainnet.base.org`) -- standard `eth_call`, `eth_sendRawTransaction`, etc.
571
654
  2. **LLM API** (to user-configured provider) -- sends only word-puzzle prompts for SMHL solving, never wallet data
655
+ 3. **Bridge APIs** (only when using `apow fund --solana`):
656
+ - **CoinGecko** (`api.coingecko.com`) -- SOL/ETH price quotes
657
+ - **deBridge DLN** (`dln.debridge.finance`) -- bridge order creation and status (direct signing flow)
658
+ - **Squid Router** (`v2.api.squidrouter.com`) -- deposit address generation (deposit address flow)
659
+ - **Solana RPC** (`api.mainnet-beta.solana.com` or custom) -- balance checks and tx submission
572
660
 
573
- Nothing else. No other outbound connections.
661
+ No private keys are transmitted to bridge providers. deBridge returns a serialized Solana transaction that is signed locally. Squid generates a deposit address -- the user sends SOL themselves.
574
662
 
575
663
  ### LLM Calls Are Data-Isolated
576
664
 
@@ -601,7 +689,7 @@ The SMHL solver sends only generic word-generation prompts to the LLM (e.g., "Wr
601
689
  cd apow-cli && npm install && npm run build
602
690
  node dist/index.js setup
603
691
  ```
604
- 5. **Review dependencies.** The dependency tree is minimal and standard: `viem` (Ethereum library), `commander` (CLI framework), `dotenv` (env loading), `chalk`/`ora` (terminal UI), and an LLM client. No exotic or suspicious packages.
692
+ 5. **Review dependencies.** The dependency tree is minimal and standard: `viem` (Ethereum library), `commander` (CLI framework), `dotenv` (env loading), `@solana/web3.js` (Solana signing, lazy-loaded only for bridging), `qrcode-terminal` (QR codes for fund command), and an LLM client. No exotic or suspicious packages.
605
693
 
606
694
  ### How to Verify These Claims Yourself
607
695