@smartledger/bsv 9.10.1 → 9.11.1

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
@@ -7,6 +7,77 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [9.11.1] - 2026-09-17
11
+
12
+ **A patch: a script written as ASM or as a string reads back as the same script.** No API change.
13
+
14
+ ### Fixed — a script written as text reads back as the same script
15
+
16
+ An opcode with no name — `0xba` to `0xfc`, 67 of them — did not survive being written out:
17
+
18
+ | | 9.11.0 | now |
19
+ | --- | --- | --- |
20
+ | `toASM()` of `51ba` | `OP_1 ba`, which `fromASM` reads as a one-byte push: `5101ba` | `OP_1 0xba`, read back as `51ba` |
21
+ | `toString()` of `51ba` | `OP_1 0xba`, which `fromString` rejects | unchanged, and read back as `51ba` |
22
+
23
+ ASM wrote the byte as bare hex, which is also how it writes a one-byte data push, so the two
24
+ were indistinguishable and a script written to ASM and read back was a different script. Both
25
+ forms now write the raw byte as `0xba`, as bitcoind's script test format does, and both read
26
+ it back, in either case. The opcodes are not given names: `Opcode.map` invents none above
27
+ `OP_NOP10`, and a name such as `OP_NOP11` would suggest a no-op where the node fails the
28
+ script. They still execute as `SCRIPT_ERR_BAD_OPCODE`.
29
+
30
+ `Script.fromASM('')` now returns an empty script. It returned `OP_0`, so an empty script
31
+ written with `toASM()` read back as a different one.
32
+
33
+ Only these outputs change: every other script writes the same ASM and the same string as in
34
+ 9.11.0, and every text 9.11.0 read is read the same way, except the two cases above, which it
35
+ either misread or rejected. Checked by writing 4,000 generated scripts and reading back 8,000
36
+ texts with both versions. ASM still cannot say how data was pushed, so a non-minimal push is
37
+ written minimally; `toString()` keeps it.
38
+
39
+ Reported by the scriptmin work (codenlighten/scriptmin#3).
40
+
41
+ The conformance corpus recorded the old ASM for one case, `parse multisig`, whose script
42
+ holds a raw `0xda`. That case's `asm` is the only value regenerated; its hex and string are
43
+ unchanged.
44
+
45
+ ## [9.11.0] - 2026-09-16
46
+
47
+ **The interpreter now accepts only what the node accepts when a script pushes a copy of a signature, and signature checks over large scripts are about eight times faster.** No API change. The consensus fix follows bitcoin-sv v1.2.0 `CleanupScriptCode`; every signature digest is byte-identical to 9.10.1.
48
+
49
+ ### Fixed — a spend the network rejects was accepted: signatures removed from the scriptCode where the node keeps them
50
+
51
+ Before checking a signature, `OP_CHECKSIG`, `OP_CHECKSIGVERIFY` and `OP_CHECKMULTISIG(VERIFY)`
52
+ removed every copy of the signature from the script it signs. The node does that only when
53
+ FORKID is not in effect (bitcoin-sv `src/script/interpreter.cpp`, `CleanupScriptCode`):
54
+
55
+ ```cpp
56
+ if (!(flags & SCRIPT_ENABLE_SIGHASH_FORKID) || !sigHashType.hasForkId())
57
+ scriptCode.FindAndDelete(CScript(vchSig));
58
+ ```
59
+
60
+ So a locking script that pushes a copy of a signature could be satisfied by that signature
61
+ made over the script *without* the push. The library removed the push, found the digest it
62
+ expected and accepted; the node signs over the script as it is and rejects. A covenant or
63
+ wallet relying on this library's verdict could build, and consider final, a transaction the
64
+ network will never mine. All three opcodes now follow the node's rule.
65
+
66
+ `Script#findAndDelete` also skipped the chunk after each removal, so of two consecutive copies
67
+ only the first went. `CScript::FindAndDelete` removes consecutive occurrences, including every
68
+ `OP_0` for an empty non-FORKID signature; so does this now. A byte-level transcription of the
69
+ node's `FindAndDelete` agrees with it over 30,000 generated scripts, where the previous version
70
+ disagreed on 15,380.
71
+
72
+ ### Changed — signature checks over large scripts are much faster
73
+
74
+ On a 238 KB OP_PUSH_TX locking script one `OP_CHECKSIGVERIFY` took about 450 ms, against 0.2 ms to
75
+ hash the bytes it signs. The scriptCode is no longer copied on the FORKID path, is serialized
76
+ once rather than twice, `Script#toBuffer` writes one allocation, and `findAndDelete` serializes
77
+ only chunks that can match. Measured on a 139 KB script: 207 ms → 27 ms. Every serialization and
78
+ every digest is unchanged: 65,044 sighash digests over generated transactions and scriptCodes,
79
+ both algorithms, all hash types, are byte-identical to 9.10.1.
80
+
10
81
  ## [9.10.1] - 2026-09-16
11
82
 
12
83
  **A patch: evaluating a script no longer rewrites it or the interpreter's shared boolean values.** No API change; consensus results are unchanged.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Bitcoin SV library with an interpreter-verified script engine.
4
4
 
5
- [![Version](https://img.shields.io/badge/version-9.10.1-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
5
+ [![Version](https://img.shields.io/badge/version-9.11.1-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
6
6
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
  [![Stability](https://img.shields.io/badge/9.x%20stable%20until-2027--09--01-brightgreen.svg)](STABILITY.md)
8
8
 
@@ -155,44 +155,44 @@ const bsv = require('@smartledger/bsv') // 128 modules
155
155
  ### **Core Modules**
156
156
  | Module | Size | Use Case | CDN |
157
157
  |--------|------|----------|-----|
158
- | **bsv.min.js** | 1056KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.10.1/bsv.min.js` |
159
- | **bsv.bundle.js** | 1056KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.10.1/bsv.bundle.js` |
158
+ | **bsv.min.js** | 1057KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.11.1/bsv.min.js` |
159
+ | **bsv.bundle.js** | 1057KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.11.1/bsv.bundle.js` |
160
160
 
161
161
  ### **W3C Verifiable Credentials**
162
162
  | Module | Size | Use Case | CDN |
163
163
  |--------|------|----------|-----|
164
- | **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.10.1/bsv-didweb.min.js` |
165
- | **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.10.1/bsv-vcjwt.min.js` |
166
- | **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.10.1/bsv-statuslist.min.js` |
167
- | **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.10.1/bsv-anchor.min.js` |
164
+ | **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.11.1/bsv-didweb.min.js` |
165
+ | **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.11.1/bsv-vcjwt.min.js` |
166
+ | **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.11.1/bsv-statuslist.min.js` |
167
+ | **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.11.1/bsv-anchor.min.js` |
168
168
 
169
169
  ### **Smart Contract & Development**
170
170
  | Module | Size | Use Case | CDN |
171
171
  |--------|------|----------|-----|
172
- | **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.10.1/bsv-smartcontract.min.js` |
173
- | **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.10.1/bsv-covenant.min.js` |
174
- | **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.10.1/bsv-script-helper.min.js` |
175
- | **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.10.1/bsv-security.min.js` |
172
+ | **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.11.1/bsv-smartcontract.min.js` |
173
+ | **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.11.1/bsv-covenant.min.js` |
174
+ | **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.11.1/bsv-script-helper.min.js` |
175
+ | **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.11.1/bsv-security.min.js` |
176
176
 
177
177
  ### **Legal & Compliance**
178
178
  | Module | Size | Use Case | CDN |
179
179
  |--------|------|----------|-----|
180
- | **bsv-ltp.min.js** | 540KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.10.1/bsv-ltp.min.js` |
181
- | **bsv-gdaf.min.js** | 1056KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.10.1/bsv-gdaf.min.js` |
180
+ | **bsv-ltp.min.js** | 541KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.11.1/bsv-ltp.min.js` |
181
+ | **bsv-gdaf.min.js** | 1057KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.11.1/bsv-gdaf.min.js` |
182
182
 
183
183
  ### **Advanced Cryptography**
184
184
  | Module | Size | Use Case | CDN |
185
185
  |--------|------|----------|-----|
186
- | **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.10.1/bsv-shamir.min.js` |
186
+ | **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.11.1/bsv-shamir.min.js` |
187
187
 
188
188
  ### **Utilities**
189
189
  | Module | Size | Use Case | CDN |
190
190
  |--------|------|----------|-----|
191
- | **bsv-ecies.min.js** | 137KB | Encryption | `unpkg.com/@smartledger/bsv@9.10.1/bsv-ecies.min.js` |
192
- | **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.10.1/bsv-message.min.js` |
193
- | **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.10.1/bsv-mnemonic.min.js` |
191
+ | **bsv-ecies.min.js** | 137KB | Encryption | `unpkg.com/@smartledger/bsv@9.11.1/bsv-ecies.min.js` |
192
+ | **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.11.1/bsv-message.min.js` |
193
+ | **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.11.1/bsv-mnemonic.min.js` |
194
194
  ```html
195
- <script src="https://unpkg.com/@smartledger/bsv@9.10.1/bsv.min.js"></script>
195
+ <script src="https://unpkg.com/@smartledger/bsv@9.11.1/bsv.min.js"></script>
196
196
  <script>
197
197
  const key = bsv.PrivateKey.fromRandom()
198
198
  </script>
@@ -240,4 +240,4 @@ MIT
240
240
 
241
241
  ---
242
242
 
243
- **SmartLedger-BSV v9.10.1**
243
+ **SmartLedger-BSV v9.11.1**