apow-cli 0.8.1 → 0.9.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/.env.example +10 -0
- package/README.md +38 -5
- package/dist/config.js +7 -0
- package/dist/dashboard.js +1 -1
- package/dist/grinder-native.js +256 -0
- package/dist/miner.js +38 -14
- package/package.json +1 -1
- package/skill.md +1 -1
package/.env.example
CHANGED
|
@@ -26,6 +26,16 @@ LLM_API_KEY=
|
|
|
26
26
|
# SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
|
|
27
27
|
# SQUID_INTEGRATOR_ID=
|
|
28
28
|
|
|
29
|
+
# GPU Mining (optional — auto-detected, massive speed boost)
|
|
30
|
+
# GRINDER_MODE=auto # auto (default) or js (force JS-only)
|
|
31
|
+
# GPU_GRINDER_PATH=./gpu/grinder-gpu # Metal binary (macOS, auto-detected)
|
|
32
|
+
# CPU_GRINDER_PATH=./gpu/grinder-cpu # C binary (any platform, auto-detected)
|
|
33
|
+
# CPU_THREADS=16 # Threads for CPU-C grinder (default: all cores)
|
|
34
|
+
# Remote GPU via Vast.ai (see: local/vast-setup.sh)
|
|
35
|
+
# VAST_IP= # Remote GPU host IP
|
|
36
|
+
# VAST_PORT= # Remote GPU SSH port
|
|
37
|
+
# REMOTE_GRINDER=/root/grinder-cuda # Path to CUDA binary on remote
|
|
38
|
+
|
|
29
39
|
# Contract addresses (defaults built-in, override only if needed)
|
|
30
40
|
# MINING_AGENT_ADDRESS=0xB7caD3ca5F2BD8aEC2Eb67d6E8D448099B3bC03D
|
|
31
41
|
# AGENT_COIN_ADDRESS=0x12577CF0D8a07363224D6909c54C056A183e13b3
|
package/README.md
CHANGED
|
@@ -159,14 +159,47 @@ apow fund --chain base --no-swap
|
|
|
159
159
|
|
|
160
160
|
**Auto-split targets:** 0.003 ETH (gas for ~100 mine txns) + 2.00 USDC (~100K x402 RPC calls). If both are already met, the CLI skips the swap.
|
|
161
161
|
|
|
162
|
-
##
|
|
162
|
+
## GPU Mining (v0.9.0+)
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
The miner auto-detects native GPU and CPU grinder binaries for dramatically faster nonce grinding:
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
| Grinder | Platform | Speed | Setup |
|
|
167
|
+
|---------|----------|-------|-------|
|
|
168
|
+
| Metal GPU | macOS (Apple Silicon) | ~260-500 MH/s | `cd local/gpu && make metal` |
|
|
169
|
+
| CUDA | Linux (RTX 4090 via Vast.ai) | ~20 GH/s | `./local/vast-setup.sh` |
|
|
170
|
+
| CPU-C | Any (multi-threaded C) | ~150-300 MH/s | `cd local/gpu && make cpu` |
|
|
171
|
+
| JS (fallback) | Any (worker_threads) | ~2-5 MH/s | Built-in, no setup |
|
|
172
|
+
|
|
173
|
+
All available grinders race in parallel -- first valid nonce wins. Falls back to JS automatically if no native binaries are found.
|
|
174
|
+
|
|
175
|
+
### Local GPU Setup (macOS)
|
|
168
176
|
|
|
169
|
-
|
|
177
|
+
```bash
|
|
178
|
+
cd local/gpu
|
|
179
|
+
make metal # builds grinder-gpu (Metal compute shader)
|
|
180
|
+
make cpu # builds grinder-cpu (multi-threaded C)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Place binaries in `./gpu/`, `~/.apow/`, or set `GPU_GRINDER_PATH`/`CPU_GRINDER_PATH` in `.env`.
|
|
184
|
+
|
|
185
|
+
### Remote GPU Setup (Vast.ai)
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
./local/vast-setup.sh # rent RTX 4090, upload + compile CUDA grinder
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Then add to `.env`:
|
|
192
|
+
```
|
|
193
|
+
VAST_IP=<ip>
|
|
194
|
+
VAST_PORT=<port>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The CUDA grinder runs over SSH alongside your local Metal/CPU grinders -- genuinely additive hash power.
|
|
198
|
+
|
|
199
|
+
### Other Optimizations
|
|
200
|
+
|
|
201
|
+
- **Algorithmic SMHL**: Mining SMHL challenges are solved algorithmically in microseconds (no LLM call). Your AI was already proven when you minted your Mining Rig.
|
|
202
|
+
- **JS threads**: If no native grinders are found, falls back to `worker_threads` across all CPU cores. Set `MINER_THREADS` in `.env` to override.
|
|
170
203
|
|
|
171
204
|
## Dashboard
|
|
172
205
|
|
package/dist/config.js
CHANGED
|
@@ -88,6 +88,13 @@ exports.config = {
|
|
|
88
88
|
miningAgentAddress: parseAddress("MINING_AGENT_ADDRESS", DEFAULT_MINING_AGENT_ADDRESS),
|
|
89
89
|
agentCoinAddress: parseAddress("AGENT_COIN_ADDRESS", DEFAULT_AGENT_COIN_ADDRESS),
|
|
90
90
|
minerThreads: parseInt(process.env.MINER_THREADS ?? String(node_os_1.default.cpus().length), 10),
|
|
91
|
+
grinderMode: (process.env.GRINDER_MODE === "js" ? "js" : "auto"),
|
|
92
|
+
gpuGrinderPath: process.env.GPU_GRINDER_PATH,
|
|
93
|
+
cpuGrinderPath: process.env.CPU_GRINDER_PATH,
|
|
94
|
+
vastIp: process.env.VAST_IP,
|
|
95
|
+
vastPort: process.env.VAST_PORT,
|
|
96
|
+
cpuGrinderThreads: parseInt(process.env.CPU_THREADS ?? String(node_os_1.default.cpus().length), 10),
|
|
97
|
+
remoteGrinderPath: process.env.REMOTE_GRINDER ?? "/root/grinder-cuda",
|
|
91
98
|
};
|
|
92
99
|
function requirePrivateKey() {
|
|
93
100
|
if (!exports.config.privateKey) {
|
package/dist/dashboard.js
CHANGED
|
@@ -427,7 +427,7 @@ function startDashboardServer(opts) {
|
|
|
427
427
|
return JSON.stringify(fleets.map((f) => ({ name: f.name, walletCount: f.addresses.length })));
|
|
428
428
|
}
|
|
429
429
|
function handleConfig() {
|
|
430
|
-
const rpcIsDefault = useX402
|
|
430
|
+
const rpcIsDefault = !useX402 && rpcUrl === DEFAULT_RPC;
|
|
431
431
|
const walletCount = getWalletAddresses(walletsPath).length;
|
|
432
432
|
return JSON.stringify({ rpcIsDefault, walletCount });
|
|
433
433
|
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Native GPU/CPU nonce grinder integration.
|
|
4
|
+
*
|
|
5
|
+
* Detects and spawns native grinder binaries (Metal, CPU-C, CUDA) for
|
|
6
|
+
* dramatically faster nonce grinding compared to JS worker_threads.
|
|
7
|
+
*
|
|
8
|
+
* Supported grinders:
|
|
9
|
+
* - Metal (macOS Apple Silicon): local GPU, ~260-500 MH/s
|
|
10
|
+
* - CPU-C (any platform): multi-threaded C, ~150-300 MH/s
|
|
11
|
+
* - CUDA (remote via SSH): Vast.ai RTX 4090, ~20 GH/s
|
|
12
|
+
*
|
|
13
|
+
* All grinders race in parallel. First valid nonce wins; others are killed.
|
|
14
|
+
*
|
|
15
|
+
* Binary interface:
|
|
16
|
+
* Metal/CPU: ./grinder <challenge> <address> <target> [threads]
|
|
17
|
+
* stdout: <nonce> <attempts> <elapsed_seconds>
|
|
18
|
+
*
|
|
19
|
+
* CUDA: ./grinder-cuda <challenge> <target> <address>
|
|
20
|
+
* stdout: F <addr_index> <nonce> <elapsed_seconds>
|
|
21
|
+
*/
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.detectGrinders = detectGrinders;
|
|
27
|
+
exports.hasNativeGrinders = hasNativeGrinders;
|
|
28
|
+
exports.grinderLabel = grinderLabel;
|
|
29
|
+
exports.grindNonceNative = grindNonceNative;
|
|
30
|
+
const node_child_process_1 = require("node:child_process");
|
|
31
|
+
const node_fs_1 = require("node:fs");
|
|
32
|
+
const node_path_1 = require("node:path");
|
|
33
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
34
|
+
const config_1 = require("./config");
|
|
35
|
+
/**
|
|
36
|
+
* Detect available native grinder binaries.
|
|
37
|
+
* Checks: explicit env var > ./gpu/ > ./ > ~/.apow/
|
|
38
|
+
*/
|
|
39
|
+
function detectGrinders() {
|
|
40
|
+
return {
|
|
41
|
+
gpu: detectLocalGpu(),
|
|
42
|
+
cpu: detectLocalCpu(),
|
|
43
|
+
remoteGpu: !!(config_1.config.vastIp && config_1.config.vastPort),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function detectLocalGpu() {
|
|
47
|
+
if (config_1.config.gpuGrinderPath) {
|
|
48
|
+
return (0, node_fs_1.existsSync)(config_1.config.gpuGrinderPath) ? config_1.config.gpuGrinderPath : null;
|
|
49
|
+
}
|
|
50
|
+
if (process.platform !== "darwin")
|
|
51
|
+
return null;
|
|
52
|
+
const candidates = [
|
|
53
|
+
(0, node_path_1.join)(process.cwd(), "gpu", "grinder-gpu"),
|
|
54
|
+
(0, node_path_1.join)(process.cwd(), "local", "gpu", "grinder-gpu"),
|
|
55
|
+
(0, node_path_1.join)(process.cwd(), "grinder-gpu"),
|
|
56
|
+
(0, node_path_1.join)(node_os_1.default.homedir(), ".apow", "grinder-gpu"),
|
|
57
|
+
];
|
|
58
|
+
for (const p of candidates) {
|
|
59
|
+
if ((0, node_fs_1.existsSync)(p))
|
|
60
|
+
return p;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
function detectLocalCpu() {
|
|
65
|
+
if (config_1.config.cpuGrinderPath) {
|
|
66
|
+
return (0, node_fs_1.existsSync)(config_1.config.cpuGrinderPath) ? config_1.config.cpuGrinderPath : null;
|
|
67
|
+
}
|
|
68
|
+
const candidates = [
|
|
69
|
+
(0, node_path_1.join)(process.cwd(), "gpu", "grinder-cpu"),
|
|
70
|
+
(0, node_path_1.join)(process.cwd(), "local", "gpu", "grinder-cpu"),
|
|
71
|
+
(0, node_path_1.join)(process.cwd(), "grinder-cpu"),
|
|
72
|
+
(0, node_path_1.join)(node_os_1.default.homedir(), ".apow", "grinder-cpu"),
|
|
73
|
+
];
|
|
74
|
+
for (const p of candidates) {
|
|
75
|
+
if ((0, node_fs_1.existsSync)(p))
|
|
76
|
+
return p;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
function hasNativeGrinders(info) {
|
|
81
|
+
return !!(info.gpu || info.cpu || info.remoteGpu);
|
|
82
|
+
}
|
|
83
|
+
function grinderLabel(info) {
|
|
84
|
+
const parts = [];
|
|
85
|
+
if (info.remoteGpu)
|
|
86
|
+
parts.push("CUDA (remote)");
|
|
87
|
+
if (info.gpu)
|
|
88
|
+
parts.push(process.platform === "darwin" ? "Metal GPU" : "GPU");
|
|
89
|
+
if (info.cpu)
|
|
90
|
+
parts.push(`CPU-C (${config_1.config.cpuGrinderThreads}t)`);
|
|
91
|
+
if (parts.length === 0)
|
|
92
|
+
return "JS worker_threads";
|
|
93
|
+
return parts.join(" + ");
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Grind nonce using all available native grinders in parallel.
|
|
97
|
+
* First to find a valid nonce wins; all others are killed.
|
|
98
|
+
*/
|
|
99
|
+
async function grindNonceNative(challengeNumber, target, minerAddress, info) {
|
|
100
|
+
const targetHex = "0x" + target.toString(16).padStart(64, "0");
|
|
101
|
+
const processes = [];
|
|
102
|
+
const start = process.hrtime();
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
let settled = false;
|
|
105
|
+
let failCount = 0;
|
|
106
|
+
let totalGrinders = 0;
|
|
107
|
+
function elapsed() {
|
|
108
|
+
const [s, ns] = process.hrtime(start);
|
|
109
|
+
return s + ns / 1_000_000_000;
|
|
110
|
+
}
|
|
111
|
+
function cleanup() {
|
|
112
|
+
for (const proc of processes) {
|
|
113
|
+
try {
|
|
114
|
+
proc.kill("SIGTERM");
|
|
115
|
+
}
|
|
116
|
+
catch { }
|
|
117
|
+
}
|
|
118
|
+
if (info.remoteGpu) {
|
|
119
|
+
try {
|
|
120
|
+
const kp = (0, node_child_process_1.spawn)("ssh", [
|
|
121
|
+
"-o", "StrictHostKeyChecking=no",
|
|
122
|
+
"-o", "ConnectTimeout=5",
|
|
123
|
+
"-p", config_1.config.vastPort,
|
|
124
|
+
`root@${config_1.config.vastIp}`,
|
|
125
|
+
"pkill -9 grinder-cuda 2>/dev/null",
|
|
126
|
+
]);
|
|
127
|
+
setTimeout(() => { try {
|
|
128
|
+
kp.kill();
|
|
129
|
+
}
|
|
130
|
+
catch { } }, 5000);
|
|
131
|
+
}
|
|
132
|
+
catch { }
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function onResult(result) {
|
|
136
|
+
if (settled)
|
|
137
|
+
return;
|
|
138
|
+
settled = true;
|
|
139
|
+
cleanup();
|
|
140
|
+
resolve(result);
|
|
141
|
+
}
|
|
142
|
+
function onFail() {
|
|
143
|
+
failCount++;
|
|
144
|
+
if (failCount >= totalGrinders && !settled) {
|
|
145
|
+
settled = true;
|
|
146
|
+
cleanup();
|
|
147
|
+
reject(new Error("All native grinders failed to find a nonce"));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Local Metal GPU
|
|
151
|
+
if (info.gpu) {
|
|
152
|
+
totalGrinders++;
|
|
153
|
+
const proc = (0, node_child_process_1.spawn)(info.gpu, [challengeNumber, minerAddress, targetHex]);
|
|
154
|
+
processes.push(proc);
|
|
155
|
+
let stdout = "";
|
|
156
|
+
proc.stdout.on("data", (d) => { stdout += d.toString(); });
|
|
157
|
+
proc.on("close", (code) => {
|
|
158
|
+
if (settled)
|
|
159
|
+
return;
|
|
160
|
+
if (code === 0) {
|
|
161
|
+
const parts = stdout.trim().split(/\s+/);
|
|
162
|
+
if (parts.length >= 3) {
|
|
163
|
+
const attempts = BigInt(parts[1]);
|
|
164
|
+
const e = parseFloat(parts[2]);
|
|
165
|
+
onResult({
|
|
166
|
+
nonce: BigInt(parts[0]),
|
|
167
|
+
attempts,
|
|
168
|
+
elapsed: e,
|
|
169
|
+
hashrate: e > 0 ? Number(attempts) / e : 0,
|
|
170
|
+
});
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
onFail();
|
|
175
|
+
});
|
|
176
|
+
proc.on("error", () => onFail());
|
|
177
|
+
}
|
|
178
|
+
// Local CPU-C
|
|
179
|
+
if (info.cpu) {
|
|
180
|
+
totalGrinders++;
|
|
181
|
+
const proc = (0, node_child_process_1.spawn)(info.cpu, [
|
|
182
|
+
challengeNumber, minerAddress, targetHex,
|
|
183
|
+
String(config_1.config.cpuGrinderThreads),
|
|
184
|
+
]);
|
|
185
|
+
processes.push(proc);
|
|
186
|
+
let stdout = "";
|
|
187
|
+
proc.stdout.on("data", (d) => { stdout += d.toString(); });
|
|
188
|
+
proc.on("close", (code) => {
|
|
189
|
+
if (settled)
|
|
190
|
+
return;
|
|
191
|
+
if (code === 0) {
|
|
192
|
+
const parts = stdout.trim().split(/\s+/);
|
|
193
|
+
if (parts.length >= 3) {
|
|
194
|
+
const attempts = BigInt(parts[1]);
|
|
195
|
+
const e = parseFloat(parts[2]);
|
|
196
|
+
onResult({
|
|
197
|
+
nonce: BigInt(parts[0]),
|
|
198
|
+
attempts,
|
|
199
|
+
elapsed: e,
|
|
200
|
+
hashrate: e > 0 ? Number(attempts) / e : 0,
|
|
201
|
+
});
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
onFail();
|
|
206
|
+
});
|
|
207
|
+
proc.on("error", () => onFail());
|
|
208
|
+
}
|
|
209
|
+
// Remote CUDA via SSH
|
|
210
|
+
if (info.remoteGpu) {
|
|
211
|
+
totalGrinders++;
|
|
212
|
+
// CUDA arg order differs: <challenge> <target> <address>
|
|
213
|
+
const proc = (0, node_child_process_1.spawn)("ssh", [
|
|
214
|
+
"-o", "StrictHostKeyChecking=no",
|
|
215
|
+
"-o", "ConnectTimeout=10",
|
|
216
|
+
"-o", "ServerAliveInterval=30",
|
|
217
|
+
"-p", config_1.config.vastPort,
|
|
218
|
+
`root@${config_1.config.vastIp}`,
|
|
219
|
+
`${config_1.config.remoteGrinderPath} ${challengeNumber} ${targetHex} ${minerAddress}`,
|
|
220
|
+
]);
|
|
221
|
+
processes.push(proc);
|
|
222
|
+
let buf = "";
|
|
223
|
+
proc.stdout.on("data", (d) => {
|
|
224
|
+
if (settled)
|
|
225
|
+
return;
|
|
226
|
+
buf += d.toString();
|
|
227
|
+
let nl;
|
|
228
|
+
while ((nl = buf.indexOf("\n")) !== -1) {
|
|
229
|
+
const line = buf.slice(0, nl).trim();
|
|
230
|
+
buf = buf.slice(nl + 1);
|
|
231
|
+
if (line.startsWith("F ")) {
|
|
232
|
+
const parts = line.split(/\s+/);
|
|
233
|
+
if (parts.length >= 4) {
|
|
234
|
+
const e = parseFloat(parts[3]);
|
|
235
|
+
onResult({
|
|
236
|
+
nonce: BigInt(parts[2]),
|
|
237
|
+
attempts: 0n,
|
|
238
|
+
elapsed: e,
|
|
239
|
+
hashrate: 0,
|
|
240
|
+
});
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
proc.on("close", () => {
|
|
247
|
+
if (!settled)
|
|
248
|
+
onFail();
|
|
249
|
+
});
|
|
250
|
+
proc.on("error", () => onFail());
|
|
251
|
+
}
|
|
252
|
+
if (totalGrinders === 0) {
|
|
253
|
+
reject(new Error("No native grinders available"));
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
package/dist/miner.js
CHANGED
|
@@ -45,6 +45,7 @@ const detect_1 = require("./detect");
|
|
|
45
45
|
const errors_1 = require("./errors");
|
|
46
46
|
const explorer_1 = require("./explorer");
|
|
47
47
|
const grinder_1 = require("./grinder");
|
|
48
|
+
const grinder_native_1 = require("./grinder-native");
|
|
48
49
|
const smhl_1 = require("./smhl");
|
|
49
50
|
const ui = __importStar(require("./ui"));
|
|
50
51
|
const wallet_1 = require("./wallet");
|
|
@@ -171,7 +172,13 @@ async function startMining(tokenId) {
|
|
|
171
172
|
let consecutiveFailures = 0;
|
|
172
173
|
let mineCount = 0;
|
|
173
174
|
let runningTotal = 0n;
|
|
175
|
+
// Detect native grinders once at startup
|
|
176
|
+
const grinderInfo = (0, grinder_native_1.detectGrinders)();
|
|
177
|
+
const useNative = config_1.config.grinderMode !== "js" && (0, grinder_native_1.hasNativeGrinders)(grinderInfo);
|
|
178
|
+
const modeLabel = useNative ? (0, grinder_native_1.grinderLabel)(grinderInfo) : `JS (${config_1.config.minerThreads} threads)`;
|
|
174
179
|
await showStartupBanner(tokenId);
|
|
180
|
+
console.log(` Grinder: ${ui.bold(modeLabel)}`);
|
|
181
|
+
console.log("");
|
|
175
182
|
while (true) {
|
|
176
183
|
try {
|
|
177
184
|
// Pre-flight ownership check
|
|
@@ -244,20 +251,37 @@ async function startMining(tokenId) {
|
|
|
244
251
|
}
|
|
245
252
|
const smhlElapsed = elapsedSeconds(smhlStart);
|
|
246
253
|
console.log(` ${ui.dim(`SMHL solved (${(smhlElapsed * 1000).toFixed(1)}ms)`)}`);
|
|
247
|
-
// Grind nonce
|
|
248
|
-
const nonceSpinner = ui.spinner(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
254
|
+
// Grind nonce — native GPU/CPU if available, JS fallback
|
|
255
|
+
const nonceSpinner = ui.spinner(`Grinding nonce (${modeLabel})...`);
|
|
256
|
+
let grind;
|
|
257
|
+
if (useNative) {
|
|
258
|
+
try {
|
|
259
|
+
grind = await (0, grinder_native_1.grindNonceNative)(challengeNumber, target, account.address, grinderInfo);
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
nonceSpinner.update("Native grinder failed — falling back to JS...");
|
|
263
|
+
grind = await (0, grinder_1.grindNonceParallel)({
|
|
264
|
+
challengeNumber,
|
|
265
|
+
target,
|
|
266
|
+
minerAddress: account.address,
|
|
267
|
+
threads: config_1.config.minerThreads,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
grind = await (0, grinder_1.grindNonceParallel)({
|
|
273
|
+
challengeNumber,
|
|
274
|
+
target,
|
|
275
|
+
minerAddress: account.address,
|
|
276
|
+
threads: config_1.config.minerThreads,
|
|
277
|
+
onProgress: (attempts, hashrate) => {
|
|
278
|
+
const khs = (hashrate / 1000).toFixed(0);
|
|
279
|
+
nonceSpinner.update(`Grinding nonce (JS)... ${khs}k H/s (${attempts.toLocaleString()} attempts)`);
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const khs = grind.hashrate > 0 ? (grind.hashrate / 1000).toFixed(0) : "?";
|
|
284
|
+
nonceSpinner.stop(`Nonce found (${grind.elapsed.toFixed(1)}s${grind.hashrate > 0 ? `, ${khs}k H/s` : ""})`);
|
|
261
285
|
// Submit transaction with spinner
|
|
262
286
|
const txSpinner = ui.spinner("Submitting transaction...");
|
|
263
287
|
const txHash = await walletClient.writeContract({
|
package/package.json
CHANGED
package/skill.md
CHANGED
|
@@ -519,7 +519,7 @@ pm2 logs
|
|
|
519
519
|
|
|
520
520
|
**RPC rate limits:** For 3+ concurrent miners, use a dedicated RPC endpoint (Alchemy, Infura, QuickNode). Free public RPCs will not handle the load.
|
|
521
521
|
|
|
522
|
-
**
|
|
522
|
+
**GPU mining (v0.9.0+):** The miner auto-detects native GPU grinder binaries for 50-1000x faster nonce grinding. Build Metal (macOS) or CPU-C grinders from `local/gpu/`, or rent a CUDA GPU on [vast.ai](https://vast.ai/) with `./local/vast-setup.sh`. All grinders race in parallel -- first nonce wins. Falls back to JS automatically.
|
|
523
523
|
|
|
524
524
|
### Local LLM Setup (Ollama)
|
|
525
525
|
|