@smartledger/bsv 5.3.1 → 5.4.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 CHANGED
@@ -5,6 +5,21 @@ All notable changes to SmartLedger-BSV will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [5.4.0] - 2026-06-15
9
+
10
+ ### Changed
11
+
12
+ - **`elliptic` removed from the browser bundles (~120–140KB smaller each).**
13
+ The bundles still pulled `elliptic` transitively through `crypto-browserify`'s
14
+ `browserify-sign` + `create-ecdh` (for `crypto.createSign`/`createECDH` — APIs
15
+ bsv never calls; its EC crypto is `@noble`). Those are now stubbed out in the
16
+ webpack config, so no `elliptic` code ships in any bundle. e.g. `bsv.min.js`
17
+ 1271KB → 1149KB, `bsv-didweb`/`bsv-vcjwt`/`bsv-anchor` ~−138KB; published
18
+ tarball 12.2MB → 10.9MB. `randomBytes`/`createHash`/`createHmac` (the Shamir
19
+ CSPRNG and hashing) are unaffected. Verified by the headless-Chrome browser
20
+ smoke test (this was only safe once the secrets.js AMD/crypto fix in 5.3.1 made
21
+ the polyfill chain robust).
22
+
8
23
  ## [5.3.1] - 2026-06-15
9
24
 
10
25
  Patch release. Fixes browser-side Shamir secret sharing, which was broken in the
package/README.md CHANGED
@@ -2,23 +2,27 @@
2
2
 
3
3
  **🚀 Complete Bitcoin SV Development Framework with W3C Verifiable Credentials, DID:web, Legal Compliance, and 16 Flexible Loading Options**
4
4
 
5
- [![Version](https://img.shields.io/badge/version-4.2.1-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
5
+ [![Version](https://img.shields.io/badge/version-5.4.0-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
6
6
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
  [![BSV](https://img.shields.io/badge/BSV-Compatible-orange.svg)](https://bitcoinsv.com/)
8
8
  [![Modular](https://img.shields.io/badge/Loading-Modular-purple.svg)](#-16-loading-options---choose-your-approach)
9
9
  [![W3C](https://img.shields.io/badge/W3C-Compliant-blueviolet.svg)](#-legally-recognizable-credentials-v34x)
10
10
 
11
- The most comprehensive and flexible Bitcoin SV library available. **In v4.x**:
12
- first-class interpreter-verified covenants (OP_PUSH_TX, PELS, ownership tokens),
13
- post-Genesis script limits via a one-call opt-in, fixed credential-verification
14
- flaws in GDAF/VC-JWT, legally-recognizable DID:web + VC-JWT toolkit, and 16
15
- distribution methods. **v4.x is the only supported line — upgrade from 3.4.x.**
11
+ The most comprehensive and flexible Bitcoin SV library available. **In v5.x**:
12
+ all secp256k1 cryptography runs on the audited, constant-time
13
+ [`@noble`](https://github.com/paulmillr/noble-curves) suite (ECDSA, ECIES, key
14
+ derivation) with `elliptic` removed; Shamir secret sharing on a vetted GF(2⁸)
15
+ engine; JOSE-compliant VC-JWT — on top of the v4.x interpreter-verified covenant
16
+ stack (OP_PUSH_TX, PELS, ownership tokens), legally-recognizable DID:web + VC-JWT
17
+ toolkit, and 16 distribution methods. **v5.x is the only supported line — see
18
+ [Upgrading to v5.0.0](#upgrading-to-v500-breaking-changes) when moving from 4.x.**
16
19
 
17
- > **v4.2.0 (latest)**: first-class interpreter-verified covenants — `SmartContract.PushTx`,
18
- > `PELS`, `Token`, `Locks`, all evaluated end-to-end through `Script.Interpreter`
19
- > with positive **and** negative test coverage. See [CHANGELOG](./CHANGELOG.md#420---2026-06-07).
20
+ > **v5.4.0 (latest)**: all secp256k1 crypto on the audited `@noble` suite, with
21
+ > `elliptic` now gone from the bundles too (`bsv.min.js` ~1.1MB, ~120–140KB
22
+ > smaller per bundle); browser Shamir fixed and guarded by a headless-Chrome CI
23
+ > check. See [CHANGELOG](./CHANGELOG.md).
20
24
 
21
- ## 🆕 **v4.2.0 — Interpreter-Verified Covenants**
25
+ ## **Interpreter-Verified Covenants**
22
26
 
23
27
  The full covenant stack now lives at `bsv.SmartContract`, builds on the
24
28
  post-Genesis script limits added in 4.1.0, and verifies end-to-end through
@@ -72,7 +76,7 @@ const ok = SC.verifyScript(unlockScript, lockingScript, tx, inputIndex, satoshis
72
76
 
73
77
  ```bash
74
78
  # Install SmartLedger BSV v5.0.0
75
- npm install @smartledger/bsv@5.3.1
79
+ npm install @smartledger/bsv@5.4.0
76
80
 
77
81
  # Initialize DID:web issuer (generates ES256 keys)
78
82
  npx smartledger-bsv didweb init --domain example.com --alg ES256
@@ -181,42 +185,42 @@ console.log('Status:', status) // 'revoked'
181
185
  ### **Core Modules**
182
186
  | Module | Size | Use Case | CDN |
183
187
  |--------|------|----------|-----|
184
- | **bsv.min.js** | 1271KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js` |
185
- | **bsv.bundle.js** | 1271KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.3.1/bsv.bundle.js` |
188
+ | **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js` |
189
+ | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.4.0/bsv.bundle.js` |
186
190
 
187
191
  ### **W3C Verifiable Credentials**
188
192
  | Module | Size | Use Case | CDN |
189
193
  |--------|------|----------|-----|
190
- | **🟢 bsv-didweb.min.js** | 453KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@5.3.1/bsv-didweb.min.js` |
191
- | **🟢 bsv-vcjwt.min.js** | 454KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.3.1/bsv-vcjwt.min.js` |
192
- | **🟢 bsv-statuslist.min.js** | 553KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.3.1/bsv-statuslist.min.js` |
193
- | **🟢 bsv-anchor.min.js** | 452KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.3.1/bsv-anchor.min.js` |
194
+ | **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@5.4.0/bsv-didweb.min.js` |
195
+ | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.4.0/bsv-vcjwt.min.js` |
196
+ | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.4.0/bsv-statuslist.min.js` |
197
+ | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.4.0/bsv-anchor.min.js` |
194
198
 
195
199
  ### **Smart Contract & Development**
196
200
  | Module | Size | Use Case | CDN |
197
201
  |--------|------|----------|-----|
198
- | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@5.3.1/bsv-smartcontract.min.js` |
199
- | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.3.1/bsv-covenant.min.js` |
200
- | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.3.1/bsv-script-helper.min.js` |
201
- | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.3.1/bsv-security.min.js` |
202
+ | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@5.4.0/bsv-smartcontract.min.js` |
203
+ | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.4.0/bsv-covenant.min.js` |
204
+ | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.4.0/bsv-script-helper.min.js` |
205
+ | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.4.0/bsv-security.min.js` |
202
206
 
203
207
  ### **Legal & Compliance**
204
208
  | Module | Size | Use Case | CDN |
205
209
  |--------|------|----------|-----|
206
- | **bsv-ltp.min.js** | 1271KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@5.3.1/bsv-ltp.min.js` |
207
- | **bsv-gdaf.min.js** | 1271KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.3.1/bsv-gdaf.min.js` |
210
+ | **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@5.4.0/bsv-ltp.min.js` |
211
+ | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.4.0/bsv-gdaf.min.js` |
208
212
 
209
213
  ### **Advanced Cryptography**
210
214
  | Module | Size | Use Case | CDN |
211
215
  |--------|------|----------|-----|
212
- | **bsv-shamir.min.js** | 476KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@5.3.1/bsv-shamir.min.js` |
216
+ | **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@5.4.0/bsv-shamir.min.js` |
213
217
 
214
218
  ### **Utilities**
215
219
  | Module | Size | Use Case | CDN |
216
220
  |--------|------|----------|-----|
217
- | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@5.3.1/bsv-ecies.min.js` |
218
- | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@5.3.1/bsv-message.min.js` |
219
- | **bsv-mnemonic.min.js** | 715KB | HD wallets | `unpkg.com/@smartledger/bsv@5.3.1/bsv-mnemonic.min.js` |
221
+ | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@5.4.0/bsv-ecies.min.js` |
222
+ | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@5.4.0/bsv-message.min.js` |
223
+ | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@5.4.0/bsv-mnemonic.min.js` |
220
224
 
221
225
  ## ⚡ **2-Minute Quick Start**
222
226
 
@@ -227,7 +231,7 @@ Get started with Bitcoin SV development in under 2 minutes:
227
231
  npm install @smartledger/bsv
228
232
 
229
233
  # Or include in HTML
230
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
234
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js"></script>
231
235
  ```
232
236
 
233
237
  > **🔒 v5.0.0 (production hardening — has breaking changes):** Shamir secret
@@ -325,21 +329,21 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
325
329
 
326
330
  ## 📚 **Quick Start Examples**
327
331
 
328
- ### 🔧 **Basic Development** (~1.3MB total)
332
+ ### 🔧 **Basic Development** (~1.2MB total)
329
333
  ```html
330
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
331
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-script-helper.min.js"></script>
334
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js"></script>
335
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-script-helper.min.js"></script>
332
336
  <script>
333
337
  const privateKey = new bsv.PrivateKey();
334
338
  const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
335
339
  </script>
336
340
  ```
337
341
 
338
- ### 🔒 **Smart Contract Development** (~3.0MB total — each bundle re-embeds core BSV)
342
+ ### 🔒 **Smart Contract Development** (~2.8MB total — each bundle re-embeds core BSV)
339
343
  ```html
340
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
341
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-covenant.min.js"></script>
342
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-smartcontract.min.js"></script>
344
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js"></script>
345
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-covenant.min.js"></script>
346
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-smartcontract.min.js"></script>
343
347
  <script>
344
348
  const covenant = bsv.SmartContract.createCovenantBuilder()
345
349
  .extractField('amount').push(50000).greaterThanOrEqual().verify().build();
@@ -347,11 +351,11 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
347
351
  </script>
348
352
  ```
349
353
 
350
- ### 🆕 **Legal & Identity Development** (~3.7MB total — each bundle re-embeds core BSV)
354
+ ### 🆕 **Legal & Identity Development** (~3.4MB total — each bundle re-embeds core BSV)
351
355
  ```html
352
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
353
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-ltp.min.js"></script>
354
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-gdaf.min.js"></script>
356
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js"></script>
357
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-ltp.min.js"></script>
358
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-gdaf.min.js"></script>
355
359
  <script>
356
360
  // Legal Token Protocol
357
361
  const propertyToken = bsv.createPropertyToken({
@@ -363,11 +367,11 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
363
367
  </script>
364
368
  ```
365
369
 
366
- ### 🆕 **Security & Cryptography** (~1.7MB total)
370
+ ### 🆕 **Security & Cryptography** (~1.5MB total)
367
371
  ```html
368
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
369
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-security.min.js"></script>
370
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-shamir.min.js"></script>
372
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js"></script>
373
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-security.min.js"></script>
374
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-shamir.min.js"></script>
371
375
  <script>
372
376
  // Threshold Cryptography
373
377
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -377,9 +381,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
377
381
  </script>
378
382
  ```
379
383
 
380
- ### 🎯 **Everything Bundle** (~1.3MB)
384
+ ### 🎯 **Everything Bundle** (~1.1MB)
381
385
  ```html
382
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.bundle.js"></script>
386
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.bundle.js"></script>
383
387
  <script>
384
388
  // Everything available immediately
385
389
  const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
@@ -412,7 +416,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
412
416
  - � **PUSHTX Integration**: nChain techniques for advanced covenant patterns → [PUSHTX Insights](docs/pushtx-key-insights.md)
413
417
 
414
418
  ### 📦 **Flexible Architecture**
415
- - 📦 **16 Modular Options**: Load only what you need (30KB to 1271KB) → [Loading Strategy](#-16-loading-options---choose-your-approach)
419
+ - 📦 **16 Modular Options**: Load only what you need (30KB to 1149KB) → [Loading Strategy](#-16-loading-options---choose-your-approach)
416
420
  - 📦 **Standalone Modules**: Independent legal, identity, and crypto modules → [Standalone Test](https://github.com/codenlighten/smartledger-bsv/blob/main/tests/standalone-modules-test.html)
417
421
  - 📦 **Complete Bundle**: Everything in one file for convenience → [Bundle Demo](https://github.com/codenlighten/smartledger-bsv/blob/main/tests/bundle-demo.html)
418
422
  - 📦 **CDN Ready**: All modules available via unpkg and jsDelivr
@@ -456,9 +460,10 @@ breaking changes only affect data produced by older versions:
456
460
  - **VC-JWT algorithm pinning.** `verifyVcJwt` rejects any token whose `alg` is
457
461
  outside `['ES256','ES256K']` (override via `opts.allowedAlgs`) and binds the
458
462
  key's curve to the algorithm — defense against alg-substitution attacks.
459
- - **Browser bundles are larger.** The full bundles now ship a real `crypto`
460
- polyfill so Shamir can source a CSPRNG (`bsv.min.js` ~937KB → ~1.3MB). The
461
- dedicated single-feature module bundles are unaffected.
463
+ - **Browser bundles changed size.** The full bundles ship a real `crypto`
464
+ polyfill so Shamir can source a CSPRNG (`bsv.min.js` ~937KB → ~1.1MB; it grew
465
+ in 5.0.0 then shrank again in 5.4.0 once `elliptic` was dropped from the
466
+ bundles). The dedicated single-feature module bundles are unaffected.
462
467
 
463
468
  Full details in the [CHANGELOG](./CHANGELOG.md#500---2026-06-13).
464
469
 
@@ -486,21 +491,21 @@ const contractTx = covenant.createCovenantTransaction({
486
491
 
487
492
  ### Browser CDN (Choose Your Loading Strategy)
488
493
 
489
- #### 1. **Minimal Setup** - Core + Script Helper (~1.3MB)
494
+ #### 1. **Minimal Setup** - Core + Script Helper (~1.2MB)
490
495
  ```html
491
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
492
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-script-helper.min.js"></script>
496
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js"></script>
497
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-script-helper.min.js"></script>
493
498
  <script>
494
499
  const tx = new bsv.Transaction();
495
500
  const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
496
501
  </script>
497
502
  ```
498
503
 
499
- #### 2. **DeFi Development** - Core + Covenants + Debug (~3.0MB — each bundle re-embeds core BSV)
504
+ #### 2. **DeFi Development** - Core + Covenants + Debug (~2.8MB — each bundle re-embeds core BSV)
500
505
  ```html
501
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
502
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-covenant.min.js"></script>
503
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-smartcontract.min.js"></script>
506
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js"></script>
507
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-covenant.min.js"></script>
508
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-smartcontract.min.js"></script>
504
509
  <script>
505
510
  const covenant = new bsvCovenant.CovenantInterface();
506
511
  const debugInfo = SmartContract.interpretScript(script);
@@ -508,19 +513,19 @@ const contractTx = covenant.createCovenantTransaction({
508
513
  </script>
509
514
  ```
510
515
 
511
- #### 3. **Security First** - Core + Enhanced Security (~1.3MB)
516
+ #### 3. **Security First** - Core + Enhanced Security (~1.2MB)
512
517
  ```html
513
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
514
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-security.min.js"></script>
518
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.min.js"></script>
519
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv-security.min.js"></script>
515
520
  <script>
516
521
  const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
517
522
  const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
518
523
  </script>
519
524
  ```
520
525
 
521
- #### 4. **Everything Bundle** - One File Solution (~1.3MB)
526
+ #### 4. **Everything Bundle** - One File Solution (~1.1MB)
522
527
  ```html
523
- <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.bundle.js"></script>
528
+ <script src="https://unpkg.com/@smartledger/bsv@5.4.0/bsv.bundle.js"></script>
524
529
  <script>
525
530
  // Everything available under bsv namespace
526
531
  const keys = bsv.SmartLedgerBundle.generateKeys();
@@ -809,7 +814,7 @@ const timelockScript = helper.createTimelockScript(
809
814
 
810
815
  See the **[16 Loading Options](#-16-loading-options---choose-your-approach)**
811
816
  table near the top for the full list of bundles with current sizes and
812
- canonical `unpkg.com/@smartledger/bsv@5.3.1/...` URLs.
817
+ canonical `unpkg.com/@smartledger/bsv@5.4.0/...` URLs.
813
818
 
814
819
  ## 🔐 Security
815
820