apow-cli 0.9.3 → 0.9.4
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/README.md +2 -2
- package/dist/errors.js +1 -1
- package/dist/grinder-http.js +3 -3
- package/dist/miner.js +1 -1
- package/dist/preflight.js +1 -1
- package/local/gpu/grinder-cuda.cu +31 -1
- package/package.json +1 -1
- package/skill.md +3 -3
package/README.md
CHANGED
|
@@ -132,7 +132,7 @@ An LLM is required to mint your Mining Rig NFT (one-time identity verification).
|
|
|
132
132
|
|
|
133
133
|
| Provider | Model | Cost/call | Notes |
|
|
134
134
|
|----------|-------|-----------|-------|
|
|
135
|
-
| ClawRouter | `blockrun/eco` |
|
|
135
|
+
| ClawRouter | `blockrun/eco` | ~$0.006 | Recommended. Zero credentials, pays with USDC via x402 |
|
|
136
136
|
| OpenAI | `gpt-4o-mini` | ~$0.001 | Cheapest API key option, fast |
|
|
137
137
|
| Gemini | `gemini-2.5-flash` | ~$0.001 | Fast, good accuracy |
|
|
138
138
|
| DeepSeek | `deepseek-chat` | ~$0.001 | Fast, accessible in China |
|
|
@@ -166,7 +166,7 @@ apow fund --chain base --no-swap
|
|
|
166
166
|
|
|
167
167
|
## x402 GPU Grinding
|
|
168
168
|
|
|
169
|
-
No GPU? No problem. Remote RTX 4090 nonce grinding via the [x402 payment protocol](https://www.x402.org/) —
|
|
169
|
+
No GPU? No problem. Remote RTX 4090 nonce grinding via the [x402 payment protocol](https://www.x402.org/) — ~$0.006/grind (dynamic pricing tracks actual GPU cost), zero setup:
|
|
170
170
|
|
|
171
171
|
```bash
|
|
172
172
|
# In your .env (enabled automatically when USE_X402=true)
|
package/dist/errors.js
CHANGED
|
@@ -129,7 +129,7 @@ const patterns = [
|
|
|
129
129
|
test: (m) => m.includes("x402 GPU grind payment failed"),
|
|
130
130
|
classify: () => ({
|
|
131
131
|
category: "setup",
|
|
132
|
-
userMessage: "Insufficient USDC for x402 GPU grinding
|
|
132
|
+
userMessage: "Insufficient USDC for x402 GPU grinding",
|
|
133
133
|
recovery: "Send USDC to your wallet on Base, or set USE_X402_GRIND=false to disable remote grinding",
|
|
134
134
|
}),
|
|
135
135
|
},
|
package/dist/grinder-http.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* HTTP x402 nonce grinder — pay-per-grind GPU mining via GrindProxy.
|
|
4
4
|
*
|
|
5
5
|
* Sends {challenge, target, address} to a remote GPU endpoint (default:
|
|
6
|
-
* grind.apow.io). Payment (
|
|
7
|
-
* x402
|
|
8
|
-
* authorization and retries. No accounts, no API keys.
|
|
6
|
+
* grind.apow.io). Payment (dynamic USDC pricing based on GPU cost) is
|
|
7
|
+
* handled automatically via x402 — the server returns 402, the client
|
|
8
|
+
* signs a USDC authorization and retries. No accounts, no API keys.
|
|
9
9
|
*
|
|
10
10
|
* Front-running is cryptographically impossible: nonces are bound to
|
|
11
11
|
* keccak256(challenge, msg.sender, nonce) — a nonce ground for address A
|
package/dist/miner.js
CHANGED
|
@@ -193,7 +193,7 @@ async function startMining(tokenId) {
|
|
|
193
193
|
console.log(` Grinder: ${ui.bold(modeLabel)}`);
|
|
194
194
|
// Hint for JS-only miners without x402 grind
|
|
195
195
|
if (!useNative && !useHttpGrind) {
|
|
196
|
-
console.log(` ${ui.dim("Tip: Add USE_X402_GRIND=true for 10-100x faster mining (
|
|
196
|
+
console.log(` ${ui.dim("Tip: Add USE_X402_GRIND=true for 10-100x faster mining (~$0.006/grind).")}`);
|
|
197
197
|
}
|
|
198
198
|
console.log("");
|
|
199
199
|
while (true) {
|
package/dist/preflight.js
CHANGED
|
@@ -253,7 +253,7 @@ async function runPreflight(level) {
|
|
|
253
253
|
const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(5000) });
|
|
254
254
|
if (resp.ok) {
|
|
255
255
|
const host = new URL(grindUrl).hostname;
|
|
256
|
-
results.push({ label: `GrindProxy: ${host} (
|
|
256
|
+
results.push({ label: `GrindProxy: ${host} (dynamic pricing)`, passed: true });
|
|
257
257
|
}
|
|
258
258
|
else {
|
|
259
259
|
results.push({
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
#include <cstdint>
|
|
26
26
|
#include <ctime>
|
|
27
27
|
#include <chrono>
|
|
28
|
+
#include <csignal>
|
|
28
29
|
#include <unistd.h>
|
|
29
30
|
#include <sys/select.h>
|
|
30
31
|
|
|
@@ -356,6 +357,27 @@ static bool run_grind(GrindParams* params, GrindResult* result,
|
|
|
356
357
|
return true;
|
|
357
358
|
}
|
|
358
359
|
|
|
360
|
+
// Signal handler for debugging
|
|
361
|
+
static volatile sig_atomic_t got_signal = 0;
|
|
362
|
+
static void signal_handler(int sig) {
|
|
363
|
+
// Write signal info to stderr (async-signal-safe)
|
|
364
|
+
const char* name = "UNKNOWN";
|
|
365
|
+
switch(sig) {
|
|
366
|
+
case SIGTERM: name = "SIGTERM"; break;
|
|
367
|
+
case SIGINT: name = "SIGINT"; break;
|
|
368
|
+
case SIGPIPE: name = "SIGPIPE"; break;
|
|
369
|
+
case SIGHUP: name = "SIGHUP"; break;
|
|
370
|
+
case SIGUSR1: name = "SIGUSR1"; break;
|
|
371
|
+
case SIGUSR2: name = "SIGUSR2"; break;
|
|
372
|
+
}
|
|
373
|
+
fprintf(stderr, "SIGNAL %d (%s) received\n", sig, name);
|
|
374
|
+
fflush(stderr);
|
|
375
|
+
got_signal = sig;
|
|
376
|
+
// Re-raise to get default behavior
|
|
377
|
+
signal(sig, SIG_DFL);
|
|
378
|
+
raise(sig);
|
|
379
|
+
}
|
|
380
|
+
|
|
359
381
|
// ── Daemon mode: persistent CUDA process ──
|
|
360
382
|
static int run_daemon() {
|
|
361
383
|
const int BLOCK_SIZE = 256;
|
|
@@ -374,7 +396,15 @@ static int run_daemon() {
|
|
|
374
396
|
grind_kernel<<<1, 1>>>(params, result);
|
|
375
397
|
cudaDeviceSynchronize();
|
|
376
398
|
|
|
377
|
-
|
|
399
|
+
// Install signal handlers for debugging
|
|
400
|
+
signal(SIGTERM, signal_handler);
|
|
401
|
+
signal(SIGINT, signal_handler);
|
|
402
|
+
signal(SIGPIPE, signal_handler);
|
|
403
|
+
signal(SIGHUP, signal_handler);
|
|
404
|
+
signal(SIGUSR1, signal_handler);
|
|
405
|
+
signal(SIGUSR2, signal_handler);
|
|
406
|
+
|
|
407
|
+
fprintf(stderr, "CUDA daemon ready (pid=%d)\n", getpid());
|
|
378
408
|
printf("READY\n");
|
|
379
409
|
fflush(stdout);
|
|
380
410
|
|
package/package.json
CHANGED
package/skill.md
CHANGED
|
@@ -290,7 +290,7 @@ CHAIN=base
|
|
|
290
290
|
| `CUDA_GRINDER_PATH` | No | auto-detected | Explicit path to local CUDA grinder binary |
|
|
291
291
|
| `CPU_GRINDER_PATH` | No | auto-detected | Explicit path to CPU-C grinder binary |
|
|
292
292
|
| `CPU_THREADS` | No | All CPU cores | Thread count for CPU-C grinder |
|
|
293
|
-
| `USE_X402_GRIND` | No | same as `USE_X402` | Enable remote GPU grinding via x402 (
|
|
293
|
+
| `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`. |
|
|
294
294
|
| `GRIND_URL` | No | `https://grind.apow.io/grind` | Custom GrindProxy endpoint URL (for self-hosted grinding) |
|
|
295
295
|
| `VAST_IP` | No | - | Remote VAST.ai GPU host IP (for remote CUDA mining) |
|
|
296
296
|
| `VAST_PORT` | No | - | Remote VAST.ai GPU SSH port |
|
|
@@ -303,7 +303,7 @@ CHAIN=base
|
|
|
303
303
|
|
|
304
304
|
| Provider | Model | Cost per call | Notes |
|
|
305
305
|
|---|---|---|---|
|
|
306
|
-
| ClawRouter | `blockrun/eco` |
|
|
306
|
+
| ClawRouter | `blockrun/eco` | ~$0.006 | **Recommended.** Zero credentials, pays with USDC via x402 |
|
|
307
307
|
| OpenAI | `gpt-4o-mini` | ~$0.001 | Cheapest API key option, fast, reliable |
|
|
308
308
|
| Gemini | `gemini-2.5-flash` | ~$0.001 | Fast, good accuracy |
|
|
309
309
|
| DeepSeek | `deepseek-chat` | ~$0.001 | Fast, accessible in China |
|
|
@@ -561,7 +561,7 @@ Supported grinders (all race in parallel -- first nonce wins, falls back to JS a
|
|
|
561
561
|
|
|
562
562
|
### x402 GPU Grinding (Remote RTX 4090)
|
|
563
563
|
|
|
564
|
-
No GPU? Add `USE_X402_GRIND=true` to your `.env` for remote RTX 4090 nonce grinding at
|
|
564
|
+
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.
|
|
565
565
|
|
|
566
566
|
```bash
|
|
567
567
|
# In your .env (enabled automatically when USE_X402=true)
|