@smartledger/bsv 9.12.0 → 9.14.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 +56 -0
- package/README.md +19 -19
- package/bsv-gdaf.min.js +44 -44
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +44 -44
- package/bsv.d.ts +30 -2
- package/bsv.min.js +44 -44
- package/docs/AUDIT_SCOPE.md +7 -7
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/audit-rfq/cure53.txt +2 -2
- package/docs/audit-rfq/ncc-group.txt +2 -2
- package/docs/audit-rfq/trail-of-bits.txt +2 -2
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/lib/notaryhash/index.js +26 -2
- package/lib/spv/merkleproof.js +75 -7
- package/package.json +1 -1
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [9.14.0] - 2026-09-29
|
|
11
|
+
|
|
12
|
+
### Added — `minDifficulty`, because a work floor in hashes invites a unit error that fails open
|
|
13
|
+
|
|
14
|
+
`minWork` counts **hashes**. Difficulty is the unit a floor is actually quoted in: a real BSV
|
|
15
|
+
header is "difficulty 2.6e10", not "1.1e20 hashes". The two are 4,295,032,833 apart, so reading
|
|
16
|
+
one as the other sets a floor **4.3 billion times too low** — and it fails *open*, because the
|
|
17
|
+
call keeps succeeding and nothing says the floor stopped meaning anything.
|
|
18
|
+
|
|
19
|
+
That is not hypothetical. While comparing this library's cap with the BRC-220 reference
|
|
20
|
+
implementation's floor, its `minDifficulty: 5e9` was read here as 5e9 *hashes* and reported as
|
|
21
|
+
"difficulty 1.16, a twentieth of a billionth of a real header". The true figure is 5e9 ×
|
|
22
|
+
4,295,032,833 ≈ **2.1e19** hashes, about a fifth of block 954784's 1.098e20 — a sound floor,
|
|
23
|
+
misread by a factor of 4.3e9 in the direction that looks alarming rather than safe. The
|
|
24
|
+
reference's API had the better name first.
|
|
25
|
+
|
|
26
|
+
So `SPV.verifyTxInclusion` and `NotaryHash.verify` now take `minDifficulty` beside `minWork`:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
NotaryHash.verify(cert, { header, minDifficulty: '2.5e10' }) // difficulty, as quoted
|
|
30
|
+
NotaryHash.verify(cert, { header, minWork: '1e20' }) // hashes, as counted
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Exactly one of the two: passing both throws rather than leaving the caller to guess which
|
|
34
|
+
applied. The conversion is exact — a fractional or exponent-form difficulty is expanded by
|
|
35
|
+
moving the decimal point, never through a float — and `minDifficulty` also satisfies the 9.13.0
|
|
36
|
+
notice, so a caller stating a policy in difficulty is not warned.
|
|
37
|
+
|
|
38
|
+
## [9.13.0] - 2026-09-29
|
|
39
|
+
|
|
40
|
+
### Deprecated — verifying an anchor with a header and no trust policy
|
|
41
|
+
|
|
42
|
+
9.12.0 stopped a **free** forgery. It does not stop a **cheap** one: the default limit is
|
|
43
|
+
difficulty 1, which costs about **4.3e9** double-SHA256 attempts — seconds on one consumer GPU,
|
|
44
|
+
well under a second on an ASIC — while a real mainnet header carries about **1e20** (measured:
|
|
45
|
+
`1.098e20` at block 954784's `bits` of `0x182afffe`, a factor of 2.6e10). So a caller whose only
|
|
46
|
+
input is "a header" has proved inclusion in something that cost very little, unless the header
|
|
47
|
+
came from a source it trusts.
|
|
48
|
+
|
|
49
|
+
`NotaryHash.verify(certificate, { header })` now warns once when neither `minWork` nor
|
|
50
|
+
`blockHashAtHeight` is given, and **10.0.0 will require one of them**. Per STABILITY.md this is
|
|
51
|
+
marked in a minor and breaks in the major; nothing throws today, and `requirePow: false` is
|
|
52
|
+
silent because none of it applies. There is no universally right default to pick instead:
|
|
53
|
+
`minWork` depends on the chain and the application, and testnet would break under a mainnet
|
|
54
|
+
floor.
|
|
55
|
+
|
|
56
|
+
### Fixed — a `powLimit` or `minWork` passed as a BN was not range-checked
|
|
57
|
+
|
|
58
|
+
`powLimit: BN(2^256)` admitted the very forgery the cap exists to refuse, because every target
|
|
59
|
+
is below 2^256; `BN(0)` admitted nothing; a negative BN `minWork` passed any header. A BN
|
|
60
|
+
`powLimit` must now be above zero and below 2^256, and a BN `minWork` must not be negative.
|
|
61
|
+
Compact bits and decimal strings were already checked.
|
|
62
|
+
|
|
63
|
+
Both found by an independent verification of the published 9.12.0 and of
|
|
64
|
+
`smartledger-bsv-core`, which agreed on all 35 checks.
|
|
65
|
+
|
|
10
66
|
## [9.12.0] - 2026-09-29
|
|
11
67
|
|
|
12
68
|
**A block header is no longer believed about the difficulty it declares.** A forged header cost
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Bitcoin SV library with an interpreter-verified script engine.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@smartledger/bsv)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](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** |
|
|
159
|
-
| **bsv.bundle.js** |
|
|
158
|
+
| **bsv.min.js** | 1062KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.14.0/bsv.min.js` |
|
|
159
|
+
| **bsv.bundle.js** | 1062KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.14.0/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.
|
|
165
|
-
| **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.
|
|
166
|
-
| **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.
|
|
167
|
-
| **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.
|
|
164
|
+
| **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.14.0/bsv-didweb.min.js` |
|
|
165
|
+
| **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.14.0/bsv-vcjwt.min.js` |
|
|
166
|
+
| **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.14.0/bsv-statuslist.min.js` |
|
|
167
|
+
| **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.14.0/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.
|
|
173
|
-
| **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.
|
|
174
|
-
| **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.
|
|
175
|
-
| **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.
|
|
172
|
+
| **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.14.0/bsv-smartcontract.min.js` |
|
|
173
|
+
| **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.14.0/bsv-covenant.min.js` |
|
|
174
|
+
| **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.14.0/bsv-script-helper.min.js` |
|
|
175
|
+
| **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.14.0/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.
|
|
181
|
-
| **bsv-gdaf.min.js** |
|
|
180
|
+
| **bsv-ltp.min.js** | 541KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.14.0/bsv-ltp.min.js` |
|
|
181
|
+
| **bsv-gdaf.min.js** | 1062KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.14.0/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.
|
|
186
|
+
| **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.14.0/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.
|
|
192
|
-
| **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.
|
|
193
|
-
| **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.
|
|
191
|
+
| **bsv-ecies.min.js** | 137KB | Encryption | `unpkg.com/@smartledger/bsv@9.14.0/bsv-ecies.min.js` |
|
|
192
|
+
| **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.14.0/bsv-message.min.js` |
|
|
193
|
+
| **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.14.0/bsv-mnemonic.min.js` |
|
|
194
194
|
```html
|
|
195
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
195
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.14.0/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.
|
|
243
|
+
**SmartLedger-BSV v9.14.0**
|