bsv2 2.1.9 → 2.2.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/README.md +42 -9
- package/dist/bsv2.cjs +7 -7
- package/dist/bsv2.cjs.map +1 -1
- package/dist/bsv2.mjs +1872 -1781
- package/dist/bsv2.mjs.map +1 -1
- package/dist/bsv2.umd.js +7 -7
- package/dist/bsv2.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,8 +12,10 @@ of the `bsv` 2.x codebase: same class-based API, published on npm as
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
14
|
- Transactions and scripts with BSV `SIGHASH_FORKID` semantics.
|
|
15
|
-
-
|
|
16
|
-
|
|
15
|
+
- Chronicle support: the Original Transaction Digest Algorithm (OTDA), the
|
|
16
|
+
restored opcodes and the opt-in malleability policy.
|
|
17
|
+
- A script interpreter with the standard verification flags, plus opt-in
|
|
18
|
+
pre-Genesis and Chronicle policy modes.
|
|
17
19
|
- Keys, addresses, BIP32 hierarchical deterministic wallets and BIP39 mnemonics
|
|
18
20
|
(English, Spanish and Japanese wordlists).
|
|
19
21
|
- Block and block-header serialization, plus mining utilities.
|
|
@@ -148,6 +150,36 @@ The flag restores: 4-byte script numbers, 520-byte push limit, 10 KB script
|
|
|
148
150
|
limit, 1000-element stack limit and the pre-Genesis disabled opcodes. It is not
|
|
149
151
|
part of `Interp.defaultFlags` and must be requested explicitly.
|
|
150
152
|
|
|
153
|
+
## Chronicle release
|
|
154
|
+
|
|
155
|
+
Chronicle activates at mainnet height 943,835, testnet 1,713,022 and regtest
|
|
156
|
+
15,000. The library exposes its rules without requiring a block height.
|
|
157
|
+
|
|
158
|
+
- Set `Sig.SIGHASH_CHRONICLE` (`0x20`) in a signature hash type to select the
|
|
159
|
+
Original Transaction Digest Algorithm (OTDA). ForkID signatures without it
|
|
160
|
+
keep using BIP143. OTDA ignores `valueBn`, and the bit may be mixed across
|
|
161
|
+
inputs.
|
|
162
|
+
- `tx.versionBytesNum > 1`, or `Interp.SCRIPT_VERIFY_CHRONICLE`, enables the
|
|
163
|
+
relaxed script policy: minimal encoding, Low-S, NULLDUMMY, clean stack and
|
|
164
|
+
push-only unlocking scripts are no longer enforced. Version-1 transactions
|
|
165
|
+
keep the existing checks. MINIMALIF and NULLFAIL are not enforced by this
|
|
166
|
+
library for either version.
|
|
167
|
+
- Restored opcodes: `OP_VER`, `OP_VERIF`, `OP_VERNOTIF`, `OP_SUBSTR`,
|
|
168
|
+
`OP_LEFT`, `OP_RIGHT`, `OP_2MUL`, `OP_2DIV`, `OP_LSHIFTNUM`, `OP_RSHIFTNUM`.
|
|
169
|
+
`OpCode.OP_SUBSTR_CHRONICLE`, `OP_LEFT_CHRONICLE`, `OP_RIGHT_CHRONICLE`,
|
|
170
|
+
`OP_LSHIFTNUM` and `OP_RSHIFTNUM` hold the new numbers because Genesis
|
|
171
|
+
reassigned the original ones.
|
|
172
|
+
- The script-number consensus limit rises to 32 MB; nodes may still set a
|
|
173
|
+
lower policy limit.
|
|
174
|
+
|
|
175
|
+
`Interp.getFlags('CHRONICLE')` includes the flag, which is not part of
|
|
176
|
+
`Interp.defaultFlags`. To sign with OTDA, add the bit to the hash type:
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
const nHashType = Sig.SIGHASH_ALL | Sig.SIGHASH_FORKID | Sig.SIGHASH_CHRONICLE
|
|
180
|
+
const sig = spendTx.sign(keyPair, nHashType, 0, scriptPubKey, valueBn)
|
|
181
|
+
```
|
|
182
|
+
|
|
151
183
|
## API map
|
|
152
184
|
|
|
153
185
|
All symbols below are exported from the package root (`entry.js`).
|
|
@@ -191,9 +223,9 @@ yarn build # build dist/bsv2.{mjs,cjs,umd.js}
|
|
|
191
223
|
yarn doc # regenerate API documentation
|
|
192
224
|
```
|
|
193
225
|
|
|
194
|
-
The suite has over
|
|
195
|
-
Bitcoin ABC and Bitcoin SV
|
|
196
|
-
|
|
226
|
+
The suite has over 8,500 tests, including reference vectors from bitcoind,
|
|
227
|
+
Bitcoin ABC and Bitcoin SV, plus dedicated tests for the pre-Genesis and
|
|
228
|
+
Chronicle policies. `yarn test` starts Vitest in watch mode.
|
|
197
229
|
|
|
198
230
|
Commits and release tags are GPG-signed, and `commit.gpgsign` is enabled for
|
|
199
231
|
future commits. Releases are published to npm and GitHub Releases with the same
|
|
@@ -203,14 +235,15 @@ dependencies pinned to patched versions.
|
|
|
203
235
|
## Differences from upstream `bsv` 2.x
|
|
204
236
|
|
|
205
237
|
- Published as **`bsv2`**; ESM-first with a matching CommonJS and UMD build.
|
|
206
|
-
- Default sighash behaviour follows BSV (`SIGHASH_FORKID`)
|
|
207
|
-
|
|
238
|
+
- Default sighash behaviour follows BSV (`SIGHASH_FORKID`). Pre-Genesis rules
|
|
239
|
+
and the Chronicle release rules are opt-in flags.
|
|
208
240
|
- The `Bn` wrapper was rewritten and the script interpreter received targeted
|
|
209
241
|
correctness fixes; see the commit history for details.
|
|
210
242
|
- Japanese BIP39 vectors, `Buffer`/`pbkdf2` interoperability and mnemonic
|
|
211
243
|
whitespace validation were fixed.
|
|
212
|
-
-
|
|
213
|
-
|
|
244
|
+
- Pre-BIP143 sighash vectors are evaluated with forkid disabled, and
|
|
245
|
+
pre-Chronicle ABC vectors whose random `0x20` bit changed meaning are
|
|
246
|
+
excluded from the test suite.
|
|
214
247
|
|
|
215
248
|
## Security
|
|
216
249
|
|