nano-pow 5.1.9 → 5.1.10
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/AUTHORS.md +2 -2
- package/README.md +114 -83
- package/dist/bin/cli.js +11 -11
- package/dist/bin/nano-pow.sh +1 -1
- package/dist/bin/server.js +11 -11
- package/dist/main.min.js +24 -24
- package/dist/types.d.ts +1 -1
- package/docs/benchmarks.md +74 -67
- package/docs/blake2.md +6 -6
- package/docs/nano-pow.1 +3 -3
- package/docs/nano-pow.service +1 -1
- package/package.json +10 -10
- package/package.json.license +1 -1
package/AUTHORS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
2
|
+
SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
3
3
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
4
|
-->
|
|
5
5
|
|
|
6
|
-
Chris Duncan <chris@
|
|
6
|
+
Chris Duncan <chris@codecow.com> (codecow.com)
|
|
7
7
|
Ben Green <ben@latenightsketches.com> (numtel.github.io)
|
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
2
|
+
SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
3
3
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
4
4
|
-->
|
|
5
5
|
|
|
6
6
|
# nano-pow
|
|
7
|
+
|
|
7
8
|
_Proof-of-work generation and validation with WebGPU/WebGL for Nano cryptocurrency._
|
|
8
9
|
|
|
9
10
|
NanoPow uses WebGPU to generate proof-of-work nonces meeting the requirements
|
|
@@ -14,17 +15,21 @@ as fallbacks.
|
|
|
14
15
|
All calculations take place client-side, so nonces can be generated offline and
|
|
15
16
|
cached for the next transaction block. For more information about the
|
|
16
17
|
proof-of-work equation defined by Nano, see
|
|
17
|
-
https://docs.nano.org/integration-guides/work-generation/#work-calculation-details
|
|
18
|
+
<https://docs.nano.org/integration-guides/work-generation/#work-calculation-details>
|
|
18
19
|
|
|
19
20
|
## Installation
|
|
21
|
+
|
|
20
22
|
```console
|
|
21
|
-
|
|
23
|
+
npm i nano-pow
|
|
22
24
|
```
|
|
25
|
+
|
|
23
26
|
NanoPow can also be installed globally to add the `nano-pow` command to the
|
|
24
27
|
system environment. To learn more, see [#Executables](#executables).
|
|
25
28
|
|
|
26
29
|
## Usage
|
|
30
|
+
|
|
27
31
|
### Import
|
|
32
|
+
|
|
28
33
|
The easiest way to use NanoPow is to import it directly. Based on the features
|
|
29
34
|
available in the environment, NanoPow will try to use its most performant API.
|
|
30
35
|
|
|
@@ -32,124 +37,140 @@ The following two import statements are equivalent, and both are provided to
|
|
|
32
37
|
accomodate project style preferences:
|
|
33
38
|
|
|
34
39
|
```javascript
|
|
35
|
-
import { NanoPow } from
|
|
40
|
+
import { NanoPow } from "nano-pow";
|
|
36
41
|
// OR
|
|
37
|
-
import NanoPow from
|
|
42
|
+
import NanoPow from "nano-pow";
|
|
38
43
|
```
|
|
39
44
|
|
|
40
45
|
Use it directly on a webpage with a script module:
|
|
41
46
|
|
|
42
47
|
```html
|
|
43
48
|
<script type="module">
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
(async () => {
|
|
50
|
+
const { NanoPow } =
|
|
51
|
+
await import("https://cdn.jsdelivr.net/npm/nano-pow@latest");
|
|
52
|
+
const { work } = await NanoPow.work_generate(some_hash);
|
|
53
|
+
console.log(work);
|
|
54
|
+
})();
|
|
49
55
|
</script>
|
|
50
56
|
```
|
|
51
57
|
|
|
52
58
|
### Generate
|
|
59
|
+
|
|
53
60
|
```javascript
|
|
54
61
|
// `hash` is a 64-char hex string
|
|
55
|
-
const hash =
|
|
56
|
-
const { work } = await NanoPow.work_generate(hash)
|
|
62
|
+
const hash = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
|
63
|
+
const { work } = await NanoPow.work_generate(hash);
|
|
57
64
|
// Result is a 16-char hex string
|
|
58
65
|
```
|
|
59
66
|
|
|
60
67
|
### Validate
|
|
68
|
+
|
|
61
69
|
```javascript
|
|
62
70
|
// `work` is a 16-char hex string
|
|
63
|
-
const work =
|
|
71
|
+
const work = "fedcba0987654321";
|
|
64
72
|
// `hash` is a 64-char hex string
|
|
65
|
-
const hash =
|
|
66
|
-
const { valid } = await NanoPow.work_validate(work, hash)
|
|
73
|
+
const hash = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
|
74
|
+
const { valid } = await NanoPow.work_validate(work, hash);
|
|
67
75
|
// Result is a boolean
|
|
68
76
|
```
|
|
69
77
|
|
|
70
78
|
### Options
|
|
79
|
+
|
|
71
80
|
```javascript
|
|
72
81
|
const options = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
const { work } = await NanoPow.work_generate(hash, options)
|
|
82
|
+
// default best available in order: webgpu => webgl => wasm => cpu
|
|
83
|
+
api: "webgpu",
|
|
84
|
+
// default FFFFFFF800000000 for send/change blocks
|
|
85
|
+
difficulty: "FFFFFFC000000000",
|
|
86
|
+
// default 4, valid range 1-32
|
|
87
|
+
effort: 2,
|
|
88
|
+
// default false
|
|
89
|
+
debug: true,
|
|
90
|
+
};
|
|
91
|
+
const { work } = await NanoPow.work_generate(hash, options);
|
|
83
92
|
```
|
|
84
93
|
|
|
85
94
|
#### What is "effort"?
|
|
95
|
+
|
|
86
96
|
NanoPow's "effort" metric is an abstraction of various GPU and CPU capabilities.
|
|
87
97
|
Different systems will have different optimal settings, but as a general rule of
|
|
88
98
|
thumb:
|
|
89
99
|
|
|
90
|
-
|
|
91
|
-
GPU and the time it takes to compute the dispatch itself. Start with a low value
|
|
92
|
-
like 2 or 4.
|
|
93
|
-
|
|
94
|
-
pixels long on each side. Since PoW speed in this case depends on resolution
|
|
95
|
-
_and_ framerate, push for a value as high as the GPU can support. For example, a
|
|
96
|
-
GPU that can draw 4096 x 4096 at 15 FPS should be set around 16 effort.
|
|
97
|
-
|
|
98
|
-
multi-threading capabilities. Set effort equal to the number of physical cores
|
|
99
|
-
in the CPU.
|
|
100
|
+
- WebGPU must strike a balance between the overhead of dispatching work to the
|
|
101
|
+
GPU and the time it takes to compute the dispatch itself. Start with a low value
|
|
102
|
+
like 2 or 4.
|
|
103
|
+
- WegGL works by drawing to an invisible 2-D canvas that is `effort * 256`
|
|
104
|
+
pixels long on each side. Since PoW speed in this case depends on resolution
|
|
105
|
+
_and_ framerate, push for a value as high as the GPU can support. For example, a
|
|
106
|
+
GPU that can draw 4096 x 4096 at 15 FPS should be set around 16 effort.
|
|
107
|
+
- WASM does not use the GPU at all and instead depends on Web Workers for CPU
|
|
108
|
+
multi-threading capabilities. Set effort equal to the number of physical cores
|
|
109
|
+
in the CPU.
|
|
100
110
|
|
|
101
111
|
## Executables
|
|
112
|
+
|
|
102
113
|
NanoPow can be installed globally and executed from the command line. This is
|
|
103
114
|
useful for systems without a graphical interface.
|
|
115
|
+
|
|
104
116
|
```console
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
npm -g i nano-pow
|
|
118
|
+
nano-pow --help # view abbreviated CLI help
|
|
119
|
+
man nano-pow # view full manual
|
|
108
120
|
```
|
|
121
|
+
|
|
109
122
|
Ensure proper permissions exist on the
|
|
110
123
|
[npm `prefix`](https://docs.npmjs.com/cli/v11/commands/npm-prefix) directory and
|
|
111
124
|
that `PATH` is also configured accordingly. [nvm](https://github.com/nvm-sh/nvm)
|
|
112
125
|
is a great tool that handles this automatically.
|
|
113
126
|
|
|
114
127
|
### Command Line
|
|
128
|
+
|
|
115
129
|
NanoPow provides a shell command—`nano-pow`—to accomodate systems
|
|
116
130
|
without a graphical user interface. It launches a headless Chrome browser using
|
|
117
131
|
`puppeteer` to access the required WebGPU or WebGL APIs. Use the `--global` flag
|
|
118
132
|
when installing to add the executable script to the system.
|
|
133
|
+
|
|
119
134
|
```console
|
|
120
|
-
|
|
135
|
+
npm i -g nano-pow
|
|
121
136
|
```
|
|
137
|
+
|
|
122
138
|
Some examples are provided below, and for full documentation, read the manual
|
|
123
139
|
with `man nano-pow`.
|
|
124
140
|
|
|
125
141
|
```console
|
|
126
|
-
|
|
127
|
-
|
|
142
|
+
# Generate a work value using default settings and debugging output enabled.
|
|
143
|
+
nano-pow --debug 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
|
128
144
|
```
|
|
145
|
+
|
|
129
146
|
```console
|
|
130
|
-
|
|
131
|
-
|
|
147
|
+
# Generate work using customized behavior with options.
|
|
148
|
+
nano-pow --effort 32 --difficulty FFFFFFC000000000 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
|
132
149
|
```
|
|
150
|
+
|
|
133
151
|
```console
|
|
134
|
-
|
|
152
|
+
# Validate an existing work nonce against a blockhash.
|
|
135
153
|
nano-pow --validate fedcba9876543210 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
|
136
154
|
```
|
|
155
|
+
|
|
137
156
|
```console
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
157
|
+
# Process blockhashes in batches to reduce the initial startup overhead.
|
|
158
|
+
nano-pow 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef [...]
|
|
159
|
+
# OR
|
|
141
160
|
nano-pow $(cat /path/to/hashes/file)
|
|
142
|
-
|
|
143
|
-
|
|
161
|
+
# OR
|
|
162
|
+
cat /path/to/hashes/file | nano-pow
|
|
144
163
|
```
|
|
145
164
|
|
|
146
165
|
### Server
|
|
166
|
+
|
|
147
167
|
NanoPow also provides a basic work server similar to the one included in the
|
|
148
168
|
official Nano node software. The installed command will launch the server in a
|
|
149
169
|
detached process, and it can also be started manually to customize behavior by
|
|
150
170
|
executing the server script directly.
|
|
151
171
|
|
|
152
172
|
#### Environment Variables
|
|
173
|
+
|
|
153
174
|
`NANO_POW_DEBUG`: enable additional logging saved to the HOME directory
|
|
154
175
|
|
|
155
176
|
`NANO_POW_EFFORT`: increase or decrease demand on the GPU
|
|
@@ -157,48 +178,52 @@ executing the server script directly.
|
|
|
157
178
|
`NANO_POW_PORT`: override the default port 5040
|
|
158
179
|
|
|
159
180
|
```console
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
181
|
+
# Launch the server and detach from the current session
|
|
182
|
+
NANO_POW_PORT=8080 nano-pow --server
|
|
183
|
+
# View process ID for "NanoPow Server"
|
|
184
|
+
cat ~/.nano-pow/server.pid
|
|
185
|
+
# Display list of server logs
|
|
186
|
+
ls ~/.nano-pow/logs/
|
|
187
|
+
# Find process ID manually
|
|
188
|
+
pgrep NanoPow
|
|
168
189
|
```
|
|
190
|
+
|
|
169
191
|
Work is generated or validated by sending an HTTP `POST` request to the
|
|
170
192
|
configured hostname or IP address of the machine. Some basic help is available
|
|
171
193
|
via `GET` request.
|
|
194
|
+
|
|
172
195
|
```console
|
|
173
196
|
$ # Generate a work value
|
|
174
197
|
$ curl -d '{
|
|
175
|
-
|
|
176
|
-
|
|
198
|
+
"action": "work_generate",
|
|
199
|
+
"hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
|
|
177
200
|
}' localhost:5040
|
|
178
201
|
```
|
|
202
|
+
|
|
179
203
|
```console
|
|
180
204
|
$ # Validate a work value
|
|
181
205
|
$ curl -d '{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
206
|
+
"action": "work_validate",
|
|
207
|
+
"work": "e45835c3b291c3d1",
|
|
208
|
+
"hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
|
|
185
209
|
}' localhost:5040
|
|
186
210
|
```
|
|
187
211
|
|
|
188
212
|
## Notes
|
|
213
|
+
|
|
189
214
|
The `work` field in a Nano transaction block contains an 8-byte nonce that
|
|
190
215
|
satisfies the following equation:
|
|
191
216
|
|
|
192
217
|
> 𝘣𝘭𝘢𝘬𝘦2𝘣(𝘯𝘰𝘯𝘤𝘦 || 𝘣𝘭𝘰𝘤𝘬𝘩𝘢𝘴𝘩) ≥ 𝘵𝘩𝘳𝘦𝘴𝘩𝘰𝘭𝘥
|
|
193
218
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
without transactions or the hash of the most recent block in the account chain
|
|
199
|
-
for all other accounts.
|
|
200
|
-
|
|
201
|
-
for receive/open/epoch blocks.
|
|
219
|
+
- 𝘣𝘭𝘢𝘬𝘦2𝘣() is the cryptographic hash function BLAKE2b.
|
|
220
|
+
- 𝘯𝘰𝘯𝘤𝘦, an 8-byte value, is generated for the transaction.
|
|
221
|
+
- || is concatenation.
|
|
222
|
+
- 𝘣𝘭𝘰𝘤𝘬𝘩𝘢𝘴𝘩, a 32-byte value, is either the public key of brand new accounts
|
|
223
|
+
without transactions or the hash of the most recent block in the account chain
|
|
224
|
+
for all other accounts.
|
|
225
|
+
- 𝘵𝘩𝘳𝘦𝘴𝘩𝘰𝘭𝘥 is 0xFFFFFFF800000000 for send/change blocks and 0xFFFFFE0000000000
|
|
226
|
+
for receive/open/epoch blocks.
|
|
202
227
|
|
|
203
228
|
The BLAKE2b implementation has been optimized to the extreme for this package
|
|
204
229
|
due to the very narrow use case to which it is applied. The compute shader used
|
|
@@ -206,37 +231,43 @@ by the WebGPU implementation is consequently immense, but the goal is to squeeze
|
|
|
206
231
|
every last bit of speed and performance out of it.
|
|
207
232
|
|
|
208
233
|
## Tests
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
234
|
+
|
|
235
|
+
A few basic tests are available in the source repository.
|
|
236
|
+
|
|
237
|
+
- `test/index.html` in the source repository contains a web interface to change
|
|
238
|
+
execution options and compare results.
|
|
239
|
+
- `test/script.sh` runs some basic benchmarks to check the CLI, and then it
|
|
240
|
+
starts the `nano-pow` server and sends some validate and generate requests.
|
|
214
241
|
|
|
215
242
|
## Building
|
|
243
|
+
|
|
216
244
|
1. Clone source
|
|
217
245
|
1. Enter the directory
|
|
218
246
|
1. Install dev dependencies
|
|
219
247
|
1. Compile, minify, and bundle
|
|
220
248
|
|
|
221
249
|
```console
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
250
|
+
git clone https://codecow.com/nano-pow.git
|
|
251
|
+
cd nano-pow
|
|
252
|
+
npm i
|
|
225
253
|
```
|
|
226
254
|
|
|
227
255
|
## Reporting Bugs
|
|
228
|
-
|
|
256
|
+
|
|
257
|
+
Email: <bug-nano-pow@codecow.com>
|
|
229
258
|
|
|
230
259
|
## Acknowledgements
|
|
231
|
-
|
|
232
|
-
|
|
260
|
+
|
|
261
|
+
[numtel/nano-webgl-pow](https://github.com/numtel/nano-webgl-pow) for his
|
|
262
|
+
original WebGL implementation.
|
|
233
263
|
|
|
234
264
|
## Licenses
|
|
265
|
+
|
|
235
266
|
GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
|
|
236
267
|
Portions of this code are also provided under the MIT License: <https://spdx.org/licenses/MIT.html>
|
|
237
268
|
|
|
238
269
|
## Donations
|
|
270
|
+
|
|
239
271
|
Tips are always appreciated and can be sent to the following developer address:
|
|
240
|
-
|
|
272
|
+
|
|
241
273
|
nano_1zosoqs47yt47bnfg7sdf46kj7asn58b7uzm9ek95jw7ccatq37898u1zoso
|
|
242
|
-
```
|
package/dist/bin/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getRandomValues } from "node:crypto";
|
|
|
6
6
|
import { createInterface } from "node:readline/promises";
|
|
7
7
|
|
|
8
8
|
// src/utils/api-support/wasm.ts
|
|
9
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
9
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
10
10
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
11
11
|
var wasm = { isSupported: false };
|
|
12
12
|
Object.defineProperty(wasm, "isSupported", {
|
|
@@ -84,7 +84,7 @@ Object.defineProperty(wasm, "isSupported", {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
// src/utils/api-support/webgl.ts
|
|
87
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
87
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
88
88
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
89
89
|
var webgl = { isSupported: false };
|
|
90
90
|
Object.defineProperty(webgl, "isSupported", {
|
|
@@ -105,7 +105,7 @@ Object.defineProperty(webgl, "isSupported", {
|
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
// src/utils/api-support/webgpu.ts
|
|
108
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
108
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
109
109
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
110
110
|
var webgpu = { isSupported: false };
|
|
111
111
|
Object.defineProperty(webgpu, "isSupported", {
|
|
@@ -126,11 +126,11 @@ Object.defineProperty(webgpu, "isSupported", {
|
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
// src/utils/api-support/index.ts
|
|
129
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
129
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
130
130
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
131
131
|
|
|
132
132
|
// src/utils/bigint.ts
|
|
133
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
133
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
134
134
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
135
135
|
function bigintFrom(value, type) {
|
|
136
136
|
if (typeof value === "bigint") {
|
|
@@ -156,7 +156,7 @@ function bigintFrom(value, type) {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
// src/utils/cache.ts
|
|
159
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
159
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
160
160
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
161
161
|
var Cache = class {
|
|
162
162
|
static clear() {
|
|
@@ -198,7 +198,7 @@ var Cache = class {
|
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
// src/utils/logger.ts
|
|
201
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
201
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
202
202
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
203
203
|
var Logger = class {
|
|
204
204
|
isEnabled = false;
|
|
@@ -238,11 +238,11 @@ var Logger = class {
|
|
|
238
238
|
};
|
|
239
239
|
|
|
240
240
|
// src/utils/queue.ts
|
|
241
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
241
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
242
242
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
243
243
|
|
|
244
244
|
// src/utils/index.ts
|
|
245
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
245
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
246
246
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
247
247
|
var clearCache = Cache.clear;
|
|
248
248
|
function isHexN(value, byteLength) {
|
|
@@ -311,7 +311,7 @@ function stats(times) {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
// src/bin/cli.ts
|
|
314
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
314
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
315
315
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
316
316
|
process.title = "NanoPow CLI";
|
|
317
317
|
var logger = new Logger();
|
|
@@ -357,7 +357,7 @@ If validating a nonce, it must be a 16-character hexadecimal value.
|
|
|
357
357
|
Effort must be a decimal number between 1-32.
|
|
358
358
|
Difficulty must be a hexadecimal string between 0-FFFFFFFFFFFFFFFF.
|
|
359
359
|
|
|
360
|
-
Report bugs: <bug-nano-pow@
|
|
360
|
+
Report bugs: <bug-nano-pow@codecow.com>
|
|
361
361
|
Full documentation: <https://www.npmjs.com/package/nano-pow>
|
|
362
362
|
`);
|
|
363
363
|
process.exit(0);
|
package/dist/bin/nano-pow.sh
CHANGED
package/dist/bin/server.js
CHANGED
|
@@ -9,7 +9,7 @@ import { join } from "node:path";
|
|
|
9
9
|
import { launch } from "puppeteer";
|
|
10
10
|
|
|
11
11
|
// src/utils/api-support/wasm.ts
|
|
12
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
12
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
13
13
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
14
14
|
var wasm = { isSupported: false };
|
|
15
15
|
Object.defineProperty(wasm, "isSupported", {
|
|
@@ -87,7 +87,7 @@ Object.defineProperty(wasm, "isSupported", {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
// src/utils/api-support/webgl.ts
|
|
90
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
90
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
91
91
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
92
92
|
var webgl = { isSupported: false };
|
|
93
93
|
Object.defineProperty(webgl, "isSupported", {
|
|
@@ -108,7 +108,7 @@ Object.defineProperty(webgl, "isSupported", {
|
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
// src/utils/api-support/webgpu.ts
|
|
111
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
111
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
112
112
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
113
113
|
var webgpu = { isSupported: false };
|
|
114
114
|
Object.defineProperty(webgpu, "isSupported", {
|
|
@@ -129,11 +129,11 @@ Object.defineProperty(webgpu, "isSupported", {
|
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
// src/utils/api-support/index.ts
|
|
132
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
132
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
133
133
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
134
134
|
|
|
135
135
|
// src/utils/bigint.ts
|
|
136
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
136
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
137
137
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
138
138
|
function bigintFrom(value, type) {
|
|
139
139
|
if (typeof value === "bigint") {
|
|
@@ -159,7 +159,7 @@ function bigintFrom(value, type) {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
// src/utils/cache.ts
|
|
162
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
162
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
163
163
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
164
164
|
var Cache = class {
|
|
165
165
|
static clear() {
|
|
@@ -201,7 +201,7 @@ var Cache = class {
|
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
// src/utils/logger.ts
|
|
204
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
204
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
205
205
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
206
206
|
var Logger = class {
|
|
207
207
|
isEnabled = false;
|
|
@@ -241,11 +241,11 @@ var Logger = class {
|
|
|
241
241
|
};
|
|
242
242
|
|
|
243
243
|
// src/utils/queue.ts
|
|
244
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
244
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
245
245
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
246
246
|
|
|
247
247
|
// src/utils/index.ts
|
|
248
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
248
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
249
249
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
250
250
|
var clearCache = Cache.clear;
|
|
251
251
|
function isHexN(value, byteLength) {
|
|
@@ -263,7 +263,7 @@ function isHex32(value) {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
// src/bin/server.ts
|
|
266
|
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@
|
|
266
|
+
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
|
|
267
267
|
//! SPDX-License-Identifier: GPL-3.0-or-later
|
|
268
268
|
process.title = "NanoPow Server";
|
|
269
269
|
await writeFile(`${homedir()}/.nano-pow/server.pid`, `${process.pid}
|
|
@@ -439,7 +439,7 @@ HASH is a big-endian 64-character hexadecimal string.
|
|
|
439
439
|
WORK is little-endian 16-character hexadecimal string.
|
|
440
440
|
DIFFICULTY is an optional 16-character hexadecimal string (default: FFFFFFF800000000)
|
|
441
441
|
|
|
442
|
-
Report bugs: <bug-nano-pow@
|
|
442
|
+
Report bugs: <bug-nano-pow@codecow.com>
|
|
443
443
|
Full documentation: <https://www.npmjs.com/package/nano-pow>
|
|
444
444
|
`);
|
|
445
445
|
}
|