@smartledger/bsv 5.2.0 → 5.3.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,55 @@ 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.3.0] - 2026-06-15
9
+
10
+ Completes the migration of **all** of bsv's secp256k1 cryptography to the
11
+ audited `@noble` suite and removes the `elliptic` dependency. No change to the
12
+ documented public API or to signatures/keys/addresses (byte-identical).
13
+
14
+ ### Changed
15
+
16
+ - **EC point math migrated from `elliptic` to the audited `@noble/curves`.**
17
+ `lib/crypto/point.js` — the single seam all secp256k1 point operations flow
18
+ through — is now backed by `@noble/curves`, so the entire signing/keys stack
19
+ (`ECDSA` sign/verify/recovery, public-key derivation, HD keys, message
20
+ signing) runs on audited, constant-time curve code. The `Point` API
21
+ (`mul`/`add`/`mulAdd`/`getX`/`getY`/`.x`/`.y`/`eq`/`isInfinity`/`validate` and
22
+ the `getG`/`getN`/`fromX`/`fromBuffer` statics) is unchanged, so `ecdsa.js`
23
+ and all consumers are untouched.
24
+ - **No API or behavioral change.** Verified by the full existing test suite
25
+ (4241 tests — ECDSA known-answer vectors, address/HD-key/transaction/message
26
+ vectors all pass unchanged), so signatures, keys and addresses are
27
+ byte-identical to prior versions. Scalar multiplication uses @noble's
28
+ *constant-time* `multiply` (important for the secret signing nonce).
29
+ - **`lib/crypto/elliptic-fixed.js` (`bsv.EllipticFixed`) migrated to
30
+ `@noble/curves`.** Its hardened sign/verify/recover surface
31
+ (`keyFromPrivate`, `sign` → `{r, s, recoveryParam}`, `verify`,
32
+ `recoverPubKey`, `curve.n`) is unchanged and still produces low-S canonical
33
+ signatures with a consistent `recoveryParam`. `bsv.SmartVerify` already ran on
34
+ `@noble` (via `Point`/`ECDSA`).
35
+ - **`elliptic` removed as a dependency.** With both `point.js` and
36
+ `elliptic-fixed.js` on `@noble`, no source code imports `elliptic` anymore and
37
+ it has been removed from `package.json`. **All of bsv's secp256k1
38
+ cryptography now runs on the audited `@noble` suite.** `bn.js` remains (it is
39
+ the codebase's general-purpose bignum, used well beyond crypto).
40
+
41
+ ### Removed
42
+
43
+ - **`bsv.deps.elliptic`** is no longer exposed (the `elliptic` passthrough on the
44
+ internal `deps` object). The documented public API (`bsv.PrivateKey`,
45
+ `bsv.Transaction`, `bsv.crypto.*`, …) is unaffected; only code reaching into
46
+ `bsv.deps.elliptic` directly is impacted.
47
+
48
+ ### Notes
49
+
50
+ - The standalone module bundles that don't embed the browser `crypto` polyfill
51
+ shrink (e.g. `bsv-smartcontract.min.js` / `bsv-covenant.min.js` ~939KB →
52
+ ~873KB). The full bundles are unchanged for now: they still pull `elliptic`
53
+ transitively through `crypto-browserify` (the browser CSPRNG polyfill, a
54
+ devDependency) for `createSign`/`createECDH` — APIs bsv never calls. Trimming
55
+ that from the browser build (so the full bundles shrink too) is a follow-up.
56
+
8
57
  ## [5.2.0] - 2026-06-15
9
58
 
10
59
  First migration of bsv's cryptography to the audited `@noble` suite (ECIES).
package/README.md CHANGED
@@ -72,7 +72,7 @@ const ok = SC.verifyScript(unlockScript, lockingScript, tx, inputIndex, satoshis
72
72
 
73
73
  ```bash
74
74
  # Install SmartLedger BSV v5.0.0
75
- npm install @smartledger/bsv@5.2.0
75
+ npm install @smartledger/bsv@5.3.0
76
76
 
77
77
  # Initialize DID:web issuer (generates ES256 keys)
78
78
  npx smartledger-bsv didweb init --domain example.com --alg ES256
@@ -181,42 +181,42 @@ console.log('Status:', status) // 'revoked'
181
181
  ### **Core Modules**
182
182
  | Module | Size | Use Case | CDN |
183
183
  |--------|------|----------|-----|
184
- | **bsv.min.js** | 1270KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js` |
185
- | **bsv.bundle.js** | 1270KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.2.0/bsv.bundle.js` |
184
+ | **bsv.min.js** | 1271KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js` |
185
+ | **bsv.bundle.js** | 1271KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.3.0/bsv.bundle.js` |
186
186
 
187
187
  ### **W3C Verifiable Credentials**
188
188
  | Module | Size | Use Case | CDN |
189
189
  |--------|------|----------|-----|
190
- | **🟢 bsv-didweb.min.js** | 453KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@5.2.0/bsv-didweb.min.js` |
191
- | **🟢 bsv-vcjwt.min.js** | 454KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.2.0/bsv-vcjwt.min.js` |
192
- | **🟢 bsv-statuslist.min.js** | 553KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.2.0/bsv-statuslist.min.js` |
193
- | **🟢 bsv-anchor.min.js** | 452KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.2.0/bsv-anchor.min.js` |
190
+ | **🟢 bsv-didweb.min.js** | 453KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@5.3.0/bsv-didweb.min.js` |
191
+ | **🟢 bsv-vcjwt.min.js** | 454KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.3.0/bsv-vcjwt.min.js` |
192
+ | **🟢 bsv-statuslist.min.js** | 553KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.3.0/bsv-statuslist.min.js` |
193
+ | **🟢 bsv-anchor.min.js** | 452KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.3.0/bsv-anchor.min.js` |
194
194
 
195
195
  ### **Smart Contract & Development**
196
196
  | Module | Size | Use Case | CDN |
197
197
  |--------|------|----------|-----|
198
- | **bsv-smartcontract.min.js** | 943KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@5.2.0/bsv-smartcontract.min.js` |
199
- | **bsv-covenant.min.js** | 943KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.2.0/bsv-covenant.min.js` |
200
- | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.2.0/bsv-script-helper.min.js` |
201
- | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.2.0/bsv-security.min.js` |
198
+ | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@5.3.0/bsv-smartcontract.min.js` |
199
+ | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.3.0/bsv-covenant.min.js` |
200
+ | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.3.0/bsv-script-helper.min.js` |
201
+ | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.3.0/bsv-security.min.js` |
202
202
 
203
203
  ### **Legal & Compliance**
204
204
  | Module | Size | Use Case | CDN |
205
205
  |--------|------|----------|-----|
206
- | **bsv-ltp.min.js** | 1270KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@5.2.0/bsv-ltp.min.js` |
207
- | **bsv-gdaf.min.js** | 1270KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.2.0/bsv-gdaf.min.js` |
206
+ | **bsv-ltp.min.js** | 1271KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@5.3.0/bsv-ltp.min.js` |
207
+ | **bsv-gdaf.min.js** | 1271KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.3.0/bsv-gdaf.min.js` |
208
208
 
209
209
  ### **Advanced Cryptography**
210
210
  | Module | Size | Use Case | CDN |
211
211
  |--------|------|----------|-----|
212
- | **bsv-shamir.min.js** | 476KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@5.2.0/bsv-shamir.min.js` |
212
+ | **bsv-shamir.min.js** | 476KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@5.3.0/bsv-shamir.min.js` |
213
213
 
214
214
  ### **Utilities**
215
215
  | Module | Size | Use Case | CDN |
216
216
  |--------|------|----------|-----|
217
- | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@5.2.0/bsv-ecies.min.js` |
218
- | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@5.2.0/bsv-message.min.js` |
219
- | **bsv-mnemonic.min.js** | 715KB | HD wallets | `unpkg.com/@smartledger/bsv@5.2.0/bsv-mnemonic.min.js` |
217
+ | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@5.3.0/bsv-ecies.min.js` |
218
+ | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@5.3.0/bsv-message.min.js` |
219
+ | **bsv-mnemonic.min.js** | 715KB | HD wallets | `unpkg.com/@smartledger/bsv@5.3.0/bsv-mnemonic.min.js` |
220
220
 
221
221
  ## ⚡ **2-Minute Quick Start**
222
222
 
@@ -227,7 +227,7 @@ Get started with Bitcoin SV development in under 2 minutes:
227
227
  npm install @smartledger/bsv
228
228
 
229
229
  # Or include in HTML
230
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js"></script>
230
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
231
231
  ```
232
232
 
233
233
  > **🔒 v5.0.0 (production hardening — has breaking changes):** Shamir secret
@@ -327,19 +327,19 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
327
327
 
328
328
  ### 🔧 **Basic Development** (~1.3MB total)
329
329
  ```html
330
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js"></script>
331
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-script-helper.min.js"></script>
330
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
331
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-script-helper.min.js"></script>
332
332
  <script>
333
333
  const privateKey = new bsv.PrivateKey();
334
334
  const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
335
335
  </script>
336
336
  ```
337
337
 
338
- ### 🔒 **Smart Contract Development** (~3.1MB total — each bundle re-embeds core BSV)
338
+ ### 🔒 **Smart Contract Development** (~3.0MB total — each bundle re-embeds core BSV)
339
339
  ```html
340
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js"></script>
341
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-covenant.min.js"></script>
342
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-smartcontract.min.js"></script>
340
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
341
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-covenant.min.js"></script>
342
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-smartcontract.min.js"></script>
343
343
  <script>
344
344
  const covenant = bsv.SmartContract.createCovenantBuilder()
345
345
  .extractField('amount').push(50000).greaterThanOrEqual().verify().build();
@@ -349,9 +349,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
349
349
 
350
350
  ### 🆕 **Legal & Identity Development** (~3.7MB total — each bundle re-embeds core BSV)
351
351
  ```html
352
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js"></script>
353
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-ltp.min.js"></script>
354
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-gdaf.min.js"></script>
352
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
353
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-ltp.min.js"></script>
354
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-gdaf.min.js"></script>
355
355
  <script>
356
356
  // Legal Token Protocol
357
357
  const propertyToken = bsv.createPropertyToken({
@@ -365,9 +365,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
365
365
 
366
366
  ### 🆕 **Security & Cryptography** (~1.7MB total)
367
367
  ```html
368
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js"></script>
369
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-security.min.js"></script>
370
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-shamir.min.js"></script>
368
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
369
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-security.min.js"></script>
370
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-shamir.min.js"></script>
371
371
  <script>
372
372
  // Threshold Cryptography
373
373
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -379,7 +379,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
379
379
 
380
380
  ### 🎯 **Everything Bundle** (~1.3MB)
381
381
  ```html
382
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.bundle.js"></script>
382
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.bundle.js"></script>
383
383
  <script>
384
384
  // Everything available immediately
385
385
  const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
@@ -412,7 +412,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
412
412
  - � **PUSHTX Integration**: nChain techniques for advanced covenant patterns → [PUSHTX Insights](docs/pushtx-key-insights.md)
413
413
 
414
414
  ### 📦 **Flexible Architecture**
415
- - 📦 **16 Modular Options**: Load only what you need (30KB to 1270KB) → [Loading Strategy](#-16-loading-options---choose-your-approach)
415
+ - 📦 **16 Modular Options**: Load only what you need (30KB to 1271KB) → [Loading Strategy](#-16-loading-options---choose-your-approach)
416
416
  - 📦 **Standalone Modules**: Independent legal, identity, and crypto modules → [Standalone Test](https://github.com/codenlighten/smartledger-bsv/blob/main/tests/standalone-modules-test.html)
417
417
  - 📦 **Complete Bundle**: Everything in one file for convenience → [Bundle Demo](https://github.com/codenlighten/smartledger-bsv/blob/main/tests/bundle-demo.html)
418
418
  - 📦 **CDN Ready**: All modules available via unpkg and jsDelivr
@@ -488,19 +488,19 @@ const contractTx = covenant.createCovenantTransaction({
488
488
 
489
489
  #### 1. **Minimal Setup** - Core + Script Helper (~1.3MB)
490
490
  ```html
491
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js"></script>
492
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-script-helper.min.js"></script>
491
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
492
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-script-helper.min.js"></script>
493
493
  <script>
494
494
  const tx = new bsv.Transaction();
495
495
  const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
496
496
  </script>
497
497
  ```
498
498
 
499
- #### 2. **DeFi Development** - Core + Covenants + Debug (~3.1MB — each bundle re-embeds core BSV)
499
+ #### 2. **DeFi Development** - Core + Covenants + Debug (~3.0MB — each bundle re-embeds core BSV)
500
500
  ```html
501
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js"></script>
502
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-covenant.min.js"></script>
503
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-smartcontract.min.js"></script>
501
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
502
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-covenant.min.js"></script>
503
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-smartcontract.min.js"></script>
504
504
  <script>
505
505
  const covenant = new bsvCovenant.CovenantInterface();
506
506
  const debugInfo = SmartContract.interpretScript(script);
@@ -510,8 +510,8 @@ const contractTx = covenant.createCovenantTransaction({
510
510
 
511
511
  #### 3. **Security First** - Core + Enhanced Security (~1.3MB)
512
512
  ```html
513
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.min.js"></script>
514
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv-security.min.js"></script>
513
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
514
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-security.min.js"></script>
515
515
  <script>
516
516
  const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
517
517
  const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
@@ -520,7 +520,7 @@ const contractTx = covenant.createCovenantTransaction({
520
520
 
521
521
  #### 4. **Everything Bundle** - One File Solution (~1.3MB)
522
522
  ```html
523
- <script src="https://unpkg.com/@smartledger/bsv@5.2.0/bsv.bundle.js"></script>
523
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.bundle.js"></script>
524
524
  <script>
525
525
  // Everything available under bsv namespace
526
526
  const keys = bsv.SmartLedgerBundle.generateKeys();
@@ -809,7 +809,7 @@ const timelockScript = helper.createTimelockScript(
809
809
 
810
810
  See the **[16 Loading Options](#-16-loading-options---choose-your-approach)**
811
811
  table near the top for the full list of bundles with current sizes and
812
- canonical `unpkg.com/@smartledger/bsv@5.2.0/...` URLs.
812
+ canonical `unpkg.com/@smartledger/bsv@5.3.0/...` URLs.
813
813
 
814
814
  ## 🔐 Security
815
815