@smartledger/bsv 7.13.0 → 8.0.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +38 -38
  3. package/bsv-gdaf.min.js +55 -55
  4. package/bsv-ltp.min.js +39 -39
  5. package/bsv-smartcontract.min.js +1 -1
  6. package/bsv.bundle.js +55 -55
  7. package/bsv.min.js +55 -55
  8. package/docs/AUDIT_SCOPE.md +21 -12
  9. package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
  10. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  11. package/docs/getting-started/INSTALLATION.md +23 -23
  12. package/docs/getting-started/QUICK_START.md +7 -7
  13. package/docs/migration/FROM_BSV_1_5_6.md +5 -5
  14. package/lib/crypto/bn.js +22 -2
  15. package/lib/script/interpreter.js +399 -56
  16. package/lib/transaction/sighash.js +18 -6
  17. package/package.json +4 -1
  18. package/test/consensus/base58-vectors.js +120 -0
  19. package/test/consensus/sv-script-vectors.js +81 -0
  20. package/test/consensus/sv-sighash-vectors.js +51 -0
  21. package/test/consensus/sv-tx-vectors.js +48 -0
  22. package/test/data/bitcoin-sv/README.md +170 -0
  23. package/test/data/bitcoin-sv/base58_encode_decode.json +14 -0
  24. package/test/data/bitcoin-sv/base58_keys_invalid.json +152 -0
  25. package/test/data/bitcoin-sv/base58_keys_valid.json +452 -0
  26. package/test/data/bitcoin-sv/script_tests.json +2591 -0
  27. package/test/data/bitcoin-sv/sighash.json +1003 -0
  28. package/test/data/bitcoin-sv/tx_invalid.json +285 -0
  29. package/test/data/bitcoin-sv/tx_valid.json +367 -0
  30. package/test/regressions.js +35 -0
  31. package/test/script/chronicle.js +170 -25
  32. package/test/script/defaults.js +93 -0
  33. package/test/script/genesis_limits.js +62 -6
  34. package/test/script/interpreter.js +24 -8
  35. package/test/transaction/sighash.js +21 -1
  36. package/version.js +1 -1
@@ -5,7 +5,7 @@ cryptographic core, and carries the enquiry text to send to vendors. It exists s
5
5
  every vendor prices the *same* thing, and so that the reasoning behind the scope
6
6
  boundary survives past the engagement that prompted it.
7
7
 
8
- Measured against **v7.13.0**, 2026-08-11. Re-measure before sending if the version has
8
+ Measured against **v8.0.0**, 2026-08-13. Re-measure before sending if the version has
9
9
  moved (`docs/AUDIT_SCOPE.md` is not covered by a drift gate).
10
10
 
11
11
  ## 1. The question we are asking
@@ -29,13 +29,13 @@ testing.
29
29
  Two tiers, to be **priced separately** so the boundary can be drawn against a number
30
30
  rather than before seeing one.
31
31
 
32
- ### Tier 1 — core, 11,879 lines across 33 files
32
+ ### Tier 1 — core, 12,254 lines across 33 files
33
33
 
34
34
  | Module | Lines | Why it matters |
35
35
  | --- | ---: | --- |
36
- | `lib/script/` | 3,394 | Consensus script interpreter. Divergence from the node means accepting a transaction the network rejects, or the reverse. |
37
- | `lib/transaction/` | 2,767 | Sighash construction and signing — both BIP-143 and the Original Transaction Digest Algorithm. |
38
- | `lib/crypto/` | 2,499 | ECDSA, nonce derivation, signature encoding, the script-number type. |
36
+ | `lib/script/` | 3,737 | Consensus script interpreter. Divergence from the node means accepting a transaction the network rejects, or the reverse. |
37
+ | `lib/transaction/` | 2,779 | Sighash construction and signing — both BIP-143 and the Original Transaction Digest Algorithm. |
38
+ | `lib/crypto/` | 2,519 | ECDSA, nonce derivation, signature encoding, the script-number type. |
39
39
  | `lib/hdprivatekey.js`, `lib/hdpublickey.js` | 1,168 | BIP-32 derivation, including hardened paths. |
40
40
  | `lib/privatekey.js`, `lib/publickey.js` | 843 | Key construction, serialisation, WIF. Recent defects here produced a *different* key without error. |
41
41
  | `lib/address.js` | 543 | Address derivation and network binding. |
@@ -60,17 +60,17 @@ is not.
60
60
  | `@noble/curves`, `@noble/hashes`, `@noble/ciphers` | Already audited | The primitives come from the Noble libraries, which **Cure53 has audited and published on**. We do not implement curve or hash arithmetic ourselves. State this explicitly to vendors — otherwise they price work we do not need. |
61
61
  | `lib/smart_contract/`, `lib/ltp/`, `lib/gdaf/`, `lib/ordinals/`, `lib/block/`, plus 9 further directories and 6 top-level files | Excluded | Application layer, 22,815 lines — 18,435 in the five named modules and 4,380 in the remainder. Written in-house and covered by adversarial tests. Worth a separate engagement; including it here would blur the question in §1. |
62
62
 
63
- Totals reconcile against `lib/`, which is 36,301 lines across 123 files:
63
+ Totals reconcile against `lib/`, which is 36,676 lines across 123 files:
64
64
 
65
65
  ```
66
- tier 1 11,879
66
+ tier 1 12,254
67
67
  tier 2 1,607
68
68
  excluded 22,815
69
69
  ------
70
- total 36,301
70
+ total 36,676
71
71
  ```
72
72
 
73
- Core + optional = 13,486.
73
+ Core + optional = 13,861.
74
74
 
75
75
  ## 4. What an auditor gets on day one
76
76
 
@@ -82,10 +82,19 @@ Each of these should *reduce* the quote — they remove discovery work.
82
82
  longer exist. Scope that honestly: the gate asserts existence and a minimum citation
83
83
  count, not that the cited tests still assert anything — a test gutted in place would
84
84
  pass it.
85
+ - **The reference node's own consensus vectors**, copied verbatim from
86
+ `bitcoin-sv/bitcoin-sv` v1.2.0 with provenance in `test/data/bitcoin-sv/README.md`, and
87
+ run as gates: 1483/1483 script vectors with zero false accepts and zero false rejects,
88
+ 600/600 result codes, 161/161 transaction vectors, 1000/1000 digest vectors on both
89
+ routing columns. This is the single most useful thing here, and it did not exist before
90
+ v8.0.0 — the first run scored 1426/1483 with **21 false accepts**. An auditor can treat
91
+ consensus conformance as measured and spend the engagement on what the vectors cannot
92
+ reach: key handling, nonce generation, encoding, and the composition above the
93
+ interpreter.
85
94
  - **`npm run conformance`** — 452 cases across 13 suites, freezing observable behaviour
86
95
  so any change surfaces as a diff. A second, independently written implementation
87
96
  (`smartledger-bsv-core`, the TypeScript port) agrees on all 452.
88
- - **4,647 passing tests**, plus a reproducible-bundle gate, a require-cycle gate, and a
97
+ - **4,461 passing tests**, plus a reproducible-bundle gate, a require-cycle gate, and a
89
98
  type-drift gate that parses the published types against the runtime.
90
99
  - **`SECURITY.md`** — a published advisory (GHSA-gw63-x79h-mhjc) and a changelog of
91
100
  security fixes with the reasoning for each.
@@ -124,7 +133,7 @@ seeking a quote for an independent security review of its cryptographic core.
124
133
 
125
134
  Scope, and we would like these priced separately:
126
135
 
127
- Tier 1 — 11,879 lines, 33 files. Script interpreter, sighash and signing,
136
+ Tier 1 — 12,254 lines, 33 files. Script interpreter, sighash and signing,
128
137
  ECDSA and signature encoding, BIP-32 derivation, key and address
129
138
  construction.
130
139
 
@@ -162,7 +171,7 @@ SmartLedger Technology
162
171
  Every figure in this document, including the excluded total, must come out of this
163
172
  script. **Derive the excluded count as the complement — never by subtracting tier 1
164
173
  alone.** The first draft did exactly that, double-counted tier 2, and published parts
165
- summing to 37,430 against a 36,301 whole; §7 could not catch it because it reproduced
174
+ summing to 37,430 against a 36,676 whole; §7 could not catch it because it reproduced
166
175
  every figure except the wrong one.
167
176
 
168
177
  ```sh
@@ -55,19 +55,19 @@ Three advanced modules totaling **~2.7MB** of functionality:
55
55
  - **Purpose**: Threshold cryptography for secure secret distribution
56
56
  - **Use Cases**: Backup keys, multi-party security, key recovery
57
57
  - **Features**: Split secrets into N shares, require M to reconstruct
58
- - **CDN**: `unpkg.com/@smartledger/bsv@7.13.0/bsv-shamir.min.js`
58
+ - **CDN**: `unpkg.com/@smartledger/bsv@8.0.0/bsv-shamir.min.js`
59
59
 
60
60
  #### **🌐 Global Digital Attestation Framework - GDAF (1184KB)**
61
61
  - **Purpose**: W3C Verifiable Credentials and decentralized identity
62
62
  - **Use Cases**: Identity verification, attestations, zero-knowledge proofs
63
63
  - **Features**: DID creation, credential issuance, selective disclosure
64
- - **CDN**: `unpkg.com/@smartledger/bsv@7.13.0/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@8.0.0/bsv-gdaf.min.js`
65
65
 
66
66
  #### **⚖️ Legal Token Protocol - LTP (1184KB)**
67
67
  - **Purpose**: Legal compliance framework for tokenized assets
68
68
  - **Use Cases**: Property rights, obligations, compliant tokenization
69
69
  - **Features**: Legal primitives, compliance checking, attestation anchoring
70
- - **CDN**: `unpkg.com/@smartledger/bsv@7.13.0/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@8.0.0/bsv-ltp.min.js`
71
71
 
72
72
  ### **2. Incorrect File Sizes in Documentation**
73
73
 
@@ -81,18 +81,18 @@ Three advanced modules totaling **~2.7MB** of functionality:
81
81
 
82
82
  | Module | Size | Use Case | CDN Link |
83
83
  |--------|------|----------|----------|
84
- | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js` |
85
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.13.0/bsv.bundle.js` |
86
- | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.13.0/bsv-smartcontract.min.js` |
87
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.13.0/bsv-covenant.min.js` |
88
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.13.0/bsv-script-helper.min.js` |
89
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.13.0/bsv-security.min.js` |
90
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.13.0/bsv-ecies.min.js` |
91
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.13.0/bsv-message.min.js` |
92
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.13.0/bsv-mnemonic.min.js` |
93
- | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.13.0/bsv-shamir.min.js` |
94
- | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.13.0/bsv-gdaf.min.js` |
95
- | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.13.0/bsv-ltp.min.js` |
84
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@8.0.0/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@8.0.0/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@8.0.0/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@8.0.0/bsv-script-helper.min.js` |
89
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@8.0.0/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@8.0.0/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@8.0.0/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@8.0.0/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@8.0.0/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@8.0.0/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@8.0.0/bsv-ltp.min.js` |
96
96
 
97
97
  ## 🎯 **Updated Usage Examples**
98
98
 
@@ -100,22 +100,22 @@ Three advanced modules totaling **~2.7MB** of functionality:
100
100
 
101
101
  #### **1. Basic Development (~963KB)**
102
102
  ```html
103
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
104
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-script-helper.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-script-helper.min.js"></script>
105
105
  ```
106
106
 
107
107
  #### **2. Smart Contract Development (~2.7MB — each bundle re-embeds core BSV)**
108
108
  ```html
109
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
110
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-covenant.min.js"></script>
111
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-smartcontract.min.js"></script>
109
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-smartcontract.min.js"></script>
112
112
  ```
113
113
 
114
114
  #### **3. 🆕 Legal & Compliance Development (~3.2MB — each bundle re-embeds core BSV)**
115
115
  ```html
116
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
117
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-ltp.min.js"></script>
118
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-gdaf.min.js"></script>
116
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-gdaf.min.js"></script>
119
119
  <script>
120
120
  // Legal Token Protocol
121
121
  const legalToken = bsv.createLegalToken({
@@ -132,9 +132,9 @@ Three advanced modules totaling **~2.7MB** of functionality:
132
132
 
133
133
  #### **4. 🆕 Security & Cryptography (~1.4MB)**
134
134
  ```html
135
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
136
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-security.min.js"></script>
137
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-shamir.min.js"></script>
135
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-shamir.min.js"></script>
138
138
  <script>
139
139
  // Shamir Secret Sharing
140
140
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -146,7 +146,7 @@ Three advanced modules totaling **~2.7MB** of functionality:
146
146
 
147
147
  #### **5. Everything Bundle (937KB)**
148
148
  ```html
149
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.bundle.js"></script>
150
150
  <script>
151
151
  // Everything available immediately
152
152
  const shares = bsv.splitSecret('secret', 5, 3);
@@ -722,7 +722,7 @@ interface UTXO {
722
722
  <html>
723
723
  <head>
724
724
  <title>UTXO Manager Demo</title>
725
- <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.13.0/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@8.0.0/bsv.min.js"></script>
726
726
  </head>
727
727
  <body>
728
728
  <script>
@@ -48,7 +48,7 @@ const tx: Transaction = new Transaction();
48
48
  #### **Core Library Only (937KB)**
49
49
  For basic Bitcoin SV operations:
50
50
  ```html
51
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
51
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
52
52
  <script>
53
53
  const privateKey = new bsv.PrivateKey();
54
54
  const address = privateKey.toAddress();
@@ -58,7 +58,7 @@ For basic Bitcoin SV operations:
58
58
  #### **Complete Bundle (937KB)**
59
59
  Everything in one file:
60
60
  ```html
61
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.bundle.js"></script>
62
62
  <script>
63
63
  // All features available immediately
64
64
  const shares = bsv.splitSecret('secret', 5, 3);
@@ -71,9 +71,9 @@ Everything in one file:
71
71
 
72
72
  #### **Smart Contract Development (~2.7MB total — each bundle is self-contained and re-embeds core BSV)**
73
73
  ```html
74
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
75
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-covenant.min.js"></script>
76
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-smartcontract.min.js"></script>
74
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-smartcontract.min.js"></script>
77
77
  <script>
78
78
  const covenant = bsv.SmartContract.createCovenantBuilder()
79
79
  .extractField('amount').push(50000).greaterThanOrEqual().build();
@@ -82,9 +82,9 @@ Everything in one file:
82
82
 
83
83
  #### **Legal & Identity Development (~3.2MB total — each bundle is self-contained and re-embeds core BSV)**
84
84
  ```html
85
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
86
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-ltp.min.js"></script>
87
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-gdaf.min.js"></script>
85
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-gdaf.min.js"></script>
88
88
  <script>
89
89
  // Legal Token Protocol
90
90
  const propertyToken = bsv.createPropertyToken({
@@ -98,9 +98,9 @@ Everything in one file:
98
98
 
99
99
  #### **Security & Cryptography (~1.4MB total — each bundle is self-contained and re-embeds core BSV)**
100
100
  ```html
101
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
102
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-security.min.js"></script>
103
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-shamir.min.js"></script>
101
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-shamir.min.js"></script>
104
104
  <script>
105
105
  // Threshold Cryptography
106
106
  const shares = bsv.splitSecret('my_secret_key', 5, 3);
@@ -114,18 +114,18 @@ Everything in one file:
114
114
 
115
115
  | Module | Size | Purpose | CDN Link |
116
116
  |--------|------|---------|----------|
117
- | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js` |
118
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.13.0/bsv.bundle.js` |
119
- | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.13.0/bsv-smartcontract.min.js` |
120
- | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.13.0/bsv-ltp.min.js` |
121
- | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.13.0/bsv-gdaf.min.js` |
122
- | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.13.0/bsv-shamir.min.js` |
123
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.13.0/bsv-security.min.js` |
124
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.13.0/bsv-mnemonic.min.js` |
125
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.13.0/bsv-ecies.min.js` |
126
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.13.0/bsv-covenant.min.js` |
127
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.13.0/bsv-script-helper.min.js` |
128
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.13.0/bsv-message.min.js` |
117
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@8.0.0/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@8.0.0/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@8.0.0/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@8.0.0/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@8.0.0/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@8.0.0/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@8.0.0/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@8.0.0/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@8.0.0/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@8.0.0/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@8.0.0/bsv-message.min.js` |
129
129
 
130
130
  ## ⚙️ **Development Environment Setup**
131
131
 
@@ -14,10 +14,10 @@ npm install @smartledger/bsv
14
14
  ### Browser CDN (Instant)
15
15
  ```html
16
16
  <!-- Core library (937KB) -->
17
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
17
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
18
18
 
19
19
  <!-- Everything included (937KB) -->
20
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.bundle.js"></script>
20
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.bundle.js"></script>
21
21
  ```
22
22
 
23
23
  ## 💰 **Your First Transaction (60 seconds)**
@@ -127,19 +127,19 @@ SmartLedger-BSV offers 12 different loading options - use only what you need:
127
127
 
128
128
  ```html
129
129
  <!-- Core BSV only (937KB) -->
130
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
130
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
131
131
 
132
132
  <!-- Smart contracts (937KB) -->
133
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-smartcontract.min.js"></script>
133
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-smartcontract.min.js"></script>
134
134
 
135
135
  <!-- Legal tokens (1.16MB) -->
136
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-ltp.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-ltp.min.js"></script>
137
137
 
138
138
  <!-- Digital identity (1.16MB) -->
139
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-gdaf.min.js"></script>
139
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-gdaf.min.js"></script>
140
140
 
141
141
  <!-- Everything (937KB) -->
142
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.bundle.js"></script>
142
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.bundle.js"></script>
143
143
  ```
144
144
 
145
145
  ## ⚡ **Key Advantages**
@@ -159,17 +159,17 @@ const recovered = bsv.reconstructSecret([shares[0], shares[2], shares[4]]);
159
159
  ### **New Modular Options**
160
160
  ```html
161
161
  <!-- Core compatibility (same size as bsv@1.5.6) -->
162
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.min.js"></script>
162
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.min.js"></script>
163
163
 
164
164
  <!-- Add smart contracts when ready -->
165
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-smartcontract.min.js"></script>
165
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-smartcontract.min.js"></script>
166
166
 
167
167
  <!-- Add advanced features as needed -->
168
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-ltp.min.js"></script>
169
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv-gdaf.min.js"></script>
168
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-ltp.min.js"></script>
169
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv-gdaf.min.js"></script>
170
170
 
171
171
  <!-- Everything in one file -->
172
- <script src="https://unpkg.com/@smartledger/bsv@7.13.0/bsv.bundle.js"></script>
172
+ <script src="https://unpkg.com/@smartledger/bsv@8.0.0/bsv.bundle.js"></script>
173
173
  ```
174
174
 
175
175
  ## 🔍 **Testing Your Migration**
package/lib/crypto/bn.js CHANGED
@@ -174,6 +174,23 @@ BN.prototype.toSM = function (opts) {
174
174
  return buf
175
175
  }
176
176
 
177
+ /**
178
+ * An error carrying the node's own result code for the failure.
179
+ *
180
+ * Script number decoding fails for two consensus reasons, and both are named
181
+ * in the node's script vectors — SCRIPT_ERR_SCRIPTNUM_OVERFLOW and
182
+ * SCRIPT_ERR_SCRIPTNUM_MINENCODE. This layer knows which one it hit, and the
183
+ * interpreter's evaluator is where that has to be reported, so the code
184
+ * travels on the error rather than being guessed from its message. An error
185
+ * without a `scriptErr` really is unknown to the interpreter and is still
186
+ * reported as such.
187
+ */
188
+ function scriptNumError (message, scriptErr) {
189
+ var err = new Error(message)
190
+ err.scriptErr = scriptErr
191
+ return err
192
+ }
193
+
177
194
  /**
178
195
  * Create a BN from a "ScriptNum": This is analogous to the constructor for
179
196
  * CScriptNum in bitcoind. Many ops in bitcoind's script interpreter use
@@ -188,7 +205,9 @@ BN.prototype.toSM = function (opts) {
188
205
  */
189
206
  BN.fromScriptNumBuffer = function (buf, fRequireMinimal, size) {
190
207
  var nMaxNumSize = size || 4
191
- $.checkArgument(buf.length <= nMaxNumSize, new Error('script number overflow'))
208
+ if (buf.length > nMaxNumSize) {
209
+ throw scriptNumError('script number overflow', 'SCRIPT_ERR_SCRIPTNUM_OVERFLOW')
210
+ }
192
211
  if (fRequireMinimal && buf.length > 0) {
193
212
  // Check that the number is encoded with the minimum possible
194
213
  // number of bytes.
@@ -203,7 +222,8 @@ BN.fromScriptNumBuffer = function (buf, fRequireMinimal, size) {
203
222
  // is +-255, which encode to 0xff00 and 0xff80 respectively.
204
223
  // (big-endian).
205
224
  if (buf.length <= 1 || (buf[buf.length - 2] & 0x80) === 0) {
206
- throw new Error('non-minimally encoded script number')
225
+ throw scriptNumError('non-minimally encoded script number',
226
+ 'SCRIPT_ERR_SCRIPTNUM_MINENCODE')
207
227
  }
208
228
  }
209
229
  }