@smartledger/bsv 7.10.0 → 7.11.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 +90 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +6 -6
- package/bsv-ltp.min.js +11 -11
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +6 -6
- package/bsv.d.ts +15 -0
- package/bsv.min.js +6 -6
- package/build/esbuild.js +4 -3
- 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/covenant-interface.js +16 -6
- package/lib/script/interpreter.js +50 -0
- package/package.json +1 -1
- package/test/build/bundle_externals.js +120 -0
- package/test/script/chronicle.js +40 -3
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,96 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.11.0] - 2026-08-10
|
|
11
|
+
|
|
12
|
+
### The Chronicle default, decided
|
|
13
|
+
|
|
14
|
+
Chronicle activated on BSV mainnet at block **943,816** on 2026-04-07, so a caller
|
|
15
|
+
validating anything created since needs its rules. The obvious move was to enable
|
|
16
|
+
`SCRIPT_ENABLE_CHRONICLE` by default. That is the wrong shape, and the reason is in the
|
|
17
|
+
node: it gates on `utxo_after_chronicle` — a property of **the output being spent**, not
|
|
18
|
+
of the chain or the validator. Both answers stay correct forever, because pre-activation
|
|
19
|
+
UTXOs remain spendable. A library-wide default would be a guess about the caller's input.
|
|
20
|
+
|
|
21
|
+
There is also no default to flip: `verify()` falls back to `0`, enabling no optional
|
|
22
|
+
feature at all, exactly as it does for FORKID, P2SH and CLTV. That is deliberate — a
|
|
23
|
+
validator should state the consensus context it is validating against.
|
|
24
|
+
|
|
25
|
+
**So the flag stays opt-in, and the real gap is fixed instead: callers had nothing
|
|
26
|
+
correct to opt into.** Assembling the flag set by hand invites getting it wrong, and
|
|
27
|
+
wrong here means a verdict that disagrees with the network.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- **`Interpreter.mainnetFlags({ afterChronicle })`** — the verification flags matching
|
|
32
|
+
BSV mainnet consensus. `afterChronicle` defaults to `true`, since every output created
|
|
33
|
+
since April is subject to Chronicle; pass `false` to validate the spend of a
|
|
34
|
+
pre-activation UTXO, which is the same distinction the node makes per input.
|
|
35
|
+
|
|
36
|
+
Script-number and element-size limits are deliberately **not** included: they are
|
|
37
|
+
process-wide statics raised by `useGenesisLimits()`, not flags. A post-Genesis
|
|
38
|
+
validator needs both, and the docstring says so.
|
|
39
|
+
|
|
40
|
+
- **`Interpreter.CHRONICLE_ACTIVATION_HEIGHT`** (943816), recorded so the per-UTXO
|
|
41
|
+
question has an answer in the library rather than in a changelog.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **A tautology in this project's own test suite, written in 7.7.0.** The assertion
|
|
46
|
+
`(Interpreter.DEFAULT_FLAGS & CHRONICLE).should.equal(0)` was meant to prove the flag
|
|
47
|
+
is off unless requested. `Interpreter.DEFAULT_FLAGS` does not exist, so it evaluated
|
|
48
|
+
`undefined & n` — zero for every `n`, and unfailable. It now calls `verify()` with the
|
|
49
|
+
flags argument omitted and asserts `BAD_OPCODE`, which is what it always meant.
|
|
50
|
+
|
|
51
|
+
Noted plainly because 7.10.1 fixed three checks of exactly this shape in other
|
|
52
|
+
people's code, and this one was mine.
|
|
53
|
+
|
|
54
|
+
Suite 4647.
|
|
55
|
+
|
|
56
|
+
## [7.10.1] - 2026-08-10
|
|
57
|
+
|
|
58
|
+
The three remaining findings from the #85 review. All three are cases of something
|
|
59
|
+
that *looked* like it checked a property and did not — the same class the corpus and
|
|
60
|
+
the bundle-parity gate keep surfacing.
|
|
61
|
+
|
|
62
|
+
### Fixed
|
|
63
|
+
|
|
64
|
+
- **The browser smoke test's cross-bundle assertion was a tautology.** In the one test
|
|
65
|
+
named `feature bundles did not embed a second library instance`, the assertion read
|
|
66
|
+
`assert(e.privateKey ? true : true, ...)` — it could not fail. Everything else in it
|
|
67
|
+
stayed inside the ecies bundle, so it would have passed unchanged even if that bundle
|
|
68
|
+
shipped a private copy of every primitive.
|
|
69
|
+
|
|
70
|
+
`ECIES.prototype.privateKey` does `this._privateKey = PrivateKey(hex)`, constructing
|
|
71
|
+
from the class *it* resolved, so `e._privateKey instanceof bsv.PrivateKey` is the real
|
|
72
|
+
test — the same shape as the neighbouring mnemonic case. Verified to fail when the
|
|
73
|
+
class identity is wrong.
|
|
74
|
+
|
|
75
|
+
- **`build/esbuild.js`'s `metafile` option claimed an assertion that did not exist.**
|
|
76
|
+
Its comment said it was "used to assert that feature bundles externalise the shared
|
|
77
|
+
primitives", but nothing consumed it — `grep -rn metafile` returned only the option.
|
|
78
|
+
`test/build/bundle_externals.js` is now that consumer, and asserts three things:
|
|
79
|
+
|
|
80
|
+
- no module mapped by `LIB_GLOBALS` appears as a bundled input. This is derived from
|
|
81
|
+
the same table the build uses, so it cannot drift out of step with it;
|
|
82
|
+
- each bundle's `lib/` inputs are pinned, because `LIB_GLOBALS` is deliberately not
|
|
83
|
+
exhaustive — a feature bundle *should* carry its own feature code, so anything new
|
|
84
|
+
appearing is either growth or a leak, and a human decides which;
|
|
85
|
+
- nothing but two documented helpers is duplicated across bundles.
|
|
86
|
+
|
|
87
|
+
Verified by removing `privatekey` from `LIB_GLOBALS`: the test immediately reports
|
|
88
|
+
`bsv-ecies.min.js unexpectedly embeds lib/privatekey.js` and one more.
|
|
89
|
+
|
|
90
|
+
- **`lib/covenant-interface.js` held the last package-root require in `lib/`**, justified
|
|
91
|
+
by a comment claiming "this file is reached while index.js is still initializing". That
|
|
92
|
+
is not true — nothing in `index.js` or under `lib/` requires this module, only two
|
|
93
|
+
files in `examples/` — and the property it assigned was never read internally. It is
|
|
94
|
+
now a lazy getter, so `interface.bsv` keeps working while the require costs nothing
|
|
95
|
+
for everyone else, and the refactor in 7.10.0 is complete: no package-root require in
|
|
96
|
+
`lib/` executes at load.
|
|
97
|
+
|
|
98
|
+
Suite 4643 → 4645. Browser smoke 25/25, corpus 371/371, bundles unchanged.
|
|
99
|
+
|
|
10
100
|
## [7.10.0] - 2026-08-10
|
|
11
101
|
|
|
12
102
|
Internal restructuring with no API change, plus a conformance corpus and two
|
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.
|
|
190
|
-
| **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.
|
|
189
|
+
| **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js` |
|
|
190
|
+
| **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
196
|
-
| **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@7.
|
|
197
|
-
| **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@7.
|
|
198
|
-
| **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@7.
|
|
195
|
+
| **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-didweb.min.js` |
|
|
196
|
+
| **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-vcjwt.min.js` |
|
|
197
|
+
| **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@7.11.0/bsv-statuslist.min.js` |
|
|
198
|
+
| **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
204
|
-
| **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.
|
|
205
|
-
| **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.
|
|
206
|
-
| **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@7.
|
|
203
|
+
| **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.11.0/bsv-smartcontract.min.js` |
|
|
204
|
+
| **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.11.0/bsv-covenant.min.js` |
|
|
205
|
+
| **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.11.0/bsv-script-helper.min.js` |
|
|
206
|
+
| **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
212
|
-
| **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@7.
|
|
211
|
+
| **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js` |
|
|
212
|
+
| **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
217
|
+
| **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
223
|
-
| **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@7.
|
|
224
|
-
| **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@7.
|
|
222
|
+
| **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@7.11.0/bsv-ecies.min.js` |
|
|
223
|
+
| **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@7.11.0/bsv-message.min.js` |
|
|
224
|
+
| **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
235
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
336
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
335
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
|
|
336
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
346
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
347
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
345
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
|
|
346
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-covenant.min.js"></script>
|
|
347
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
358
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
359
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
357
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
|
|
358
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-ltp.min.js"></script>
|
|
359
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
374
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
375
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
373
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
|
|
374
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-security.min.js"></script>
|
|
375
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
387
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
498
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
497
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
|
|
498
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
508
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
509
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
507
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
|
|
508
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv-covenant.min.js"></script>
|
|
509
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
520
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.
|
|
519
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.0/bsv.min.js"></script>
|
|
520
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
529
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.11.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@7.
|
|
837
|
+
canonical `unpkg.com/@smartledger/bsv@7.11.0/...` URLs.
|
|
838
838
|
|
|
839
839
|
## 🔐 Security
|
|
840
840
|
|