@smartledger/bsv 9.11.0 → 9.11.2

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,72 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [9.11.2] - 2026-09-17
11
+
12
+ **A patch: an empty push is no longer lost when a script is written as ASM or as a string.** No API change.
13
+
14
+ ### Fixed — an empty push written with OP_PUSHDATA survives being written as text
15
+
16
+ An empty push encoded with `OP_PUSHDATA1`, `OP_PUSHDATA2` or `OP_PUSHDATA4` (`4c00`, `4d0000`,
17
+ `4e00000000`) was written badly by both text forms:
18
+
19
+ | script `514c0051` | 9.11.1 | now |
20
+ | --- | --- | --- |
21
+ | `toASM()` | `OP_1 OP_1`: the push is gone, so it reads back as `5151`, one stack element fewer | `OP_1 0 OP_1`, read back as `510051` |
22
+ | `toString()` | `OP_1 OP_PUSHDATA1 OP_1`, which `fromString` cannot read | `OP_1 OP_PUSHDATA1 0 0x OP_1`, read back as `514c0051` |
23
+
24
+ ASM writes every push in its minimal form, and the minimal empty push is `OP_0`, so the ASM
25
+ now does what the script does. `toString` keeps the exact encoding.
26
+
27
+ The same fault hid the empty push built by `Script#add(Buffer.alloc(0))`, and so by
28
+ `Script.buildDataOut('')` and `buildSafeDataOut('')`. The chunk serializes to `0x00`, but both
29
+ text forms wrote nothing for it: `buildDataOut('')` is `6a00` and its `toString()` was
30
+ `OP_RETURN`, which reads back as `6a`. It is now `OP_RETURN OP_0` (ASM `OP_RETURN 0`), the text
31
+ `Script.fromHex('6a00')` already produced. Four tests had pinned the invisible form; they now
32
+ assert the text reads back as the script.
33
+
34
+ No reader changes: `fromString` already read `OP_PUSHDATA1 0 0x`. Of 4,000 generated scripts
35
+ mixing both shapes with ordinary pushes and opcodes, the 909 whose text changed all contain an
36
+ empty push, and every one of their new texts reads back exactly; every text 9.11.1 wrote is read
37
+ the same way (8,000 texts).
38
+
39
+ Reported by the scriptmin work (codenlighten/scriptmin#4).
40
+
41
+ ## [9.11.1] - 2026-09-17
42
+
43
+ **A patch: a script written as ASM or as a string reads back as the same script.** No API change.
44
+
45
+ ### Fixed — a script written as text reads back as the same script
46
+
47
+ An opcode with no name — `0xba` to `0xfc`, 67 of them — did not survive being written out:
48
+
49
+ | | 9.11.0 | now |
50
+ | --- | --- | --- |
51
+ | `toASM()` of `51ba` | `OP_1 ba`, which `fromASM` reads as a one-byte push: `5101ba` | `OP_1 0xba`, read back as `51ba` |
52
+ | `toString()` of `51ba` | `OP_1 0xba`, which `fromString` rejects | unchanged, and read back as `51ba` |
53
+
54
+ ASM wrote the byte as bare hex, which is also how it writes a one-byte data push, so the two
55
+ were indistinguishable and a script written to ASM and read back was a different script. Both
56
+ forms now write the raw byte as `0xba`, as bitcoind's script test format does, and both read
57
+ it back, in either case. The opcodes are not given names: `Opcode.map` invents none above
58
+ `OP_NOP10`, and a name such as `OP_NOP11` would suggest a no-op where the node fails the
59
+ script. They still execute as `SCRIPT_ERR_BAD_OPCODE`.
60
+
61
+ `Script.fromASM('')` now returns an empty script. It returned `OP_0`, so an empty script
62
+ written with `toASM()` read back as a different one.
63
+
64
+ Only these outputs change: every other script writes the same ASM and the same string as in
65
+ 9.11.0, and every text 9.11.0 read is read the same way, except the two cases above, which it
66
+ either misread or rejected. Checked by writing 4,000 generated scripts and reading back 8,000
67
+ texts with both versions. ASM still cannot say how data was pushed, so a non-minimal push is
68
+ written minimally; `toString()` keeps it.
69
+
70
+ Reported by the scriptmin work (codenlighten/scriptmin#3).
71
+
72
+ The conformance corpus recorded the old ASM for one case, `parse multisig`, whose script
73
+ holds a raw `0xda`. That case's `asm` is the only value regenerated; its hex and string are
74
+ unchanged.
75
+
10
76
  ## [9.11.0] - 2026-09-16
11
77
 
12
78
  **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.
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.11.0-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
5
+ [![Version](https://img.shields.io/badge/version-9.11.2-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** | 1057KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.11.0/bsv.min.js` |
159
- | **bsv.bundle.js** | 1057KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.11.0/bsv.bundle.js` |
158
+ | **bsv.min.js** | 1057KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.11.2/bsv.min.js` |
159
+ | **bsv.bundle.js** | 1057KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.11.2/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.11.0/bsv-didweb.min.js` |
165
- | **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.11.0/bsv-vcjwt.min.js` |
166
- | **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.11.0/bsv-statuslist.min.js` |
167
- | **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.11.0/bsv-anchor.min.js` |
164
+ | **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.11.2/bsv-didweb.min.js` |
165
+ | **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.11.2/bsv-vcjwt.min.js` |
166
+ | **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.11.2/bsv-statuslist.min.js` |
167
+ | **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.11.2/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.11.0/bsv-smartcontract.min.js` |
173
- | **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.11.0/bsv-covenant.min.js` |
174
- | **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.11.0/bsv-script-helper.min.js` |
175
- | **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.11.0/bsv-security.min.js` |
172
+ | **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.11.2/bsv-smartcontract.min.js` |
173
+ | **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.11.2/bsv-covenant.min.js` |
174
+ | **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.11.2/bsv-script-helper.min.js` |
175
+ | **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.11.2/bsv-security.min.js` |
176
176
 
177
177
  ### **Legal & Compliance**
178
178
  | Module | Size | Use Case | CDN |
179
179
  |--------|------|----------|-----|
180
- | **bsv-ltp.min.js** | 541KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.11.0/bsv-ltp.min.js` |
181
- | **bsv-gdaf.min.js** | 1057KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.11.0/bsv-gdaf.min.js` |
180
+ | **bsv-ltp.min.js** | 541KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.11.2/bsv-ltp.min.js` |
181
+ | **bsv-gdaf.min.js** | 1057KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.11.2/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.11.0/bsv-shamir.min.js` |
186
+ | **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.11.2/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.11.0/bsv-ecies.min.js` |
192
- | **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.11.0/bsv-message.min.js` |
193
- | **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.11.0/bsv-mnemonic.min.js` |
191
+ | **bsv-ecies.min.js** | 137KB | Encryption | `unpkg.com/@smartledger/bsv@9.11.2/bsv-ecies.min.js` |
192
+ | **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.11.2/bsv-message.min.js` |
193
+ | **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.11.2/bsv-mnemonic.min.js` |
194
194
  ```html
195
- <script src="https://unpkg.com/@smartledger/bsv@9.11.0/bsv.min.js"></script>
195
+ <script src="https://unpkg.com/@smartledger/bsv@9.11.2/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.11.0**
243
+ **SmartLedger-BSV v9.11.2**