@smartledger/bsv 9.9.0 → 9.10.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.
@@ -34,14 +34,14 @@ module sounds. That is a deliberate revision: an earlier version of this documen
34
34
  scoped Tier 1 as "the cryptographic core" and would have excluded four of the six real
35
35
  defects this codebase has produced. See §2.1.
36
36
 
37
- ### Tier 1 — 11,962 lines
37
+ ### Tier 1 — 11,976 lines
38
38
 
39
39
  | Module | Lines | Why it matters |
40
40
  | --- | ---: | --- |
41
41
  | `lib/transaction/` | 2,779 | Sighash construction and signing — both BIP-143 and the Original Transaction Digest Algorithm. |
42
42
  | `lib/script/interpreter.js` | 2,821 | **Scoped to the flag and era surface, not opcode execution.** Consensus-flag selection and defaults, era derivation (Genesis/Chronicle), the limits derived from them, and the semantics of the exported `verify()`. Opcode execution is excluded — see §2.2. |
43
43
  | `lib/crypto/` | 2,519 | ECDSA, nonce derivation, signature encoding, the script-number type. **Scope this for an architectural judgement as well as for bugs** — see §2.3. |
44
- | `lib/notaryhash/` | 2,014 | BRC-220 signing and verification. Publicly reachable and relied on downstream. |
44
+ | `lib/notaryhash/` | 2,028 | BRC-220 signing and verification. Publicly reachable and relied on downstream. |
45
45
  | `lib/privatekey.js`, `lib/publickey.js` | 843 | Key construction, serialisation, WIF. Recent defects here produced a *different* key without error. |
46
46
  | `lib/smart_contract/` (targeted) | 472 | `locks.js` and the covenant-facing entrypoints in `index.js`: CLTV and HTLC locking semantics, flag plumbing, and any wrapper claiming mainnet-equivalent verification. Not the whole 6,908-line module. |
47
47
  | `lib/covenant/` | 409 | The verification harness. Its flag word is what made covenants verify under 2019 rules while claiming to mirror mainnet. |
@@ -150,14 +150,14 @@ this repository.
150
150
  | `lib/address.js`, `lib/networks.js`, `lib/opcode.js`, `lib/hdprivatekey.js`, `lib/hdpublickey.js` (2,391 lines) | Cut to pay for §2.1 | Formatting, network constants and BIP-32 derivation. No defect has originated here, and `networks.js` in particular defines addressing constants — pubkey hashes, xpub prefixes, ports, DNS seeds — and contains **no consensus-flag logic at all**. |
151
151
  | The rest of the application layer — `lib/gdaf/`, `lib/ltp/`, `lib/ordinals/`, `lib/block/`, `lib/didweb/`, `lib/vcjwt/`, `lib/statuslist/`, most of `lib/smart_contract/`, plus assorted top-level files | Excluded | ~26,000 lines. Worth a separate engagement; including it here would blur the question in §1. Note the parts of it with a demonstrated defect history have been pulled *into* Tier 1 rather than left here — see §2.1. |
152
152
 
153
- Totals reconcile against `lib/`, which is 39,646 lines across 131 files:
153
+ Totals reconcile against `lib/`, which is 39,660 lines across 131 files:
154
154
 
155
155
  ```
156
- tier 1 11,962
156
+ tier 1 11,976
157
157
  tier 2 1,607
158
158
  excluded 26,077
159
159
  ------
160
- total 39,646
160
+ total 39,660
161
161
  ```
162
162
 
163
163
  Measured 2026-08-29 at `a954c27`. These figures drift as the library changes — an
@@ -228,7 +228,7 @@ seeking a quote for an independent security review.
228
228
 
229
229
  Scope, and we would like these priced separately:
230
230
 
231
- Tier 1 — 11,962 lines. Sighash construction and signing; ECDSA, nonce
231
+ Tier 1 — 11,976 lines. Sighash construction and signing; ECDSA, nonce
232
232
  derivation and signature encoding; the consensus-flag and era-derivation
233
233
  surface of the script interpreter; BRC-220 signing and verification;
234
234
  key construction and serialisation; the covenant verification harness and
@@ -6,7 +6,9 @@ in a leaf. This proposes the definition, with the reasoning that led to it.
6
6
  Prepared 2026-08-17 while implementing BRC-220 in `@smartledger/bsv`.
7
7
 
8
8
  **Status: filed** as [bsv-blockchain/BRCs#246](https://github.com/bsv-blockchain/BRCs/pull/246)
9
- on 2026-09-11, together with a clarification of the ECDSA digest convention. Before filing
9
+ on 2026-09-11, together with a clarification of the ECDSA digest convention. Its review
10
+ asked that `leafIndex` be stated as counted from 0 and that the vector say how `i` is
11
+ written; both are in #246 and below. Before filing
10
12
  it was checked against the BRC-220 reference implementation, whose batcher uses exactly
11
13
  this leaf (`leaves = batch.map(e => e.proofHash)`), and the vector below was rebuilt
12
14
  without any of this library's code — the root from the reference's own RFC 6962 tree.
@@ -64,7 +66,7 @@ Insert into **§On-chain record**, replacing the batch bullet's parenthetical.
64
66
  > The leaf datum `d` for a proof is its **`proofHash`** — the 32 bytes defined in
65
67
  > §Canonical proof bytes — so a leaf is `SHA-256(0x00 ‖ proofHash)` and an internal node
66
68
  > is `SHA-256(0x01 ‖ l ‖ r)`. Leaves are ordered as the batch was assembled, and
67
- > `leafIndex` in the certificate's `merkle` object is that position. The tree splits at
69
+ > `leafIndex` in the certificate's `merkle` object is that position, counted from 0. The tree splits at
68
70
  > the largest power of two `< n` and the last leaf is never duplicated, per RFC 6962
69
71
  > §2.1.
70
72
  >
@@ -135,12 +137,15 @@ up in the audit-path lengths: `[3, 3, 3, 3, 1]`.
135
137
  Every input is derived from a labelled preimage rather than chosen, so the file
136
138
  regenerates byte-identically and any implementation can rebuild it from scratch:
137
139
 
138
- - private key `i` = `SHA-256("BRC-220/batch-vector/key/" + i)`
140
+ - private key `i` = `SHA-256("BRC-220/batch-vector/key/" + i)`, read as a big-endian integer
139
141
  - `payloadHash` `i` = `SHA-256("BRC-220/batch-vector/payload/" + i)`
140
142
  - `createdAt` `i` = `2026-01-0(i+1)T00:00:00.000Z`
141
143
  - `algorithm` = `ECDSA-secp256k1`, `hashAlgorithm` = `SHA-256`, a 64-byte `r ‖ s`
142
144
  signature normalised to low-S, and a 33-byte compressed public key
143
145
 
146
+ where `i` is written as one ASCII decimal digit, `"0"` to `"4"`, so the first key's
147
+ preimage is the 26-byte string `BRC-220/batch-vector/key/0`.
148
+
144
149
  **Signing.** The signer signs the 32-byte `payloadHash` directly — the digest *is* the
145
150
  scalar, big-endian. RFC 6979 makes the nonce deterministic, so the signatures, and every
146
151
  hash derived from them, reproduce exactly.
@@ -0,0 +1,246 @@
1
+ # Proposed BRC-220 amendment: define the certificate's field values
2
+
3
+ §Certificate names the twelve fields a certificate must carry and says it is JSON. It
4
+ defines none of their values. This proposes the values the BRC-220 reference
5
+ implementation writes, and two rules for reading them. With both, any implementation
6
+ produces certificates the reference verifies, and reads certificates the way the reference
7
+ does.
8
+
9
+ Prepared 2026-09-11, with the open points decided [below](#decisions). **Status: filed**
10
+ as [bsv-blockchain/BRCs#247](https://github.com/bsv-blockchain/BRCs/pull/247) on 2026-09-11. It is meant to be a separate pull request from
11
+ [bsv-blockchain/BRCs#246](https://github.com/bsv-blockchain/BRCs/pull/246), which is under
12
+ review and deliberately narrow; this text builds on it for the batch leaf datum.
13
+
14
+ ---
15
+
16
+ ## Why it matters
17
+
18
+ Two implementations of BRC-220 filled the gap differently. `@smartledger/bsv` 8.3.0–9.8.0
19
+ and the reference implementation computed identical `proofHash` values, signature digests,
20
+ Merkle trees and on-chain records, and **could not verify a single one of each other's
21
+ certificates**:
22
+
23
+ | field | `@smartledger/bsv` 8.3.0–9.8.0 | reference implementation |
24
+ | --- | --- | --- |
25
+ | `version` | `1` | `"1.0"` |
26
+ | `mode` | `0` / `1` / `2` | `"full"` / `"hybrid"` |
27
+ | a batch | `mode: 2` | `anchor.type: "batch"` |
28
+ | `encoding` | `"raw"` / `"der"` — the signature's byte form | `"hex"` / `"base64"` — how two fields are written |
29
+ | `anchor` | `{ txid, blockHeight }` | `{ type, network, txid, vout, blockHeight, blockTime }` |
30
+ | `merkle.path` | bare hashes | `{ hash, side }` |
31
+
32
+ Every reading on the left is defensible from the current text. None of it is defined there.
33
+ The cryptography is fully specified and the object carrying it is not, so two conformant
34
+ implementations fail each other silently, on the field names a verifier reads first.
35
+
36
+ ## Where the values come from
37
+
38
+ Every value below is what the reference implementation writes, read from its source at
39
+ commit `b926e3b`: the certificate assembly, the batcher, the confirmation poller that adds
40
+ the SPV envelope, and its request schema. They agree with the reference's own protocol
41
+ document, whose §5 carries the same example shapes.
42
+
43
+ The two reader rules go further than the reference's verifier did at `b926e3b`. It accepted
44
+ a certificate of any `version`, and decoded base64 by skipping whatever it did not
45
+ recognise. The reference implementation adopts both rules, and `@smartledger/bsv` applies
46
+ both, so the spec does not state a rule its own reference breaks.
47
+
48
+ The two examples are certificates the reference's own code produced, reproduced in
49
+ `test/data/notaryhash-reference-certs.json`, where each was accepted by the reference's
50
+ schema and verifier. `test/notaryhash/fields_amendment.js` reads them out of this document
51
+ and checks them against that fixture, so the examples cannot drift from what the reference
52
+ actually wrote.
53
+
54
+ ---
55
+
56
+ ## What the spec currently says
57
+
58
+ §Certificate, in full:
59
+
60
+ > A self-contained JSON object, canonicalised via RFC 8785 (JCS) for hashing and transport.
61
+ > Required fields: `protocol`, `version`, `mode`, `algorithm`, `hashAlgorithm`,
62
+ > `payloadHash`, `publicKey`, `signature`, `encoding`, `proofHash`, `createdAt`, `anchor`.
63
+ > A batched certificate additionally carries a `merkle` inclusion proof
64
+ > `{root, leafIndex, leafCount, path[]}` whose folding (leaf → root) must equal the
65
+ > on-chain batch root.
66
+
67
+ That leaves undefined:
68
+
69
+ - `version`: a string or a number, and which one. The canonical bytes carry `u8(version=1)`
70
+ and the domain separator `"NotaryHash/1.0"`, which invite both.
71
+ - `mode`: the on-chain byte (`0`/`1`/`2`) or a name. The on-chain record also has a `kind = 2`
72
+ for batches, which invites treating batch as a third mode.
73
+ - `encoding`: whether it names the bytes' format (raw, DER) or their spelling in JSON.
74
+ - how `payloadHash`, `proofHash`, `publicKey` and `signature` are written.
75
+ - the format of `createdAt`, and how it relates to `createdAtUnix` in the canonical bytes.
76
+ - every member of `anchor`. The spec never lists them.
77
+ - the elements of `merkle.path`. With bare hashes a verifier needs `leafIndex` and
78
+ `leafCount` to fold; with sides it does not.
79
+ - the byte order of `txid`, `spv.blockHash` and `spv.merkleProof.nodes`.
80
+ - what a verifier does with a `version` it does not know, or a field that does not decode.
81
+
82
+ ---
83
+
84
+ ## Proposed text
85
+
86
+ Generated from the text as committed for filing, so the two cannot differ. The ECDSA
87
+ byte forms sit in §Certificate, under the fields they describe, rather than in
88
+ §Algorithms, which #246 edits; a trial merge of #246 on top of this change is clean.
89
+
90
+ ### 1. §Certificate — replace the paragraph
91
+
92
+ > ### Certificate
93
+ >
94
+ > A self-contained JSON object, canonicalised via [RFC 8785 (JCS)](https://www.rfc-editor.org/rfc/rfc8785) for hashing and transport, carrying the twelve required fields below. Hex is written **lowercase, without a `0x` prefix**; a reader MAY accept upper case and the prefix. Numbers are JSON integers. Verifiers ignore members they do not recognise, which is how the SPV envelope is added to a certificate already issued.
95
+ >
96
+ > | field | value |
97
+ > |-------|-------|
98
+ > | `protocol` | the string `"NotaryHash"` |
99
+ > | `version` | the string `"1.0"`: the certificate format version. It corresponds to `u8(version=1)` in the canonical proof bytes and the on-chain record, and to the domain separator `"NotaryHash/1.0"`, but is written as a string. A verifier MUST reject a certificate whose `version` it does not implement. |
100
+ > | `mode` | `"full"` or `"hybrid"`: how the proof is recorded on chain, corresponding to the on-chain `mode` byte `0` or `1`. Batching is marked by `anchor.type`, not by `mode`. |
101
+ > | `algorithm` | an identifier from §Algorithms, e.g. `"ECDSA-secp256k1"` |
102
+ > | `hashAlgorithm` | `"SHA-256"` |
103
+ > | `payloadHash` | the 32-byte payload hash, hex |
104
+ > | `publicKey` | the **full** public key in every mode (hybrid puts only its SHA-256 on chain), written per `encoding` |
105
+ > | `signature` | the **full** signature, as the signer produced it, in every mode, written per `encoding` |
106
+ > | `encoding` | how `publicKey` and `signature` are written: `"hex"`, or `"base64"` (RFC 4648 §4: standard alphabet, padded). It applies to those two fields only, and says nothing about the format of the bytes themselves. A reader MUST reject a value that is not valid in its encoding rather than decode what remains of it — for base64, a character outside the RFC 4648 §4 and §5 alphabets, padding anywhere but the end, or a length no byte string encodes. A reader MAY accept the §5 (URL-safe) alphabet and missing padding. |
107
+ > | `proofHash` | the 32-byte `SHA-256(canonicalBytes)`, hex |
108
+ > | `createdAt` | `createdAtUnix` as an ISO 8601 UTC timestamp with milliseconds, e.g. `"2026-01-01T00:00:00.000Z"`. The milliseconds are always `000`, because only whole seconds enter the canonical bytes; a verifier recovers `createdAtUnix` as the whole seconds the timestamp denotes. Advisory only — see §Verification. |
109
+ > | `anchor` | the object below |
110
+ >
111
+ > For `ECDSA-secp256k1`, `publicKey` is 33 bytes (compressed) or 65 (uncompressed), and `signature` is 64 bytes (`r ‖ s`, each a 32-byte big-endian integer) or DER. A verifier tells them apart by the bytes: DER begins with `0x30` and is not 64 bytes long. `S` is not normalised: the certificate commits, through `proofHash`, to the exact bytes the signer produced, so the malleated form of a signature is a different certificate rather than a forgery of this one.
112
+ >
113
+ > `anchor` locates the on-chain record:
114
+ >
115
+ > | member | value |
116
+ > |--------|-------|
117
+ > | `type` | `"direct"` if the record carries this proof (`mode` `0` or `1`); `"batch"` if it carries a Merkle root (`kind = 2`) |
118
+ > | `network` | the chain the anchoring transaction is on: `"bsv-mainnet"` for BSV mainnet, `"bsv-testnet"` for BSV testnet. Other values are not interoperable. The field is descriptive: which chain the anchor is on is established by the block header the verifier obtains, not by this value. |
119
+ > | `txid` | the anchoring transaction's id, hex, in display order: `reverse(SHA256(SHA256(rawTx)))` |
120
+ > | `vout` | the index of the `OP_RETURN` output within that transaction |
121
+ > | `blockHeight` | the height of the block that mined the transaction, or `null` until it is mined |
122
+ > | `blockTime` | that block's timestamp in Unix seconds, or `null` until it is mined |
123
+ >
124
+ > A batched certificate (`anchor.type` `"batch"`) additionally carries `merkle`, the proof that this proof is one of the batch's leaves:
125
+ >
126
+ > | member | value |
127
+ > |--------|-------|
128
+ > | `root` | the 32-byte batch root, hex; equal to `merkleRoot` in the on-chain batch record |
129
+ > | `leafIndex` | this proof's position in the batch, from `0` |
130
+ > | `leafCount` | the number of proofs in the batch; equal to `leafCount` in the on-chain batch record |
131
+ > | `path` | the audit path, leaf → root, as an array of `{ "hash": <32-byte hex>, "side": "left" or "right" }`. `side` is the sibling's position relative to the running hash. Starting from `SHA256(0x00 ‖ proofHash)`, a `"left"` sibling folds as `SHA256(0x01 ‖ hash ‖ running)` and a `"right"` one as `SHA256(0x01 ‖ running ‖ hash)`. The result must equal `root`. |
132
+ >
133
+ > In a batched certificate `mode` is not checked against the chain: the batch record carries neither the proof nor a mode byte.
134
+ >
135
+ > A direct-anchored ECDSA certificate, before its SPV envelope is attached:
136
+ >
137
+ > <!-- fixture: certificates.fullHex -->
138
+ > ```json
139
+ > {
140
+ > "protocol": "NotaryHash",
141
+ > "version": "1.0",
142
+ > "mode": "full",
143
+ > "algorithm": "ECDSA-secp256k1",
144
+ > "hashAlgorithm": "SHA-256",
145
+ > "payloadHash": "97ef50e782e55cfbfbfb0c6199b96837836b7f7b0fcae76f79a65e2466dc596b",
146
+ > "publicKey": "02375ac16df62a74475844721d6a180927f29314c3455eaa699f7dcf5237c36e52",
147
+ > "signature": "e65171edb82a702a8390fb90f005ba3d4e174ab945ab0bcaf5f1f8d18c3547426ca419ea252b142e863d2eeebdfc787a624bed5a06d23a671959b07b5cb12ba3",
148
+ > "encoding": "hex",
149
+ > "proofHash": "1b34fbeb640e63b366751a279aa749e4f279cfb7e1add1a96150d7fd7c2ff05d",
150
+ > "createdAt": "2026-01-01T00:00:00.000Z",
151
+ > "anchor": {
152
+ > "type": "direct",
153
+ > "network": "bsv-mainnet",
154
+ > "txid": "460d19b875036e41d6dea392bfcb84508120e7b573080c45869eedbae39dec6a",
155
+ > "vout": 0,
156
+ > "blockHeight": 900000,
157
+ > "blockTime": 1767225600
158
+ > }
159
+ > }
160
+ > ```
161
+ >
162
+ > The `merkle` member of the last certificate in a five-proof batch:
163
+ >
164
+ > <!-- fixture: batch.certificates[4].merkle -->
165
+ > ```json
166
+ > {
167
+ > "root": "abb53eb3b2e3530d51685c6813bb85c85892d2f214c2dc504029d071434ac074",
168
+ > "leafIndex": 4,
169
+ > "leafCount": 5,
170
+ > "path": [
171
+ > { "hash": "060ca4e4bbcb647ab0162bb027cd8f08c1577aaa7069166dd629a3df7e57befd", "side": "left" }
172
+ > ]
173
+ > }
174
+ > ```
175
+ >
176
+ > The anchoring transactions and blocks in these examples are test fixtures, not mainnet data. Everything else in them verifies: the signature, `proofHash`, the on-chain record in the transaction, and the batch inclusion.
177
+
178
+ ### 2. §SPV envelope — add at the end of the section
179
+
180
+ > `rawTx` is hex, and `blockHash` is hex in display order, like `txid`. In the `"TSC"` format the entries of `merkleProof.nodes` are hex in display order too, and an entry of `"*"` means "duplicate the working hash", the TSC convention for a missing right sibling. The verifier checks that the header it obtained has hash `spv.blockHash` and height `spv.blockHeight`.
181
+
182
+ ---
183
+
184
+ ## What this changes
185
+
186
+ **For writers, nothing.** Every certificate the reference implementation has issued already
187
+ conforms. The text makes explicit what it writes, so that other implementations can write
188
+ the same.
189
+
190
+ **For readers, two rules tighten.** A verifier that accepted a certificate of another
191
+ version, or decoded base64 by skipping what it did not recognise, refuses instead. Neither
192
+ rule refuses anything a conformant writer produces.
193
+
194
+ The canonical proof bytes, `proofHash`, the on-chain record and the verification steps are
195
+ untouched.
196
+
197
+ ---
198
+
199
+ ## Decisions
200
+
201
+ The first draft left six points to the author. Each is decided here, with the reason.
202
+
203
+ 1. **A verifier refuses a `version` it does not implement.** This is in the proposed text.
204
+ The reference wrote `"1.0"` and read anything: a certificate saying `"2.0"` passed its
205
+ schema, its offline verifier, its SPV check and its anchor match. Reading a future
206
+ format with v1 rules gives a verdict about the wrong thing, and a spec that says nothing
207
+ lets every verifier do that. The reference implementation adopts the rule;
208
+ `@smartledger/bsv` has applied it since 9.9.0.
209
+ 2. **A reader refuses base64 that is not base64.** This is in the proposed text. The
210
+ reference decoded with Node's `Buffer.from`, which skips characters outside the alphabet
211
+ and truncates an impossible length, so a corrupted field became different bytes rather
212
+ than an error. That happened at the reference's own request intake too: a notarize
213
+ request with junk spliced into its base64 key was anchored with the junk dropped. The
214
+ URL-safe alphabet and missing padding stay acceptable, because both are unambiguous and
215
+ refusing them would gain nothing. The reference implementation adopts the rule;
216
+ `@smartledger/bsv` has refused bad characters since 9.9.0, and impossible lengths since
217
+ 9.10.0.
218
+ 3. **Hex is written lowercase and unprefixed; upper case and `0x` MAY be read.** This is in
219
+ the proposed text. Both forms are unambiguous, and the reference already reads them.
220
+ 4. **`network` has two defined names and is descriptive.** This is in the proposed text.
221
+ `"bsv-mainnet"` is what the reference writes. `"bsv-testnet"` is reserved, so that
222
+ testnet certificates do not acquire ad-hoc names. It is not a closed set a verifier must
223
+ enforce. The block header the verifier obtains already fixes which chain the anchor is
224
+ on, so a mislabelled `network` cannot make a certificate verify anywhere it is not
225
+ anchored.
226
+ 5. **Certificates already issued in other shapes stay out of the spec.** The table above
227
+ is one implementation's history. That implementation's readers handle it:
228
+ `@smartledger/bsv` reads those certificates and reports them as legacy. A clause in the
229
+ spec would bind every other implementation to the same history.
230
+ 6. **High-S ECDSA is accepted.** This is in the proposed text, as the reference behaves.
231
+ Requiring low-S would reject certificates the reference has already issued, and
232
+ `proofHash` already stops the malleated form from being passed off as the same
233
+ certificate.
234
+
235
+ ---
236
+
237
+ ## Checking the claims
238
+
239
+ ```
240
+ npx mocha test/notaryhash/fields_amendment.js test/notaryhash/reference_certs.js
241
+ ```
242
+
243
+ The first reads the examples out of this document and checks them against the reference's
244
+ own certificates. It also checks that `@smartledger/bsv` applies the reader rules the text
245
+ states. The second verifies all ten reference certificates and rebuilds each one byte for
246
+ byte from its proof fields, using the values defined here.
@@ -31,7 +31,8 @@ writes the reference one given `format: 'reference'` — the default from 10.0.0
31
31
  The gap this draft set out to close is real: BRC-220 lists `encoding` as a required field
32
32
  and never enumerates its values, and says nothing about the JSON form of `version`,
33
33
  `mode`, `anchor` or the batch `path`. A clarification defining those fields **as the
34
- reference writes them** is a separate, later proposal.
34
+ reference writes them** is a separate proposal, drafted in
35
+ [BRC220_CERTIFICATE_FIELDS_AMENDMENT.md](BRC220_CERTIFICATE_FIELDS_AMENDMENT.md).
35
36
 
36
37
  The batch-leaf clarification written alongside this one was correct, and was confirmed
37
38
  against the reference implementation: it was filed as
@@ -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@9.9.0/bsv-shamir.min.js`
58
+ - **CDN**: `unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js` |
85
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.9.0/bsv.bundle.js` |
86
- | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@9.9.0/bsv-smartcontract.min.js` |
87
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.9.0/bsv-covenant.min.js` |
88
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.9.0/bsv-script-helper.min.js` |
89
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.9.0/bsv-security.min.js` |
90
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.9.0/bsv-ecies.min.js` |
91
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.9.0/bsv-message.min.js` |
92
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.9.0/bsv-mnemonic.min.js` |
93
- | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-shamir.min.js` |
94
- | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-gdaf.min.js` |
95
- | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-ltp.min.js` |
84
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.10.0/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@9.10.0/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.10.0/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.10.0/bsv-script-helper.min.js` |
89
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.10.0/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.10.0/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.10.0/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.10.0/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@9.10.0/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@9.10.0/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
104
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-script-helper.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
110
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-covenant.min.js"></script>
111
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-smartcontract.min.js"></script>
109
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
117
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-ltp.min.js"></script>
118
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-gdaf.min.js"></script>
116
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
136
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-security.min.js"></script>
137
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-shamir.min.js"></script>
135
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@9.10.0/bsv.min.js"></script>
726
726
  </head>
727
727
  <body>
728
728
  <script>
@@ -15,7 +15,7 @@ seeking a quote for an independent security review of its cryptographic core.
15
15
 
16
16
  Scope, and we would like these priced separately:
17
17
 
18
- Tier 1 — 11,962 lines. Sighash construction and signing; ECDSA, nonce
18
+ Tier 1 — 11,976 lines. Sighash construction and signing; ECDSA, nonce
19
19
  derivation and signature encoding; the consensus-flag and era surface of the
20
20
  script interpreter; BRC-220 signing; the covenant verification harness; RFC
21
21
  8785 canonicalization; and the covenant-facing entrypoints of the smart
@@ -15,7 +15,7 @@ seeking a quote for an independent security review of its cryptographic core.
15
15
 
16
16
  Scope, and we would like these priced separately:
17
17
 
18
- Tier 1 — 11,962 lines. Sighash construction and signing; ECDSA, nonce
18
+ Tier 1 — 11,976 lines. Sighash construction and signing; ECDSA, nonce
19
19
  derivation and signature encoding; the consensus-flag and era surface of the
20
20
  script interpreter; BRC-220 signing; the covenant verification harness; RFC
21
21
  8785 canonicalization; and the covenant-facing entrypoints of the smart
@@ -15,7 +15,7 @@ seeking a quote for an independent security review of its cryptographic core.
15
15
 
16
16
  Scope, and we would like these priced separately:
17
17
 
18
- Tier 1 — 11,962 lines. Sighash construction and signing; ECDSA, nonce
18
+ Tier 1 — 11,976 lines. Sighash construction and signing; ECDSA, nonce
19
19
  derivation and signature encoding; the consensus-flag and era surface of the
20
20
  script interpreter; BRC-220 signing; the covenant verification harness; RFC
21
21
  8785 canonicalization; and the covenant-facing entrypoints of the smart
@@ -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@9.9.0/bsv.min.js"></script>
51
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
75
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-covenant.min.js"></script>
76
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-smartcontract.min.js"></script>
74
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
86
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-ltp.min.js"></script>
87
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-gdaf.min.js"></script>
85
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
102
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-security.min.js"></script>
103
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-shamir.min.js"></script>
101
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js` |
118
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.9.0/bsv.bundle.js` |
119
- | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.9.0/bsv-smartcontract.min.js` |
120
- | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-ltp.min.js` |
121
- | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-gdaf.min.js` |
122
- | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-shamir.min.js` |
123
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.9.0/bsv-security.min.js` |
124
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.9.0/bsv-mnemonic.min.js` |
125
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.9.0/bsv-ecies.min.js` |
126
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.9.0/bsv-covenant.min.js` |
127
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.9.0/bsv-script-helper.min.js` |
128
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.9.0/bsv-message.min.js` |
117
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.10.0/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.10.0/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@9.10.0/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@9.10.0/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@9.10.0/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.10.0/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.10.0/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.10.0/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.10.0/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.10.0/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
17
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
18
18
 
19
19
  <!-- Everything included (937KB) -->
20
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv.bundle.js"></script>
20
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.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@9.9.0/bsv.min.js"></script>
130
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.min.js"></script>
131
131
 
132
132
  <!-- Smart contracts (937KB) -->
133
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-smartcontract.min.js"></script>
133
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-smartcontract.min.js"></script>
134
134
 
135
135
  <!-- Legal tokens (1.16MB) -->
136
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-ltp.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-ltp.min.js"></script>
137
137
 
138
138
  <!-- Digital identity (1.16MB) -->
139
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-gdaf.min.js"></script>
139
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv-gdaf.min.js"></script>
140
140
 
141
141
  <!-- Everything (937KB) -->
142
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv.bundle.js"></script>
142
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.0/bsv.bundle.js"></script>
143
143
  ```
144
144
 
145
145
  ## ⚡ **Key Advantages**