@smartledger/bsv 8.0.0 → 8.1.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/CHANGELOG.md +81 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +2 -2
- package/bsv-ltp.min.js +7 -7
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +2 -2
- package/bsv.min.js +2 -2
- package/docs/AUDIT_SCOPE.md +9 -9
- 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/script/interpreter.js +40 -26
- package/package.json +1 -1
- package/test/script/defaults.js +67 -0
- package/test/script/genesis_limits.js +37 -6
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,87 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [8.1.0] - 2026-08-13
|
|
11
|
+
|
|
12
|
+
### `useGenesisLimits()` no longer raises the script-number bound
|
|
13
|
+
|
|
14
|
+
It raised `MAXIMUM_ELEMENT_SIZE` along with the three size caps. That was right before the
|
|
15
|
+
limits became era-derived, when it was the only way to reach post-Genesis arithmetic. It
|
|
16
|
+
is not any more, and the raise had become purely harmful.
|
|
17
|
+
|
|
18
|
+
`MAXIMUM_ELEMENT_SIZE` is CScriptNum's `max_length`, and since 8.0.0 it serves only as the
|
|
19
|
+
**pre-Genesis fallback** for `maxScriptNumLength()` — post-Genesis is 750,000 and
|
|
20
|
+
post-Chronicle 32,000,000, both reached through the era flags. So raising it could not
|
|
21
|
+
enable post-Genesis arithmetic. It could only corrupt pre-Genesis validation:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
5-byte operand under P2SH,STRICTENC
|
|
25
|
+
|
|
26
|
+
fresh process: SCRIPT_ERR_SCRIPTNUM_OVERFLOW (what the node says)
|
|
27
|
+
after useGenesisLimits(): ACCEPTED
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
A false accept, in the direction that can cost money, reached through a process-wide side
|
|
31
|
+
effect on unrelated code later in the same process. The node's vectors agree
|
|
32
|
+
independently: all 22 `SCRIPTNUM_OVERFLOW` rows are pre-Genesis, and raising this static
|
|
33
|
+
turns 15 of them into false accepts.
|
|
34
|
+
|
|
35
|
+
The three size caps still lift, so the documented reason to call the function is
|
|
36
|
+
unaffected, and `setLimits()` can still set the bound explicitly.
|
|
37
|
+
|
|
38
|
+
**Migration.** If you called `useGenesisLimits()` to get arithmetic wider than four bytes,
|
|
39
|
+
ask for the era instead — `Interpreter.mainnetFlags()`, or simply omit the flags argument,
|
|
40
|
+
which has defaulted to current mainnet since 8.0.0. Calling `useGenesisLimits()` for that
|
|
41
|
+
purpose was already unsound, because it changed the rules for every later `verify()` in
|
|
42
|
+
the process, including ones deliberately validating under pre-Genesis rules.
|
|
43
|
+
|
|
44
|
+
Minor rather than patch: a public helper stops doing one of the four things it documented.
|
|
45
|
+
|
|
46
|
+
## [8.0.1] - 2026-08-13
|
|
47
|
+
|
|
48
|
+
### `mainnetFlags()` was applying 2019 limits
|
|
49
|
+
|
|
50
|
+
8.0.0 made the interpreter's limits era-derived, but `mainnetFlags()` was written before
|
|
51
|
+
the era model and never updated to carry the flags it depends on. It set
|
|
52
|
+
`SCRIPT_ENABLE_CHRONICLE` and none of `SCRIPT_GENESIS`,
|
|
53
|
+
`SCRIPT_UTXO_AFTER_GENESIS` or `SCRIPT_UTXO_AFTER_CHRONICLE`, so
|
|
54
|
+
`Interpreter#maxScriptNumLength()` fell through to the pre-Genesis static. A validator
|
|
55
|
+
built from the helper named after mainnet was applying the limits of 2019 — most sharply
|
|
56
|
+
the 4-byte script-number bound, which is why post-Genesis contracts could not do
|
|
57
|
+
arithmetic on satoshi amounts.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
8.0.0 8.0.1
|
|
61
|
+
mainnetFlags({ afterChronicle: false }) 4 750,000
|
|
62
|
+
mainnetFlags() 4 32,000,000
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Genesis is unconditional in this helper: it activated in 2020 and nothing still spendable
|
|
66
|
+
wants the older limits from something called `mainnetFlags`. `{ afterChronicle: false }`
|
|
67
|
+
drops only the Chronicle pair.
|
|
68
|
+
|
|
69
|
+
`useMainnetConsensus()` no longer pins `MAXIMUM_ELEMENT_SIZE`, and
|
|
70
|
+
`Interpreter.DEFAULT_SCRIPT_NUM_LENGTH` is removed. That pin existed to stop
|
|
71
|
+
`useGenesisLimits()` raising the bound to `0x7fffffff` and making Chronicle's
|
|
72
|
+
shift-overflow check unreachable; with the era flags present that fallback is not
|
|
73
|
+
consulted, so the symptom goes with the cause.
|
|
74
|
+
|
|
75
|
+
### How the value was settled
|
|
76
|
+
|
|
77
|
+
The node's vectors pin the pre-Genesis bound at 4 and are silent above it — all 22
|
|
78
|
+
`SCRIPTNUM_OVERFLOW` rows carry `P2SH,STRICTENC` with no era flag, and no Genesis-era row
|
|
79
|
+
exercises script-number width. Sweeping the static against the corpus: 1483/1483 at 4,
|
|
80
|
+
and 1468/1483 with 15 false accepts at 8, 32 or 750,000, every one of them a pre-Genesis
|
|
81
|
+
row. So the static could not be raised — and did not need to be, because 8.0.0 already
|
|
82
|
+
derived the bound from the era.
|
|
83
|
+
|
|
84
|
+
### Known sharp edge
|
|
85
|
+
|
|
86
|
+
`useGenesisLimits()` still raises `MAXIMUM_ELEMENT_SIZE`, which is now only the
|
|
87
|
+
pre-Genesis fallback. Calling it and then verifying with no era flag gets a corrupted
|
|
88
|
+
bound. That combination is contradictory, but the edge is real and will be removed
|
|
89
|
+
separately.
|
|
90
|
+
|
|
10
91
|
## [8.0.0] - 2026-08-13
|
|
11
92
|
|
|
12
93
|
This library is now measured against the reference node's own consensus vectors, and its
|
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@8.
|
|
190
|
-
| **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@8.
|
|
189
|
+
| **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@8.1.0/bsv.min.js` |
|
|
190
|
+
| **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
196
|
-
| **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@8.
|
|
197
|
-
| **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@8.
|
|
198
|
-
| **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@8.
|
|
195
|
+
| **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@8.1.0/bsv-didweb.min.js` |
|
|
196
|
+
| **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@8.1.0/bsv-vcjwt.min.js` |
|
|
197
|
+
| **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@8.1.0/bsv-statuslist.min.js` |
|
|
198
|
+
| **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
204
|
-
| **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@8.
|
|
205
|
-
| **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@8.
|
|
206
|
-
| **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@8.
|
|
203
|
+
| **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@8.1.0/bsv-smartcontract.min.js` |
|
|
204
|
+
| **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@8.1.0/bsv-covenant.min.js` |
|
|
205
|
+
| **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@8.1.0/bsv-script-helper.min.js` |
|
|
206
|
+
| **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
212
|
-
| **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@8.
|
|
211
|
+
| **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@8.1.0/bsv-ltp.min.js` |
|
|
212
|
+
| **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
217
|
+
| **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
223
|
-
| **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@8.
|
|
224
|
-
| **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@8.
|
|
222
|
+
| **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@8.1.0/bsv-ecies.min.js` |
|
|
223
|
+
| **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@8.1.0/bsv-message.min.js` |
|
|
224
|
+
| **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
235
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
336
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
335
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv.min.js"></script>
|
|
336
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
346
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
347
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
345
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv.min.js"></script>
|
|
346
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv-covenant.min.js"></script>
|
|
347
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
358
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
359
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
357
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv.min.js"></script>
|
|
358
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv-ltp.min.js"></script>
|
|
359
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
374
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
375
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
373
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv.min.js"></script>
|
|
374
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv-security.min.js"></script>
|
|
375
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
387
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
498
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
497
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv.min.js"></script>
|
|
498
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
508
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
509
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
507
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv.min.js"></script>
|
|
508
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv-covenant.min.js"></script>
|
|
509
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
520
|
-
<script src="https://unpkg.com/@smartledger/bsv@8.
|
|
519
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/bsv.min.js"></script>
|
|
520
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
529
|
+
<script src="https://unpkg.com/@smartledger/bsv@8.1.0/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@8.
|
|
837
|
+
canonical `unpkg.com/@smartledger/bsv@8.1.0/...` URLs.
|
|
838
838
|
|
|
839
839
|
## 🔐 Security
|
|
840
840
|
|