@btc-vision/transaction 1.8.7 → 1.8.8
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/browser/btc-vision-bitcoin.js +495 -491
- package/browser/index.js +58 -50
- package/browser/noble-curves.js +4 -4
- package/browser/noble-hashes.js +88 -88
- package/browser/rolldown-runtime.js +26 -19
- package/browser/src/epoch/validator/EpochValidator.d.ts +28 -6
- package/browser/vendors.js +3065 -3027
- package/build/epoch/validator/EpochValidator.d.ts +28 -6
- package/build/epoch/validator/EpochValidator.js +44 -10
- package/package.json +1 -1
- package/src/epoch/validator/EpochValidator.ts +67 -6
- package/tsconfig.build.tsbuildinfo +1 -1
package/browser/noble-hashes.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { A as he, C as ae, F as
|
|
1
|
+
import { n as Bt, r as re, t as N } from "./rolldown-runtime.js";
|
|
2
|
+
import { A as he, C as ae, F as rt, I as oe, L as X, O as ht, P as $, S as mt, _ as ce, b as pt, d as Vt, f as kt, h as qt, j as le, k as at, m as fe, p as Ut, v as ue } from "./noble-curves.js";
|
|
3
3
|
var ve = /* @__PURE__ */ re({
|
|
4
|
-
_MD5: () =>
|
|
5
|
-
_RIPEMD160: () =>
|
|
6
|
-
_SHA1: () =>
|
|
7
|
-
md5: () =>
|
|
8
|
-
ripemd160: () =>
|
|
9
|
-
sha1: () =>
|
|
4
|
+
_MD5: () => _t,
|
|
5
|
+
_RIPEMD160: () => yt,
|
|
6
|
+
_SHA1: () => bt,
|
|
7
|
+
md5: () => $t,
|
|
8
|
+
ripemd160: () => Qt,
|
|
9
|
+
sha1: () => Jt
|
|
10
10
|
});
|
|
11
|
-
function
|
|
11
|
+
function Et(t, e, s, h) {
|
|
12
12
|
return t === 0 ? e ^ s ^ h : t === 1 ? e & s | ~e & h : t === 2 ? (e | ~s) ^ h : t === 3 ? e & h | s & ~h : e ^ (s | ~h);
|
|
13
13
|
}
|
|
14
|
-
var q, K,
|
|
14
|
+
var q, K, bt, Jt, Ct, Ot, Y, et, _t, $t, Dt, ot, Ft, ct, lt, ft, ut, Mt, Tt, jt, Gt, Z, yt, Qt, me = Bt((() => {
|
|
15
15
|
le(), oe(), q = /* @__PURE__ */ Uint32Array.from([
|
|
16
16
|
1732584193,
|
|
17
17
|
4023233417,
|
|
18
18
|
2562383102,
|
|
19
19
|
271733878,
|
|
20
20
|
3285377520
|
|
21
|
-
]), K = /* @__PURE__ */ new Uint32Array(80),
|
|
21
|
+
]), K = /* @__PURE__ */ new Uint32Array(80), bt = class extends at {
|
|
22
22
|
A = q[0] | 0;
|
|
23
23
|
B = q[1] | 0;
|
|
24
24
|
C = q[2] | 0;
|
|
@@ -46,7 +46,7 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
46
46
|
let { A: s, B: h, C: r, D: o, E: n } = this;
|
|
47
47
|
for (let a = 0; a < 80; a++) {
|
|
48
48
|
let l, f;
|
|
49
|
-
a < 20 ? (l =
|
|
49
|
+
a < 20 ? (l = ht(h, r, o), f = 1518500249) : a < 40 ? (l = h ^ r ^ o, f = 1859775393) : a < 60 ? (l = he(h, r, o), f = 2400959708) : (l = h ^ r ^ o, f = 3395469782);
|
|
50
50
|
const I = X(s, 5) + l + n + f + K[a] | 0;
|
|
51
51
|
n = o, o = r, r = X(h, 30), h = s, s = I;
|
|
52
52
|
}
|
|
@@ -58,7 +58,7 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
58
58
|
destroy() {
|
|
59
59
|
this.destroyed = !0, this.set(0, 0, 0, 0, 0), $(this.buffer);
|
|
60
60
|
}
|
|
61
|
-
},
|
|
61
|
+
}, Jt = /* @__PURE__ */ rt(() => new bt()), Ct = /* @__PURE__ */ Math.pow(2, 32), Ot = /* @__PURE__ */ Array.from({ length: 64 }, (t, e) => Math.floor(Ct * Math.abs(Math.sin(e + 1)))), Y = /* @__PURE__ */ q.slice(0, 4), et = /* @__PURE__ */ new Uint32Array(16), _t = class extends at {
|
|
62
62
|
A = Y[0] | 0;
|
|
63
63
|
B = Y[1] | 0;
|
|
64
64
|
C = Y[2] | 0;
|
|
@@ -83,12 +83,12 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
83
83
|
let { A: s, B: h, C: r, D: o } = this;
|
|
84
84
|
for (let n = 0; n < 64; n++) {
|
|
85
85
|
let a, l, f;
|
|
86
|
-
n < 16 ? (a =
|
|
86
|
+
n < 16 ? (a = ht(h, r, o), l = n, f = [
|
|
87
87
|
7,
|
|
88
88
|
12,
|
|
89
89
|
17,
|
|
90
90
|
22
|
|
91
|
-
]) : n < 32 ? (a =
|
|
91
|
+
]) : n < 32 ? (a = ht(o, h, r), l = (5 * n + 1) % 16, f = [
|
|
92
92
|
5,
|
|
93
93
|
9,
|
|
94
94
|
14,
|
|
@@ -103,7 +103,7 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
103
103
|
10,
|
|
104
104
|
15,
|
|
105
105
|
21
|
|
106
|
-
]), a = a + s +
|
|
106
|
+
]), a = a + s + Ot[n] + et[l], s = o, o = r, r = h, h = h + X(a, f[n % 4]);
|
|
107
107
|
}
|
|
108
108
|
s = s + this.A | 0, h = h + this.B | 0, r = r + this.C | 0, o = o + this.D | 0, this.set(s, h, r, o);
|
|
109
109
|
}
|
|
@@ -113,7 +113,7 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
113
113
|
destroy() {
|
|
114
114
|
this.destroyed = !0, this.set(0, 0, 0, 0), $(this.buffer);
|
|
115
115
|
}
|
|
116
|
-
},
|
|
116
|
+
}, $t = /* @__PURE__ */ rt(() => new _t()), Dt = /* @__PURE__ */ Uint8Array.from([
|
|
117
117
|
7,
|
|
118
118
|
4,
|
|
119
119
|
13,
|
|
@@ -130,11 +130,11 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
130
130
|
14,
|
|
131
131
|
11,
|
|
132
132
|
8
|
|
133
|
-
]),
|
|
134
|
-
const t = [[
|
|
135
|
-
for (let e = 0; e < 4; e++) for (let s of t) s.push(s[e].map((h) =>
|
|
133
|
+
]), ot = Uint8Array.from(new Array(16).fill(0).map((t, e) => e)), Ft = ot.map((t) => (9 * t + 5) % 16), ct = /* @__PURE__ */ (() => {
|
|
134
|
+
const t = [[ot], [Ft]];
|
|
135
|
+
for (let e = 0; e < 4; e++) for (let s of t) s.push(s[e].map((h) => Dt[h]));
|
|
136
136
|
return t;
|
|
137
|
-
})(),
|
|
137
|
+
})(), lt = ct[0], ft = ct[1], ut = /* @__PURE__ */ [
|
|
138
138
|
[
|
|
139
139
|
11,
|
|
140
140
|
14,
|
|
@@ -225,19 +225,19 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
225
225
|
5,
|
|
226
226
|
5
|
|
227
227
|
]
|
|
228
|
-
].map((t) => Uint8Array.from(t)),
|
|
228
|
+
].map((t) => Uint8Array.from(t)), Mt = /* @__PURE__ */ lt.map((t, e) => t.map((s) => ut[e][s])), Tt = /* @__PURE__ */ ft.map((t, e) => t.map((s) => ut[e][s])), jt = /* @__PURE__ */ Uint32Array.from([
|
|
229
229
|
0,
|
|
230
230
|
1518500249,
|
|
231
231
|
1859775393,
|
|
232
232
|
2400959708,
|
|
233
233
|
2840853838
|
|
234
|
-
]),
|
|
234
|
+
]), Gt = /* @__PURE__ */ Uint32Array.from([
|
|
235
235
|
1352829926,
|
|
236
236
|
1548603684,
|
|
237
237
|
1836072691,
|
|
238
238
|
2053994217,
|
|
239
239
|
0
|
|
240
|
-
]), Z = /* @__PURE__ */ new Uint32Array(16),
|
|
240
|
+
]), Z = /* @__PURE__ */ new Uint32Array(16), yt = class extends at {
|
|
241
241
|
h0 = 1732584193;
|
|
242
242
|
h1 = -271733879;
|
|
243
243
|
h2 = -1732584194;
|
|
@@ -263,13 +263,13 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
263
263
|
for (let _ = 0; _ < 16; _++, e += 4) Z[_] = t.getUint32(e, !0);
|
|
264
264
|
let s = this.h0 | 0, h = s, r = this.h1 | 0, o = r, n = this.h2 | 0, a = n, l = this.h3 | 0, f = l, I = this.h4 | 0, b = I;
|
|
265
265
|
for (let _ = 0; _ < 5; _++) {
|
|
266
|
-
const k = 4 - _, O =
|
|
266
|
+
const k = 4 - _, O = jt[_], B = Gt[_], g = lt[_], F = ft[_], G = Mt[_], L = Tt[_];
|
|
267
267
|
for (let v = 0; v < 16; v++) {
|
|
268
|
-
const y = X(s +
|
|
268
|
+
const y = X(s + Et(_, r, n, l) + Z[g[v]] + O, G[v]) + I | 0;
|
|
269
269
|
s = I, I = l, l = X(n, 10) | 0, n = r, r = y;
|
|
270
270
|
}
|
|
271
271
|
for (let v = 0; v < 16; v++) {
|
|
272
|
-
const y = X(h +
|
|
272
|
+
const y = X(h + Et(k, o, a, f) + Z[F[v]] + B, L[v]) + b | 0;
|
|
273
273
|
h = b, b = f, f = X(a, 10) | 0, a = o, o = y;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
@@ -281,14 +281,14 @@ var q, K, At, qt, Et, Ct, Y, et, bt, Jt, Ot, at, Dt, ot, ct, lt, ft, Ft, Tt, Mt,
|
|
|
281
281
|
destroy() {
|
|
282
282
|
this.destroyed = !0, $(this.buffer), this.set(0, 0, 0, 0, 0);
|
|
283
283
|
}
|
|
284
|
-
},
|
|
284
|
+
}, Qt = /* @__PURE__ */ rt(() => new yt());
|
|
285
285
|
}));
|
|
286
286
|
function de(t, e = !1) {
|
|
287
287
|
return e ? {
|
|
288
288
|
h: Number(t & z),
|
|
289
|
-
l: Number(t >>
|
|
289
|
+
l: Number(t >> St & z)
|
|
290
290
|
} : {
|
|
291
|
-
h: Number(t >>
|
|
291
|
+
h: Number(t >> St & z) | 0,
|
|
292
292
|
l: Number(t & z) | 0
|
|
293
293
|
};
|
|
294
294
|
}
|
|
@@ -301,41 +301,41 @@ function He(t, e = !1) {
|
|
|
301
301
|
}
|
|
302
302
|
return [h, r];
|
|
303
303
|
}
|
|
304
|
-
var z,
|
|
305
|
-
z = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
304
|
+
var z, St, Yt, Zt, zt, xt, Ae = Bt((() => {
|
|
305
|
+
z = /* @__PURE__ */ BigInt(2 ** 32 - 1), St = /* @__PURE__ */ BigInt(32), Yt = (t, e, s) => t << s | e >>> 32 - s, Zt = (t, e, s) => e << s | t >>> 32 - s, zt = (t, e, s) => e << s - 32 | t >>> 64 - s, xt = (t, e, s) => t << s - 32 | e >>> 64 - s;
|
|
306
306
|
}));
|
|
307
307
|
function be(t, e = 24) {
|
|
308
|
-
const s = new Uint32Array(10);
|
|
308
|
+
const s = /* @__PURE__ */ new Uint32Array(10);
|
|
309
309
|
for (let h = 24 - e; h < 24; h++) {
|
|
310
310
|
for (let n = 0; n < 10; n++) s[n] = t[n] ^ t[n + 10] ^ t[n + 20] ^ t[n + 30] ^ t[n + 40];
|
|
311
311
|
for (let n = 0; n < 10; n += 2) {
|
|
312
|
-
const a = (n + 8) % 10, l = (n + 2) % 10, f = s[l], I = s[l + 1], b =
|
|
312
|
+
const a = (n + 8) % 10, l = (n + 2) % 10, f = s[l], I = s[l + 1], b = wt(f, I, 1) ^ s[a], _ = Lt(f, I, 1) ^ s[a + 1];
|
|
313
313
|
for (let k = 0; k < 50; k += 10)
|
|
314
314
|
t[n + k] ^= b, t[n + k + 1] ^= _;
|
|
315
315
|
}
|
|
316
316
|
let r = t[2], o = t[3];
|
|
317
317
|
for (let n = 0; n < 24; n++) {
|
|
318
|
-
const a =
|
|
318
|
+
const a = gt[n], l = wt(r, o, a), f = Lt(r, o, a), I = It[n];
|
|
319
319
|
r = t[I], o = t[I + 1], t[I] = l, t[I + 1] = f;
|
|
320
320
|
}
|
|
321
321
|
for (let n = 0; n < 50; n += 10) {
|
|
322
322
|
for (let a = 0; a < 10; a++) s[a] = t[n + a];
|
|
323
323
|
for (let a = 0; a < 10; a++) t[n + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
324
324
|
}
|
|
325
|
-
t[0] ^=
|
|
325
|
+
t[0] ^= te[h], t[1] ^= ee[h];
|
|
326
326
|
}
|
|
327
|
-
|
|
327
|
+
qt(s);
|
|
328
328
|
}
|
|
329
|
-
var
|
|
330
|
-
Ae(), ue(),
|
|
329
|
+
var Pt, Q, Rt, Wt, Kt, Nt, It, gt, dt, Ht, te, ee, wt, Lt, Xt, At, _e, ye, pe = Bt((() => {
|
|
330
|
+
Ae(), ue(), Pt = BigInt(0), Q = BigInt(1), Rt = BigInt(2), Wt = BigInt(7), Kt = BigInt(256), Nt = BigInt(113), It = [], gt = [], dt = [];
|
|
331
331
|
for (let t = 0, e = Q, s = 1, h = 0; t < 24; t++) {
|
|
332
|
-
[s, h] = [h, (2 * s + 3 * h) % 5],
|
|
333
|
-
let r =
|
|
332
|
+
[s, h] = [h, (2 * s + 3 * h) % 5], It.push(2 * (5 * h + s)), gt.push((t + 1) * (t + 2) / 2 % 64);
|
|
333
|
+
let r = Pt;
|
|
334
334
|
for (let o = 0; o < 7; o++)
|
|
335
|
-
e = (e << Q ^ (e >>
|
|
336
|
-
|
|
335
|
+
e = (e << Q ^ (e >> Wt) * Nt) % Kt, e & Rt && (r ^= Q << (Q << BigInt(o)) - Q);
|
|
336
|
+
dt.push(r);
|
|
337
337
|
}
|
|
338
|
-
|
|
338
|
+
Ht = He(dt, !0), te = Ht[0], ee = Ht[1], wt = (t, e, s) => s > 32 ? zt(t, e, s) : Yt(t, e, s), Lt = (t, e, s) => s > 32 ? xt(t, e, s) : Zt(t, e, s), Xt = class se {
|
|
339
339
|
state;
|
|
340
340
|
pos = 0;
|
|
341
341
|
posOut = 0;
|
|
@@ -348,17 +348,17 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
348
348
|
enableXOF = !1;
|
|
349
349
|
rounds;
|
|
350
350
|
constructor(e, s, h, r = !1, o = 24) {
|
|
351
|
-
if (this.blockLen = e, this.suffix = s, this.outputLen = h, this.enableXOF = r, this.rounds = o,
|
|
352
|
-
this.state = new Uint8Array(200), this.state32 = ae(this.state);
|
|
351
|
+
if (this.blockLen = e, this.suffix = s, this.outputLen = h, this.enableXOF = r, this.rounds = o, Ut(h, "outputLen"), !(0 < e && e < 200)) throw new Error("only keccak-f1600 function is supported");
|
|
352
|
+
this.state = /* @__PURE__ */ new Uint8Array(200), this.state32 = ae(this.state);
|
|
353
353
|
}
|
|
354
354
|
clone() {
|
|
355
355
|
return this._cloneInto();
|
|
356
356
|
}
|
|
357
357
|
keccak() {
|
|
358
|
-
|
|
358
|
+
mt(this.state32), be(this.state32, this.rounds), mt(this.state32), this.posOut = 0, this.pos = 0;
|
|
359
359
|
}
|
|
360
360
|
update(e) {
|
|
361
|
-
|
|
361
|
+
kt(this), Vt(e);
|
|
362
362
|
const { blockLen: s, state: h } = this, r = e.length;
|
|
363
363
|
for (let o = 0; o < r; ) {
|
|
364
364
|
const n = Math.min(s - this.pos, r - o);
|
|
@@ -374,7 +374,7 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
374
374
|
e[h] ^= s, (s & 128) !== 0 && h === r - 1 && this.keccak(), e[r - 1] ^= 128, this.keccak();
|
|
375
375
|
}
|
|
376
376
|
writeInto(e) {
|
|
377
|
-
|
|
377
|
+
kt(this, !1), Vt(e), this.finish();
|
|
378
378
|
const s = this.state, { blockLen: h } = this;
|
|
379
379
|
for (let r = 0, o = e.length; r < o; ) {
|
|
380
380
|
this.posOut >= h && this.keccak();
|
|
@@ -388,7 +388,7 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
388
388
|
return this.writeInto(e);
|
|
389
389
|
}
|
|
390
390
|
xof(e) {
|
|
391
|
-
return
|
|
391
|
+
return Ut(e), this.xofInto(new Uint8Array(e));
|
|
392
392
|
}
|
|
393
393
|
digestInto(e) {
|
|
394
394
|
if (fe(e, this), this.finished) throw new Error("digest() was already called");
|
|
@@ -398,17 +398,17 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
398
398
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
399
399
|
}
|
|
400
400
|
destroy() {
|
|
401
|
-
this.destroyed = !0,
|
|
401
|
+
this.destroyed = !0, qt(this.state);
|
|
402
402
|
}
|
|
403
403
|
_cloneInto(e) {
|
|
404
404
|
const { blockLen: s, suffix: h, outputLen: r, rounds: o, enableXOF: n } = this;
|
|
405
|
-
return e ||= new
|
|
405
|
+
return e ||= new se(s, h, r, n, o), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = h, e.outputLen = r, e.enableXOF = n, e.destroyed = this.destroyed, e;
|
|
406
406
|
}
|
|
407
|
-
},
|
|
407
|
+
}, At = (t, e, s, h = {}) => ce((r = {}) => new Xt(e, t, r.dkLen === void 0 ? s : r.dkLen, !0), h), _e = /* @__PURE__ */ At(31, 168, 16, /* @__PURE__ */ pt(11)), ye = /* @__PURE__ */ At(31, 136, 32, /* @__PURE__ */ pt(12));
|
|
408
408
|
})), Se = /* @__PURE__ */ N(((t) => {
|
|
409
409
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.crypto = void 0, t.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
410
410
|
})), st = /* @__PURE__ */ N(((t) => {
|
|
411
|
-
Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = s, t.anumber = h, t.abytes = r, t.ahash = o, t.aexists = n, t.aoutput = a, t.u8 = l, t.u32 = f, t.clean = I, t.createView = b, t.rotr = _, t.rotl = k, t.byteSwap = O, t.byteSwap32 = B, t.bytesToHex = G, t.hexToBytes = y, t.asyncLoop = V, t.utf8ToBytes = m, t.bytesToUtf8 = E, t.toBytes = c, t.kdfInputToBytes = H, t.concatBytes = u, t.checkOpts = A, t.createHasher = C, t.createOptHasher =
|
|
411
|
+
Object.defineProperty(t, "__esModule", { value: !0 }), t.wrapXOFConstructorWithOpts = t.wrapConstructorWithOpts = t.wrapConstructor = t.Hash = t.nextTick = t.swap32IfBE = t.byteSwapIfBE = t.swap8IfBE = t.isLE = void 0, t.isBytes = s, t.anumber = h, t.abytes = r, t.ahash = o, t.aexists = n, t.aoutput = a, t.u8 = l, t.u32 = f, t.clean = I, t.createView = b, t.rotr = _, t.rotl = k, t.byteSwap = O, t.byteSwap32 = B, t.bytesToHex = G, t.hexToBytes = y, t.asyncLoop = V, t.utf8ToBytes = m, t.bytesToUtf8 = E, t.toBytes = c, t.kdfInputToBytes = H, t.concatBytes = u, t.checkOpts = A, t.createHasher = C, t.createOptHasher = M, t.createXOFer = T, t.randomBytes = P;
|
|
412
412
|
var e = Se();
|
|
413
413
|
function s(i) {
|
|
414
414
|
return i instanceof Uint8Array || ArrayBuffer.isView(i) && i.constructor.name === "Uint8Array";
|
|
@@ -487,11 +487,11 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
487
487
|
const d = i.length, S = d / 2;
|
|
488
488
|
if (d % 2) throw new Error("hex string expected, got unpadded hex of length " + d);
|
|
489
489
|
const U = new Uint8Array(S);
|
|
490
|
-
for (let D = 0,
|
|
491
|
-
const J = v(i.charCodeAt(
|
|
490
|
+
for (let D = 0, j = 0; D < S; D++, j += 2) {
|
|
491
|
+
const J = v(i.charCodeAt(j)), R = v(i.charCodeAt(j + 1));
|
|
492
492
|
if (J === void 0 || R === void 0) {
|
|
493
|
-
const W = i[
|
|
494
|
-
throw new Error('hex string expected, got non-hex character "' + W + '" at index ' +
|
|
493
|
+
const W = i[j] + i[j + 1];
|
|
494
|
+
throw new Error('hex string expected, got non-hex character "' + W + '" at index ' + j);
|
|
495
495
|
}
|
|
496
496
|
U[D] = J * 16 + R;
|
|
497
497
|
}
|
|
@@ -504,8 +504,8 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
504
504
|
let U = Date.now();
|
|
505
505
|
for (let D = 0; D < i; D++) {
|
|
506
506
|
S(D);
|
|
507
|
-
const
|
|
508
|
-
|
|
507
|
+
const j = Date.now() - U;
|
|
508
|
+
j >= 0 && j < d || (await (0, t.nextTick)(), U += j);
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
511
|
function m(i) {
|
|
@@ -529,8 +529,8 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
529
529
|
}
|
|
530
530
|
const S = new Uint8Array(d);
|
|
531
531
|
for (let U = 0, D = 0; U < i.length; U++) {
|
|
532
|
-
const
|
|
533
|
-
S.set(
|
|
532
|
+
const j = i[U];
|
|
533
|
+
S.set(j, D), D += j.length;
|
|
534
534
|
}
|
|
535
535
|
return S;
|
|
536
536
|
}
|
|
@@ -545,15 +545,15 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
545
545
|
const d = (U) => i().update(c(U)).digest(), S = i();
|
|
546
546
|
return d.outputLen = S.outputLen, d.blockLen = S.blockLen, d.create = () => i(), d;
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function M(i) {
|
|
549
549
|
const d = (U, D) => i(D).update(c(U)).digest(), S = i({});
|
|
550
550
|
return d.outputLen = S.outputLen, d.blockLen = S.blockLen, d.create = (U) => i(U), d;
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function T(i) {
|
|
553
553
|
const d = (U, D) => i(D).update(c(U)).digest(), S = i({});
|
|
554
554
|
return d.outputLen = S.outputLen, d.blockLen = S.blockLen, d.create = (U) => i(U), d;
|
|
555
555
|
}
|
|
556
|
-
t.wrapConstructor = C, t.wrapConstructorWithOpts =
|
|
556
|
+
t.wrapConstructor = C, t.wrapConstructorWithOpts = M, t.wrapXOFConstructorWithOpts = T;
|
|
557
557
|
function P(i = 32) {
|
|
558
558
|
if (e.crypto && typeof e.crypto.getRandomValues == "function") return e.crypto.getRandomValues(new Uint8Array(i));
|
|
559
559
|
if (e.crypto && typeof e.crypto.randomBytes == "function") return Uint8Array.from(e.crypto.randomBytes(i));
|
|
@@ -688,8 +688,8 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
688
688
|
const u = c.length;
|
|
689
689
|
let A = new Uint32Array(u), p = new Uint32Array(u);
|
|
690
690
|
for (let C = 0; C < u; C++) {
|
|
691
|
-
const { h:
|
|
692
|
-
[A[C], p[C]] = [
|
|
691
|
+
const { h: M, l: T } = h(c[C], H);
|
|
692
|
+
[A[C], p[C]] = [M, T];
|
|
693
693
|
}
|
|
694
694
|
return [A, p];
|
|
695
695
|
}
|
|
@@ -763,7 +763,7 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
763
763
|
add5L: V
|
|
764
764
|
};
|
|
765
765
|
t.default = E;
|
|
766
|
-
})),
|
|
766
|
+
})), ie = /* @__PURE__ */ N(((t) => {
|
|
767
767
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.sha512_224 = t.sha512_256 = t.sha384 = t.sha512 = t.sha224 = t.sha256 = t.SHA512_256 = t.SHA512_224 = t.SHA384 = t.SHA512 = t.SHA224 = t.SHA256 = void 0;
|
|
768
768
|
var e = Ie(), s = ge(), h = st(), r = /* @__PURE__ */ Uint32Array.from([
|
|
769
769
|
1116352408,
|
|
@@ -853,13 +853,13 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
853
853
|
process(L, v) {
|
|
854
854
|
for (let A = 0; A < 16; A++, v += 4) o[A] = L.getUint32(v, !1);
|
|
855
855
|
for (let A = 16; A < 64; A++) {
|
|
856
|
-
const p = o[A - 15], C = o[A - 2],
|
|
857
|
-
o[A] =
|
|
856
|
+
const p = o[A - 15], C = o[A - 2], M = (0, h.rotr)(p, 7) ^ (0, h.rotr)(p, 18) ^ p >>> 3, T = (0, h.rotr)(C, 17) ^ (0, h.rotr)(C, 19) ^ C >>> 10;
|
|
857
|
+
o[A] = T + o[A - 7] + M + o[A - 16] | 0;
|
|
858
858
|
}
|
|
859
859
|
let { A: y, B: w, C: V, D: m, E, F: c, G: H, H: u } = this;
|
|
860
860
|
for (let A = 0; A < 64; A++) {
|
|
861
|
-
const p = (0, h.rotr)(E, 6) ^ (0, h.rotr)(E, 11) ^ (0, h.rotr)(E, 25), C = u + p + (0, e.Chi)(E, c, H) + r[A] + o[A] | 0,
|
|
862
|
-
u = H, H = c, c = E, E = m + C | 0, m = V, V = w, w = y, y = C +
|
|
861
|
+
const p = (0, h.rotr)(E, 6) ^ (0, h.rotr)(E, 11) ^ (0, h.rotr)(E, 25), C = u + p + (0, e.Chi)(E, c, H) + r[A] + o[A] | 0, M = ((0, h.rotr)(y, 2) ^ (0, h.rotr)(y, 13) ^ (0, h.rotr)(y, 22)) + (0, e.Maj)(y, w, V) | 0;
|
|
862
|
+
u = H, H = c, c = E, E = m + C | 0, m = V, V = w, w = y, y = C + M | 0;
|
|
863
863
|
}
|
|
864
864
|
y = y + this.A | 0, w = w + this.B | 0, V = V + this.C | 0, m = m + this.D | 0, E = E + this.E | 0, c = c + this.F | 0, H = H + this.G | 0, u = u + this.H | 0, this.set(y, w, V, m, E, c, H, u);
|
|
865
865
|
}
|
|
@@ -963,7 +963,7 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
963
963
|
super(128, L, 16, !1), this.Ah = e.SHA512_IV[0] | 0, this.Al = e.SHA512_IV[1] | 0, this.Bh = e.SHA512_IV[2] | 0, this.Bl = e.SHA512_IV[3] | 0, this.Ch = e.SHA512_IV[4] | 0, this.Cl = e.SHA512_IV[5] | 0, this.Dh = e.SHA512_IV[6] | 0, this.Dl = e.SHA512_IV[7] | 0, this.Eh = e.SHA512_IV[8] | 0, this.El = e.SHA512_IV[9] | 0, this.Fh = e.SHA512_IV[10] | 0, this.Fl = e.SHA512_IV[11] | 0, this.Gh = e.SHA512_IV[12] | 0, this.Gl = e.SHA512_IV[13] | 0, this.Hh = e.SHA512_IV[14] | 0, this.Hl = e.SHA512_IV[15] | 0;
|
|
964
964
|
}
|
|
965
965
|
get() {
|
|
966
|
-
const { Ah: L, Al: v, Bh: y, Bl: w, Ch: V, Cl: m, Dh: E, Dl: c, Eh: H, El: u, Fh: A, Fl: p, Gh: C, Gl:
|
|
966
|
+
const { Ah: L, Al: v, Bh: y, Bl: w, Ch: V, Cl: m, Dh: E, Dl: c, Eh: H, El: u, Fh: A, Fl: p, Gh: C, Gl: M, Hh: T, Hl: P } = this;
|
|
967
967
|
return [
|
|
968
968
|
L,
|
|
969
969
|
v,
|
|
@@ -978,29 +978,29 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
978
978
|
A,
|
|
979
979
|
p,
|
|
980
980
|
C,
|
|
981
|
+
M,
|
|
981
982
|
T,
|
|
982
|
-
j,
|
|
983
983
|
P
|
|
984
984
|
];
|
|
985
985
|
}
|
|
986
|
-
set(L, v, y, w, V, m, E, c, H, u, A, p, C,
|
|
987
|
-
this.Ah = L | 0, this.Al = v | 0, this.Bh = y | 0, this.Bl = w | 0, this.Ch = V | 0, this.Cl = m | 0, this.Dh = E | 0, this.Dl = c | 0, this.Eh = H | 0, this.El = u | 0, this.Fh = A | 0, this.Fl = p | 0, this.Gh = C | 0, this.Gl =
|
|
986
|
+
set(L, v, y, w, V, m, E, c, H, u, A, p, C, M, T, P) {
|
|
987
|
+
this.Ah = L | 0, this.Al = v | 0, this.Bh = y | 0, this.Bl = w | 0, this.Ch = V | 0, this.Cl = m | 0, this.Dh = E | 0, this.Dl = c | 0, this.Eh = H | 0, this.El = u | 0, this.Fh = A | 0, this.Fl = p | 0, this.Gh = C | 0, this.Gl = M | 0, this.Hh = T | 0, this.Hl = P | 0;
|
|
988
988
|
}
|
|
989
989
|
process(L, v) {
|
|
990
990
|
for (let S = 0; S < 16; S++, v += 4)
|
|
991
991
|
b[S] = L.getUint32(v), _[S] = L.getUint32(v += 4);
|
|
992
992
|
for (let S = 16; S < 80; S++) {
|
|
993
|
-
const U = b[S - 15] | 0, D = _[S - 15] | 0,
|
|
994
|
-
b[S] =
|
|
993
|
+
const U = b[S - 15] | 0, D = _[S - 15] | 0, j = s.rotrSH(U, D, 1) ^ s.rotrSH(U, D, 8) ^ s.shrSH(U, D, 7), J = s.rotrSL(U, D, 1) ^ s.rotrSL(U, D, 8) ^ s.shrSL(U, D, 7), R = b[S - 2] | 0, W = _[S - 2] | 0, x = s.rotrSH(R, W, 19) ^ s.rotrBH(R, W, 61) ^ s.shrSH(R, W, 6), it = s.rotrSL(R, W, 19) ^ s.rotrBL(R, W, 61) ^ s.shrSL(R, W, 6), tt = s.add4L(J, it, _[S - 7], _[S - 16]), nt = s.add4H(tt, j, x, b[S - 7], b[S - 16]);
|
|
994
|
+
b[S] = nt | 0, _[S] = tt | 0;
|
|
995
995
|
}
|
|
996
|
-
let { Ah: y, Al: w, Bh: V, Bl: m, Ch: E, Cl: c, Dh: H, Dl: u, Eh: A, El: p, Fh: C, Fl:
|
|
996
|
+
let { Ah: y, Al: w, Bh: V, Bl: m, Ch: E, Cl: c, Dh: H, Dl: u, Eh: A, El: p, Fh: C, Fl: M, Gh: T, Gl: P, Hh: i, Hl: d } = this;
|
|
997
997
|
for (let S = 0; S < 80; S++) {
|
|
998
|
-
const U = s.rotrSH(A, p, 14) ^ s.rotrSH(A, p, 18) ^ s.rotrBH(A, p, 41), D = s.rotrSL(A, p, 14) ^ s.rotrSL(A, p, 18) ^ s.rotrBL(A, p, 41),
|
|
999
|
-
i =
|
|
1000
|
-
const
|
|
1001
|
-
y = s.add3H(
|
|
998
|
+
const U = s.rotrSH(A, p, 14) ^ s.rotrSH(A, p, 18) ^ s.rotrBH(A, p, 41), D = s.rotrSL(A, p, 14) ^ s.rotrSL(A, p, 18) ^ s.rotrBL(A, p, 41), j = A & C ^ ~A & T, J = p & M ^ ~p & P, R = s.add5L(d, D, J, I[S], _[S]), W = s.add5H(R, i, U, j, f[S], b[S]), x = R | 0, it = s.rotrSH(y, w, 28) ^ s.rotrBH(y, w, 34) ^ s.rotrBH(y, w, 39), tt = s.rotrSL(y, w, 28) ^ s.rotrBL(y, w, 34) ^ s.rotrBL(y, w, 39), nt = y & V ^ y & E ^ V & E, ne = w & m ^ w & c ^ m & c;
|
|
999
|
+
i = T | 0, d = P | 0, T = C | 0, P = M | 0, C = A | 0, M = p | 0, { h: A, l: p } = s.add(H | 0, u | 0, W | 0, x | 0), H = E | 0, u = c | 0, E = V | 0, c = m | 0, V = y | 0, m = w | 0;
|
|
1000
|
+
const vt = s.add3L(x, tt, ne);
|
|
1001
|
+
y = s.add3H(vt, W, it, nt), w = vt | 0;
|
|
1002
1002
|
}
|
|
1003
|
-
({ h: y, l: w } = s.add(this.Ah | 0, this.Al | 0, y | 0, w | 0)), { h: V, l: m } = s.add(this.Bh | 0, this.Bl | 0, V | 0, m | 0), { h: E, l: c } = s.add(this.Ch | 0, this.Cl | 0, E | 0, c | 0), { h: H, l: u } = s.add(this.Dh | 0, this.Dl | 0, H | 0, u | 0), { h: A, l: p } = s.add(this.Eh | 0, this.El | 0, A | 0, p | 0), { h: C, l:
|
|
1003
|
+
({ h: y, l: w } = s.add(this.Ah | 0, this.Al | 0, y | 0, w | 0)), { h: V, l: m } = s.add(this.Bh | 0, this.Bl | 0, V | 0, m | 0), { h: E, l: c } = s.add(this.Ch | 0, this.Cl | 0, E | 0, c | 0), { h: H, l: u } = s.add(this.Dh | 0, this.Dl | 0, H | 0, u | 0), { h: A, l: p } = s.add(this.Eh | 0, this.El | 0, A | 0, p | 0), { h: C, l: M } = s.add(this.Fh | 0, this.Fl | 0, C | 0, M | 0), { h: T, l: P } = s.add(this.Gh | 0, this.Gl | 0, T | 0, P | 0), { h: i, l: d } = s.add(this.Hh | 0, this.Hl | 0, i | 0, d | 0), this.set(y, w, V, m, E, c, H, u, A, p, C, M, T, P, i, d);
|
|
1004
1004
|
}
|
|
1005
1005
|
roundClean() {
|
|
1006
1006
|
(0, h.clean)(b, _);
|
|
@@ -1064,11 +1064,11 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
1064
1064
|
t.SHA512_256 = G, t.sha256 = (0, h.createHasher)(() => new n()), t.sha224 = (0, h.createHasher)(() => new a()), t.sha512 = (0, h.createHasher)(() => new k()), t.sha384 = (0, h.createHasher)(() => new O()), t.sha512_256 = (0, h.createHasher)(() => new G()), t.sha512_224 = (0, h.createHasher)(() => new F());
|
|
1065
1065
|
})), Ve = /* @__PURE__ */ N(((t) => {
|
|
1066
1066
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.sha224 = t.SHA224 = t.sha256 = t.SHA256 = void 0;
|
|
1067
|
-
var e =
|
|
1067
|
+
var e = ie();
|
|
1068
1068
|
t.SHA256 = e.SHA256, t.sha256 = e.sha256, t.SHA224 = e.SHA224, t.sha224 = e.sha224;
|
|
1069
1069
|
})), ke = /* @__PURE__ */ N(((t) => {
|
|
1070
1070
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.sha512_256 = t.SHA512_256 = t.sha512_224 = t.SHA512_224 = t.sha384 = t.SHA384 = t.sha512 = t.SHA512 = void 0;
|
|
1071
|
-
var e =
|
|
1071
|
+
var e = ie();
|
|
1072
1072
|
t.SHA512 = e.SHA512, t.sha512 = e.sha512, t.SHA384 = e.SHA384, t.sha384 = e.sha384, t.SHA512_224 = e.SHA512_224, t.sha512_224 = e.sha512_224, t.SHA512_256 = e.SHA512_256, t.sha512_256 = e.sha512_256;
|
|
1073
1073
|
})), we = /* @__PURE__ */ N(((t) => {
|
|
1074
1074
|
Object.defineProperty(t, "__esModule", { value: !0 }), t.hmac = t.HMAC = void 0;
|
|
@@ -1136,7 +1136,7 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
1136
1136
|
function o(a, l, f, I) {
|
|
1137
1137
|
const { c: b, dkLen: _, DK: k, PRF: O, PRFSalt: B } = h(a, l, f, I);
|
|
1138
1138
|
let g;
|
|
1139
|
-
const F = new Uint8Array(4), G = (0, s.createView)(F), L = new Uint8Array(O.outputLen);
|
|
1139
|
+
const F = /* @__PURE__ */ new Uint8Array(4), G = (0, s.createView)(F), L = new Uint8Array(O.outputLen);
|
|
1140
1140
|
for (let v = 1, y = 0; y < _; v++, y += O.outputLen) {
|
|
1141
1141
|
const w = k.subarray(y, y + O.outputLen);
|
|
1142
1142
|
G.setInt32(0, v, !1), (g = B._cloneInto(g)).update(F).digestInto(L), w.set(L.subarray(0, w.length));
|
|
@@ -1150,7 +1150,7 @@ var Gt, Q, Pt, Rt, Wt, Kt, St, It, ut, dt, xt, te, gt, wt, Nt, Ht, _e, ye, pe =
|
|
|
1150
1150
|
async function n(a, l, f, I) {
|
|
1151
1151
|
const { c: b, dkLen: _, asyncTick: k, DK: O, PRF: B, PRFSalt: g } = h(a, l, f, I);
|
|
1152
1152
|
let F;
|
|
1153
|
-
const G = new Uint8Array(4), L = (0, s.createView)(G), v = new Uint8Array(B.outputLen);
|
|
1153
|
+
const G = /* @__PURE__ */ new Uint8Array(4), L = (0, s.createView)(G), v = new Uint8Array(B.outputLen);
|
|
1154
1154
|
for (let y = 1, w = 0; w < _; y++, w += B.outputLen) {
|
|
1155
1155
|
const V = O.subarray(w, w + B.outputLen);
|
|
1156
1156
|
L.setInt32(0, y, !1), (F = g._cloneInto(F)).update(G).digestInto(v), V.set(v.subarray(0, V.length)), await (0, s.asyncLoop)(b - 1, k, () => {
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
var c = Object.create,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var c = Object.create, _ = Object.defineProperty, O = Object.getOwnPropertyDescriptor, b = Object.getOwnPropertyNames, i = Object.getPrototypeOf, p = Object.prototype.hasOwnProperty, P = (e, t, r) => () => {
|
|
2
|
+
if (r) throw r[0];
|
|
3
|
+
try {
|
|
4
|
+
return e && (t = e(e = 0)), t;
|
|
5
|
+
} catch (a) {
|
|
6
|
+
throw r = [a], a;
|
|
7
|
+
}
|
|
8
|
+
}, g = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), w = (e, t) => {
|
|
9
|
+
let r = {};
|
|
10
|
+
for (var a in e)
|
|
11
|
+
_(r, a, {
|
|
12
|
+
get: e[a],
|
|
6
13
|
enumerable: !0
|
|
7
14
|
});
|
|
8
|
-
return
|
|
9
|
-
}, u = (e,
|
|
10
|
-
if (
|
|
11
|
-
for (var n = b(
|
|
12
|
-
|
|
13
|
-
get: ((v) =>
|
|
14
|
-
enumerable: !(
|
|
15
|
+
return t || _(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
16
|
+
}, u = (e, t, r, a) => {
|
|
17
|
+
if (t && typeof t == "object" || typeof t == "function")
|
|
18
|
+
for (var n = b(t), l = 0, s = n.length, o; l < s; l++)
|
|
19
|
+
o = n[l], !p.call(e, o) && o !== r && _(e, o, {
|
|
20
|
+
get: ((v) => t[v]).bind(null, o),
|
|
21
|
+
enumerable: !(a = O(t, o)) || a.enumerable
|
|
15
22
|
});
|
|
16
23
|
return e;
|
|
17
|
-
},
|
|
24
|
+
}, f = (e, t, r) => (r = e != null ? c(i(e)) : {}, u(t || !e || !e.__esModule ? _(r, "default", {
|
|
18
25
|
value: e,
|
|
19
26
|
enumerable: !0
|
|
20
|
-
}) :
|
|
27
|
+
}) : r, e)), j = (e) => p.call(e, "module.exports") ? e["module.exports"] : u(_({}, "__esModule", { value: !0 }), e);
|
|
21
28
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
f as a,
|
|
30
|
+
j as i,
|
|
31
|
+
P as n,
|
|
32
|
+
w as r,
|
|
33
|
+
g as t
|
|
27
34
|
};
|
|
@@ -6,9 +6,31 @@ export declare class EpochValidator {
|
|
|
6
6
|
*/
|
|
7
7
|
static sha1(data: Uint8Array): Uint8Array;
|
|
8
8
|
/**
|
|
9
|
-
* Calculate mining preimage
|
|
9
|
+
* Calculate mining preimage.
|
|
10
|
+
*
|
|
11
|
+
* When useConcatenatedPreimage is false the legacy XOR construction is used
|
|
12
|
+
* (checksumRoot ^ publicKey ^ salt). That construction is malleable: a
|
|
13
|
+
* miner can set salt == publicKey to force preimage == checksumRoot (max
|
|
14
|
+
* difficulty for free), or transform any solution to another key via
|
|
15
|
+
* salt' = publicKey' ^ publicKey ^ salt. When useConcatenatedPreimage is true
|
|
16
|
+
* the preimage is the 96-byte concatenation checksumRoot || publicKey || salt,
|
|
17
|
+
* which removes both (the SHA-1 proof-of-work over it is unchanged).
|
|
18
|
+
*
|
|
19
|
+
* The switch is a consensus rule: callers pass useConcatenatedPreimage =
|
|
20
|
+
* (epochBlockHeight >= activationHeight) using the activation height for the
|
|
21
|
+
* network they are on (opnet-node exposes it as
|
|
22
|
+
* consensusEpochPatches.PREIMAGE_CONCAT_PATCH_BLOCK_HEIGHT). The value MUST be
|
|
23
|
+
* identical across opnet-node, this library and the mining pool.
|
|
10
24
|
*/
|
|
11
|
-
static calculatePreimage(checksumRoot: Uint8Array, publicKey: Uint8Array, salt: Uint8Array): Uint8Array;
|
|
25
|
+
static calculatePreimage(checksumRoot: Uint8Array, publicKey: Uint8Array, salt: Uint8Array, useConcatenatedPreimage?: boolean): Uint8Array;
|
|
26
|
+
/**
|
|
27
|
+
* Non-malleable mining preimage: the 96-byte concatenation
|
|
28
|
+
* checksumRoot || publicKey || salt. The public key sits in its own segment,
|
|
29
|
+
* so a miner-chosen salt can neither cancel it nor be transformed to
|
|
30
|
+
* re-attribute another miner's solution. The SHA-1 proof-of-work over it is
|
|
31
|
+
* unchanged.
|
|
32
|
+
*/
|
|
33
|
+
static concatenatePreimage(checksumRoot: Uint8Array, publicKey: Uint8Array, salt: Uint8Array): Uint8Array;
|
|
12
34
|
/**
|
|
13
35
|
* Count matching bits between two hashes
|
|
14
36
|
*/
|
|
@@ -16,7 +38,7 @@ export declare class EpochValidator {
|
|
|
16
38
|
/**
|
|
17
39
|
* Verify an epoch solution using IPreimage
|
|
18
40
|
*/
|
|
19
|
-
static verifySolution(challenge: IChallengeSolution, log?: boolean): boolean;
|
|
41
|
+
static verifySolution(challenge: IChallengeSolution, log?: boolean, useHashedPreimage?: boolean): boolean;
|
|
20
42
|
/**
|
|
21
43
|
* Get the mining target block for an epoch
|
|
22
44
|
*/
|
|
@@ -24,11 +46,11 @@ export declare class EpochValidator {
|
|
|
24
46
|
/**
|
|
25
47
|
* Validate epoch winner from raw data
|
|
26
48
|
*/
|
|
27
|
-
static validateEpochWinner(epochData: RawChallenge): boolean;
|
|
49
|
+
static validateEpochWinner(epochData: RawChallenge, useHashedPreimage?: boolean): boolean;
|
|
28
50
|
/**
|
|
29
51
|
* Validate epoch winner from Preimage instance
|
|
30
52
|
*/
|
|
31
|
-
static validateChallengeSolution(challenge: IChallengeSolution): boolean;
|
|
53
|
+
static validateChallengeSolution(challenge: IChallengeSolution, useHashedPreimage?: boolean): boolean;
|
|
32
54
|
/**
|
|
33
55
|
* Calculate solution hash from preimage components
|
|
34
56
|
* @param targetChecksum The target checksum (32 bytes)
|
|
@@ -36,7 +58,7 @@ export declare class EpochValidator {
|
|
|
36
58
|
* @param salt The salt buffer (32 bytes)
|
|
37
59
|
* @returns The SHA-1 hash of the preimage
|
|
38
60
|
*/
|
|
39
|
-
static calculateSolution(targetChecksum: Uint8Array, publicKey: Uint8Array, salt: Uint8Array): Uint8Array;
|
|
61
|
+
static calculateSolution(targetChecksum: Uint8Array, publicKey: Uint8Array, salt: Uint8Array, useHashedPreimage?: boolean): Uint8Array;
|
|
40
62
|
/**
|
|
41
63
|
* Check if a solution meets the minimum difficulty requirement
|
|
42
64
|
*/
|