@smartledger/bsv 7.5.5 → 7.5.7
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/CHANGELOG.md +74 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +25 -25
- package/bsv-ltp.min.js +25 -25
- package/bsv-mnemonic.min.js +1 -1
- package/bsv-shamir.min.js +1 -1
- package/bsv-smartcontract.min.js +2 -2
- package/bsv.bundle.js +25 -25
- package/bsv.min.js +25 -25
- package/docs/BN_JS_V5_REVIEW.md +94 -0
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/lib/address.js +23 -6
- package/lib/crypto/bn.js +3 -1
- package/lib/crypto/hash.browser.js +6 -1
- package/lib/crypto/hash.node.js +6 -1
- package/lib/networks.js +3 -1
- package/package.json +4 -3
- package/test/networks.js +45 -0
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,80 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.5.7] - 2026-08-07
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **`Address` threw whenever `lib/script` was required before `lib/address`.**
|
|
15
|
+
The two modules form a require cycle, and `address.js` ended with the usual idiom
|
|
16
|
+
— export yourself, then `var Script = require('./script')`. That only holds when
|
|
17
|
+
`address` loads first. Reaching `lib/script` first meant the require returned
|
|
18
|
+
script's **partially initialised** exports (`{}`), the captured binding stayed `{}`
|
|
19
|
+
forever, and every `instanceof Script` raised
|
|
20
|
+
`TypeError: Right-hand side of 'instanceof' is not callable`. `var` hoisting hid it,
|
|
21
|
+
since the name is in scope for the functions defined above the assignment.
|
|
22
|
+
|
|
23
|
+
This was reachable, not theoretical: deep imports are public API through the
|
|
24
|
+
`exports` map (`"./lib/*"`), so requiring `lib/script` first is a supported way to
|
|
25
|
+
use the package. Both `Address.fromScript(script)` and `new Address(script)` threw,
|
|
26
|
+
reaching the check through `_transformScript` and `_classifyArguments` respectively.
|
|
27
|
+
|
|
28
|
+
`Script` is now resolved at call time through a small accessor rather than captured
|
|
29
|
+
at module scope. `require` is cached, so it costs nothing, and by the time any of
|
|
30
|
+
these functions run the module is complete — which keeps `instanceof` **exact**
|
|
31
|
+
rather than loosening the check to a structural duck-type that a non-Script object
|
|
32
|
+
could satisfy.
|
|
33
|
+
|
|
34
|
+
- **`scripts/check-address-load-order.js`** guards it, wired into CI and available as
|
|
35
|
+
`npm run check:load-order`. It deliberately lives outside mocha: the check must clear
|
|
36
|
+
`require.cache`, which would invalidate every module reference an in-process suite is
|
|
37
|
+
holding. It exercises `fromScript`, the constructor **and** `payingTo` — the first
|
|
38
|
+
two reach the check by different paths, and `payingTo` reaches the `Script`
|
|
39
|
+
constructor itself. Confirmed to fail against the unpatched module rather than
|
|
40
|
+
passing vacuously.
|
|
41
|
+
|
|
42
|
+
Reported with an accurate reproduction and diagnosis in
|
|
43
|
+
`BUG-address-load-order-instanceof.md`. Suite 4601 (unchanged — the guard is a
|
|
44
|
+
standalone script, by necessity).
|
|
45
|
+
|
|
46
|
+
## [7.5.6] - 2026-08-07
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- **`cashAddrPrefixArray` threw whenever STN was enabled.** The getter's STN branch
|
|
51
|
+
called `STN.cashAddrPrefixToArray(...)`, but `STN` is a plain data object with no
|
|
52
|
+
methods — the two sibling branches correctly call the module-level function of that
|
|
53
|
+
name. Reading `Networks.testnet.cashAddrPrefixArray` after `Networks.enableStn()`
|
|
54
|
+
raised `TypeError: STN.cashAddrPrefixToArray is not a function`. Live, not latent.
|
|
55
|
+
|
|
56
|
+
Nothing caught it because nothing exercised the path: the existing network tests
|
|
57
|
+
assert on `cashAddrPrefix` (the string) and never read the array getter. Four
|
|
58
|
+
regression tests now cover all three branches plus the fact that each mode yields a
|
|
59
|
+
distinct prefix array, and they were confirmed to fail against the unpatched getter
|
|
60
|
+
rather than passing vacuously. They reset both toggles in `afterEach`, since
|
|
61
|
+
`enableStn`/`enableRegtest` mutate the shared `testnet` object and otherwise leak
|
|
62
|
+
into later tests.
|
|
63
|
+
|
|
64
|
+
### Changed (no behavioural difference)
|
|
65
|
+
|
|
66
|
+
Two defects that were correct by accident, corrected so the code states its intent.
|
|
67
|
+
Both were verified to leave output unchanged before being touched.
|
|
68
|
+
|
|
69
|
+
- **`Hash.hmac`** tested `key < blocksize` — a `Buffer` compared against a number,
|
|
70
|
+
which is always `false`, so the zero-padding branch never ran. The result was right
|
|
71
|
+
anyway: the XOR loop indexes past a short key and `x ^ undefined === x ^ 0`, exactly
|
|
72
|
+
what padding produces. Now `key.length < blocksize`. HMAC output is **byte-identical**
|
|
73
|
+
across 48 vectors spanning short, block-sized and over-length keys, in both the Node
|
|
74
|
+
and browser implementations.
|
|
75
|
+
|
|
76
|
+
- **`BN.prototype.toSMBigEndian`** used `&` (bitwise) between two comparisons rather
|
|
77
|
+
than `&&`. It worked because `===` binds tighter than `&` and `true & true` is `1`.
|
|
78
|
+
Now `&&`.
|
|
79
|
+
|
|
80
|
+
Reported with a reproduction and a correct diagnosis in
|
|
81
|
+
`BUG-networks-stn-cashaddrprefixarray.md`; each claim was reproduced here before being
|
|
82
|
+
acted on. Suite 4597 → 4601.
|
|
83
|
+
|
|
10
84
|
## [7.5.5] - 2026-08-07
|
|
11
85
|
|
|
12
86
|
### Fixed (security)
|
package/README.md
CHANGED
|
@@ -186,42 +186,42 @@ console.log('Status:', status) // 'revoked'
|
|
|
186
186
|
### **Core Modules**
|
|
187
187
|
| Module | Size | Use Case | CDN |
|
|
188
188
|
|--------|------|----------|-----|
|
|
189
|
-
| **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.
|
|
190
|
-
| **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.
|
|
189
|
+
| **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js` |
|
|
190
|
+
| **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.7/bsv.bundle.js` |
|
|
191
191
|
|
|
192
192
|
### **W3C Verifiable Credentials**
|
|
193
193
|
| Module | Size | Use Case | CDN |
|
|
194
194
|
|--------|------|----------|-----|
|
|
195
|
-
| **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@7.5.
|
|
196
|
-
| **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@7.5.
|
|
197
|
-
| **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@7.5.
|
|
198
|
-
| **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@7.5.
|
|
195
|
+
| **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@7.5.7/bsv-didweb.min.js` |
|
|
196
|
+
| **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@7.5.7/bsv-vcjwt.min.js` |
|
|
197
|
+
| **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@7.5.7/bsv-statuslist.min.js` |
|
|
198
|
+
| **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@7.5.7/bsv-anchor.min.js` |
|
|
199
199
|
|
|
200
200
|
### **Smart Contract & Development**
|
|
201
201
|
| Module | Size | Use Case | CDN |
|
|
202
202
|
|--------|------|----------|-----|
|
|
203
|
-
| **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.
|
|
204
|
-
| **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.
|
|
205
|
-
| **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.
|
|
206
|
-
| **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@7.5.
|
|
203
|
+
| **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.7/bsv-smartcontract.min.js` |
|
|
204
|
+
| **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.7/bsv-covenant.min.js` |
|
|
205
|
+
| **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.7/bsv-script-helper.min.js` |
|
|
206
|
+
| **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@7.5.7/bsv-security.min.js` |
|
|
207
207
|
|
|
208
208
|
### **Legal & Compliance**
|
|
209
209
|
| Module | Size | Use Case | CDN |
|
|
210
210
|
|--------|------|----------|-----|
|
|
211
|
-
| **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@7.5.
|
|
212
|
-
| **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@7.5.
|
|
211
|
+
| **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@7.5.7/bsv-ltp.min.js` |
|
|
212
|
+
| **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@7.5.7/bsv-gdaf.min.js` |
|
|
213
213
|
|
|
214
214
|
### **Advanced Cryptography**
|
|
215
215
|
| Module | Size | Use Case | CDN |
|
|
216
216
|
|--------|------|----------|-----|
|
|
217
|
-
| **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@7.5.
|
|
217
|
+
| **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@7.5.7/bsv-shamir.min.js` |
|
|
218
218
|
|
|
219
219
|
### **Utilities**
|
|
220
220
|
| Module | Size | Use Case | CDN |
|
|
221
221
|
|--------|------|----------|-----|
|
|
222
|
-
| **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.
|
|
223
|
-
| **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.
|
|
224
|
-
| **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.
|
|
222
|
+
| **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.7/bsv-ecies.min.js` |
|
|
223
|
+
| **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.7/bsv-message.min.js` |
|
|
224
|
+
| **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.7/bsv-mnemonic.min.js` |
|
|
225
225
|
|
|
226
226
|
## ⚡ **2-Minute Quick Start**
|
|
227
227
|
|
|
@@ -232,7 +232,7 @@ Get started with Bitcoin SV development in under 2 minutes:
|
|
|
232
232
|
npm install @smartledger/bsv
|
|
233
233
|
|
|
234
234
|
# Or include in HTML
|
|
235
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
235
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js"></script>
|
|
236
236
|
```
|
|
237
237
|
|
|
238
238
|
> **🔒 v5.0.0 (production hardening — has breaking changes):** Shamir secret
|
|
@@ -332,8 +332,8 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
332
332
|
|
|
333
333
|
### 🔧 **Basic Development** (~1.2MB total)
|
|
334
334
|
```html
|
|
335
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
336
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
335
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js"></script>
|
|
336
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-script-helper.min.js"></script>
|
|
337
337
|
<script>
|
|
338
338
|
const privateKey = new bsv.PrivateKey();
|
|
339
339
|
const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
|
|
@@ -342,9 +342,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
342
342
|
|
|
343
343
|
### 🔒 **Smart Contract Development** (~2.8MB total — each bundle re-embeds core BSV)
|
|
344
344
|
```html
|
|
345
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
346
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
347
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
345
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js"></script>
|
|
346
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-covenant.min.js"></script>
|
|
347
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-smartcontract.min.js"></script>
|
|
348
348
|
<script>
|
|
349
349
|
const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
350
350
|
.extractField('amount').push(50000).greaterThanOrEqual().verify().build();
|
|
@@ -354,9 +354,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
354
354
|
|
|
355
355
|
### 🆕 **Legal & Identity Development** (~3.4MB total — each bundle re-embeds core BSV)
|
|
356
356
|
```html
|
|
357
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
358
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
359
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
357
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js"></script>
|
|
358
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-ltp.min.js"></script>
|
|
359
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-gdaf.min.js"></script>
|
|
360
360
|
<script>
|
|
361
361
|
// Legal Token Protocol
|
|
362
362
|
const propertyToken = bsv.createPropertyToken({
|
|
@@ -370,9 +370,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
370
370
|
|
|
371
371
|
### 🆕 **Security & Cryptography** (~1.5MB total)
|
|
372
372
|
```html
|
|
373
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
374
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
375
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
373
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js"></script>
|
|
374
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-security.min.js"></script>
|
|
375
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-shamir.min.js"></script>
|
|
376
376
|
<script>
|
|
377
377
|
// Threshold Cryptography
|
|
378
378
|
const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
|
|
@@ -384,7 +384,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
384
384
|
|
|
385
385
|
### 🎯 **Everything Bundle** (~1.1MB)
|
|
386
386
|
```html
|
|
387
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
387
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.bundle.js"></script>
|
|
388
388
|
<script>
|
|
389
389
|
// Everything available immediately
|
|
390
390
|
const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
|
|
@@ -494,8 +494,8 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
494
494
|
|
|
495
495
|
#### 1. **Minimal Setup** - Core + Script Helper (~1.2MB)
|
|
496
496
|
```html
|
|
497
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
498
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
497
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js"></script>
|
|
498
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-script-helper.min.js"></script>
|
|
499
499
|
<script>
|
|
500
500
|
const tx = new bsv.Transaction();
|
|
501
501
|
const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
|
|
@@ -504,9 +504,9 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
504
504
|
|
|
505
505
|
#### 2. **DeFi Development** - Core + Covenants + Debug (~2.8MB — each bundle re-embeds core BSV)
|
|
506
506
|
```html
|
|
507
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
508
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
509
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
507
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js"></script>
|
|
508
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-covenant.min.js"></script>
|
|
509
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-smartcontract.min.js"></script>
|
|
510
510
|
<script>
|
|
511
511
|
const covenant = new bsvCovenant.CovenantInterface();
|
|
512
512
|
const debugInfo = SmartContract.interpretScript(script);
|
|
@@ -516,8 +516,8 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
516
516
|
|
|
517
517
|
#### 3. **Security First** - Core + Enhanced Security (~1.2MB)
|
|
518
518
|
```html
|
|
519
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
520
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
519
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.min.js"></script>
|
|
520
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv-security.min.js"></script>
|
|
521
521
|
<script>
|
|
522
522
|
const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
|
|
523
523
|
const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
|
|
@@ -526,7 +526,7 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
526
526
|
|
|
527
527
|
#### 4. **Everything Bundle** - One File Solution (~1.1MB)
|
|
528
528
|
```html
|
|
529
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
529
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.7/bsv.bundle.js"></script>
|
|
530
530
|
<script>
|
|
531
531
|
// Everything available under bsv namespace
|
|
532
532
|
const keys = bsv.SmartLedgerBundle.generateKeys();
|
|
@@ -834,7 +834,7 @@ const timelockScript = helper.createTimelockScript(
|
|
|
834
834
|
|
|
835
835
|
See the **[16 Loading Options](#-16-loading-options---choose-your-approach)**
|
|
836
836
|
table near the top for the full list of bundles with current sizes and
|
|
837
|
-
canonical `unpkg.com/@smartledger/bsv@7.5.
|
|
837
|
+
canonical `unpkg.com/@smartledger/bsv@7.5.7/...` URLs.
|
|
838
838
|
|
|
839
839
|
## 🔐 Security
|
|
840
840
|
|