nano-pow 1.2.4 → 3.0.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/README.md +38 -16
- package/dist/main.min.js +649 -364
- package/dist/types.d.ts +44 -7
- package/package.json +5 -6
- package/dist/global.min.js +0 -674
package/dist/types.d.ts
CHANGED
|
@@ -1,22 +1,59 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2025 Chris Duncan <chris@zoso.dev>
|
|
2
|
+
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
3
|
+
|
|
1
4
|
import "@webgpu/types"
|
|
2
5
|
|
|
3
|
-
export declare const
|
|
6
|
+
export declare const NanoPowGlDownsampleShader: string
|
|
7
|
+
export declare const NanoPowGlDrawShader: string
|
|
4
8
|
export declare const NanoPowGlVertexShader: string
|
|
5
9
|
export declare const NanoPowGpuComputeShader: any
|
|
6
10
|
|
|
7
11
|
declare const NanoPow: typeof NanoPowGl | typeof NanoPowGpu | null
|
|
8
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Used to create WebGL framebuffer objects.
|
|
15
|
+
*
|
|
16
|
+
* @param {WebGLTexture} - Defines storage size
|
|
17
|
+
* @param {WebGLFramebuffer} - Holds texture data
|
|
18
|
+
* @param {size} - 2D lengths of texture
|
|
19
|
+
*/
|
|
20
|
+
export type FBO = {
|
|
21
|
+
texture: WebGLTexture
|
|
22
|
+
framebuffer: WebGLFramebuffer
|
|
23
|
+
size: {
|
|
24
|
+
x: number
|
|
25
|
+
y: number
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Used to configure NanoPow.
|
|
31
|
+
*
|
|
32
|
+
* @param {boolean} [debug=false] - Enables additional debug logging to the console. Default: false
|
|
33
|
+
* @param {number} [effort=0x8] - Multiplier for dispatching work search. Larger values are not necessarily better since they can quickly overwhelm the GPU. Ignored when validating. Default: 0x8
|
|
34
|
+
* @param {number} [threshold=0xfffffff8] - Minimum value result of `BLAKE2b(nonce||blockhash) << 0x32`. Default: 0xFFFFFFF8
|
|
35
|
+
*/
|
|
36
|
+
export type NanoPowOptions = {
|
|
37
|
+
debug?: boolean
|
|
38
|
+
effort?: number
|
|
39
|
+
threshold?: number
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Nano proof-of-work using WebGL 2.0.
|
|
44
|
+
*/
|
|
9
45
|
export declare class NanoPowGl {
|
|
10
46
|
#private
|
|
11
47
|
/** Compile */
|
|
12
48
|
static init (): Promise<void>
|
|
49
|
+
static reset (): void
|
|
13
50
|
/**
|
|
14
51
|
* Finds a nonce that satisfies the Nano proof-of-work requirements.
|
|
15
52
|
*
|
|
16
53
|
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
|
|
17
54
|
* @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
|
|
18
55
|
*/
|
|
19
|
-
static search (hash: string,
|
|
56
|
+
static search (hash: string, options?: NanoPowOptions): Promise<string>
|
|
20
57
|
/**
|
|
21
58
|
* Validates that a nonce satisfies Nano proof-of-work requirements.
|
|
22
59
|
*
|
|
@@ -24,7 +61,7 @@ export declare class NanoPowGl {
|
|
|
24
61
|
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
|
|
25
62
|
* @param {number} [threshold=0xfffffff8] - Difficulty of proof-of-work calculation
|
|
26
63
|
*/
|
|
27
|
-
static validate (work: string, hash: string,
|
|
64
|
+
static validate (work: string, hash: string, options?: NanoPowOptions): Promise<boolean>
|
|
28
65
|
}
|
|
29
66
|
|
|
30
67
|
/**
|
|
@@ -39,15 +76,15 @@ export declare class NanoPowGpu {
|
|
|
39
76
|
* Finds a nonce that satisfies the Nano proof-of-work requirements.
|
|
40
77
|
*
|
|
41
78
|
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
|
|
42
|
-
* @param {
|
|
79
|
+
* @param {NanoPowOptions} options - Used to configure search execution
|
|
43
80
|
*/
|
|
44
|
-
static search (hash: string,
|
|
81
|
+
static search (hash: string, options?: NanoPowOptions): Promise<string>
|
|
45
82
|
/**
|
|
46
83
|
* Validates that a nonce satisfies Nano proof-of-work requirements.
|
|
47
84
|
*
|
|
48
85
|
* @param {string} work - Hexadecimal proof-of-work value to validate
|
|
49
86
|
* @param {string} hash - Hexadecimal hash of previous block, or public key for new accounts
|
|
50
|
-
* @param {
|
|
87
|
+
* @param {NanoPowOptions} options - Options used to configure search execution
|
|
51
88
|
*/
|
|
52
|
-
static validate (work: string, hash: string,
|
|
89
|
+
static validate (work: string, hash: string, options?: NanoPowOptions): Promise<boolean>
|
|
53
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nano-pow",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Proof-of-work generation and validation with WebGPU/WebGL for Nano cryptocurrency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nemo",
|
|
@@ -43,12 +43,11 @@
|
|
|
43
43
|
"build": "rm -rf types && tsc && node esbuild.mjs && cp types.d.ts dist"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "^22.
|
|
47
|
-
"@webgpu/types": "^0.1.
|
|
48
|
-
"esbuild": "^0.
|
|
46
|
+
"@types/node": "^22.13.8",
|
|
47
|
+
"@webgpu/types": "^0.1.54",
|
|
48
|
+
"esbuild": "^0.25.0",
|
|
49
49
|
"esbuild-plugin-glsl": "^1.2.2",
|
|
50
|
-
"
|
|
51
|
-
"typescript": "^5.7.3"
|
|
50
|
+
"typescript": "^5.8.2"
|
|
52
51
|
},
|
|
53
52
|
"type": "module",
|
|
54
53
|
"exports": [
|