@smartledger/bsv 9.8.0 → 9.9.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 +94 -0
- package/README.md +19 -19
- package/bsv-gdaf.min.js +59 -59
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +59 -59
- package/bsv.d.ts +340 -0
- package/bsv.min.js +59 -59
- package/docs/AUDIT_SCOPE.md +6 -6
- package/docs/BRC220_BATCH_LEAF_AMENDMENT.md +16 -6
- package/docs/BRC220_ENCODING_AMENDMENT.md +30 -91
- package/docs/BRC220_PLAN.md +39 -34
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/audit-rfq/cure53.txt +1 -1
- package/docs/audit-rfq/ncc-group.txt +1 -1
- package/docs/audit-rfq/trail-of-bits.txt +1 -1
- 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/certificate.js +524 -79
- package/lib/notaryhash/index.js +100 -71
- package/lib/notaryhash/merkle.js +94 -0
- package/lib/notaryhash/script.js +8 -1
- package/lib/notaryhash/suites.js +17 -14
- package/package.json +1 -1
- package/tools/gen-brc220-batch-vector.js +7 -3
- package/version.js +1 -1
package/docs/AUDIT_SCOPE.md
CHANGED
|
@@ -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,
|
|
37
|
+
### Tier 1 — 11,962 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/` |
|
|
44
|
+
| `lib/notaryhash/` | 2,014 | 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,
|
|
153
|
+
Totals reconcile against `lib/`, which is 39,646 lines across 131 files:
|
|
154
154
|
|
|
155
155
|
```
|
|
156
|
-
tier 1 11,
|
|
156
|
+
tier 1 11,962
|
|
157
157
|
tier 2 1,607
|
|
158
158
|
excluded 26,077
|
|
159
159
|
------
|
|
160
|
-
total 39,
|
|
160
|
+
total 39,646
|
|
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,
|
|
231
|
+
Tier 1 — 11,962 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
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
§On-chain record specifies *which* Merkle tree batch mode uses, but never says what goes
|
|
4
4
|
in a leaf. This proposes the definition, with the reasoning that led to it.
|
|
5
5
|
|
|
6
|
-
Prepared 2026-08-17 while implementing BRC-220 in `@smartledger/bsv`.
|
|
7
|
-
|
|
6
|
+
Prepared 2026-08-17 while implementing BRC-220 in `@smartledger/bsv`.
|
|
7
|
+
|
|
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
|
|
10
|
+
it was checked against the BRC-220 reference implementation, whose batcher uses exactly
|
|
11
|
+
this leaf (`leaves = batch.map(e => e.proofHash)`), and the vector below was rebuilt
|
|
12
|
+
without any of this library's code — the root from the reference's own RFC 6962 tree.
|
|
13
|
+
|
|
14
|
+
A companion draft on the `encoding` field was **wrong and has been withdrawn**; see
|
|
15
|
+
[BRC220_ENCODING_AMENDMENT.md](BRC220_ENCODING_AMENDMENT.md).
|
|
8
16
|
|
|
9
17
|
---
|
|
10
18
|
|
|
@@ -104,9 +112,10 @@ states it in `lib/notaryhash/index.js` and enforces it in
|
|
|
104
112
|
`test/notaryhash/batch_leaf.js` — including a test that a tree built over `canonicalBytes`
|
|
105
113
|
is rejected, so the choice is checked rather than merely intended.
|
|
106
114
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
The reference implementation uses the same reading, so certificates its service has
|
|
116
|
+
issued in batch mode already conform. An implementation that chose `d = canonicalBytes`
|
|
117
|
+
built against an ambiguous sentence and would need to reissue; the second root published
|
|
118
|
+
below makes that diagnosable in one line.
|
|
110
119
|
|
|
111
120
|
---
|
|
112
121
|
|
|
@@ -129,7 +138,8 @@ regenerates byte-identically and any implementation can rebuild it from scratch:
|
|
|
129
138
|
- private key `i` = `SHA-256("BRC-220/batch-vector/key/" + i)`
|
|
130
139
|
- `payloadHash` `i` = `SHA-256("BRC-220/batch-vector/payload/" + i)`
|
|
131
140
|
- `createdAt` `i` = `2026-01-0(i+1)T00:00:00.000Z`
|
|
132
|
-
- `algorithm` = `ECDSA-secp256k1`, `hashAlgorithm` = `SHA-256`, `
|
|
141
|
+
- `algorithm` = `ECDSA-secp256k1`, `hashAlgorithm` = `SHA-256`, a 64-byte `r ‖ s`
|
|
142
|
+
signature normalised to low-S, and a 33-byte compressed public key
|
|
133
143
|
|
|
134
144
|
**Signing.** The signer signs the 32-byte `payloadHash` directly — the digest *is* the
|
|
135
145
|
scalar, big-endian. RFC 6979 makes the nonce deterministic, so the signatures, and every
|
|
@@ -1,100 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Withdrawn: proposed BRC-220 `encoding` amendment
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
enumerated. This proposes the definition, with the reasoning that led to it.
|
|
3
|
+
**This proposal was wrong and has been withdrawn. It was never filed.**
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
It proposed defining the certificate's `encoding` field as `"raw"` or `"der"` — the
|
|
6
|
+
signature's byte format — and requiring ECDSA signatures to be low-S, with a 33-byte
|
|
7
|
+
compressed public key. It was written from this library's implementation alone.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Checked against the BRC-220 reference implementation before filing, it contradicted
|
|
10
|
+
it on every point:
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
| | this proposal | reference implementation |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| `encoding` means | the signature's byte format | how `publicKey` and `signature` are written into the JSON |
|
|
15
|
+
| `encoding` values | `"raw"`, `"der"` | `"hex"`, `"base64"` |
|
|
16
|
+
| signature bytes | 64-byte `r ‖ s` only, DER discouraged | 64-byte `r ‖ s` or DER, told apart by the bytes |
|
|
17
|
+
| high-S signatures | rejected | accepted, deliberately |
|
|
18
|
+
| public keys | 33-byte compressed | 33-byte compressed or 65-byte uncompressed |
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
Every certificate the reference service has issued uses `"hex"` or `"base64"`. Filing
|
|
21
|
+
this would have proposed a spec change incompatible with all of them.
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
> Implementations **MUST** support `"raw"` and **SHOULD** emit it:
|
|
21
|
-
>
|
|
22
|
-
> - **`"raw"`** — the scheme's native fixed-length byte string.
|
|
23
|
-
> - For `ECDSA-secp256k1`, a signature is exactly **64 bytes**: `r ‖ s`, each a 32-byte
|
|
24
|
-
> big-endian unsigned integer, zero-padded on the left. A public key is the 33-byte
|
|
25
|
-
> compressed SEC1 form.
|
|
26
|
-
> - For `ML-DSA-*` and `SLH-DSA-*`, the signature and public key are the byte strings the
|
|
27
|
-
> scheme itself defines (FIPS 204, FIPS 205). No further framing is applied.
|
|
28
|
-
> - **`"der"`** — ECDSA signatures in ASN.1 DER, as produced by Bitcoin tooling.
|
|
29
|
-
> Accepted for compatibility with existing Bitcoin-native signers; **SHOULD NOT** be
|
|
30
|
-
> emitted by new implementations, for the reason given below. Undefined for post-quantum
|
|
31
|
-
> algorithms, which have no DER form.
|
|
32
|
-
>
|
|
33
|
-
> For `ECDSA-secp256k1`, `s` **MUST** be in the lower half of the curve order
|
|
34
|
-
> (`s ≤ n/2`). A signature with a high `s` **MUST** be rejected rather than normalised on
|
|
35
|
-
> receipt: normalising changes the signature bytes, and the signature bytes are inside
|
|
36
|
-
> `proofHash`.
|
|
23
|
+
It also exposed that `@smartledger/bsv` 8.3.0–9.8.0 could not verify a single
|
|
24
|
+
certificate the reference issued: its `version`, `mode`, `encoding`, `anchor` and batch
|
|
25
|
+
`path` fields all differed. The library now reads both formats, and
|
|
26
|
+
writes the reference one given `format: 'reference'` — the default from 10.0.0. See
|
|
27
|
+
`lib/notaryhash/certificate.js`.
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
## What is still true
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
The gap this draft set out to close is real: BRC-220 lists `encoding` as a required field
|
|
32
|
+
and never enumerates its values, and says nothing about the JSON form of `version`,
|
|
33
|
+
`mode`, `anchor` or the batch `path`. A clarification defining those fields **as the
|
|
34
|
+
reference writes them** is a separate, later proposal.
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Measured over 200 signatures from a single key with `@smartledger/bsv`:
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
DER lengths: { "69": 1, "70": 108, "71": 91 }
|
|
50
|
-
raw lengths: { "64": 200 }
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
The variance is ordinary leading-zero handling in the two INTEGERs, and it is entirely
|
|
54
|
-
legal DER. But it means the same signing act can yield different `proofHash` values
|
|
55
|
-
depending on which library encoded it — and a certificate re-encoded in transit no longer
|
|
56
|
-
matches its own integrity root.
|
|
57
|
-
|
|
58
|
-
That is the property §Motivation names first: *"any implementation in any language
|
|
59
|
-
reproduces identical bytes"*, and the reason the spec already rejects `JSON.stringify`.
|
|
60
|
-
A non-canonical signature encoding reintroduces exactly the problem the binary encoding was
|
|
61
|
-
chosen to avoid.
|
|
62
|
-
|
|
63
|
-
### 2. Every other algorithm in the spec is already raw
|
|
64
|
-
|
|
65
|
-
ML-DSA-65 signatures are 3,309 bytes; SLH-DSA-SHA2-128s are 7,856. Both are fixed-length
|
|
66
|
-
byte strings with no DER form. With ECDSA on DER and the post-quantum schemes on raw,
|
|
67
|
-
every verifier needs per-algorithm branching on `encoding`. With ECDSA on raw, all sixteen
|
|
68
|
-
algorithm identifiers share one representation and the branch disappears.
|
|
69
|
-
|
|
70
|
-
### 3. It matches what the signature actually is
|
|
71
|
-
|
|
72
|
-
§Algorithms specifies that the signer signs the 32-byte `payloadHash` **directly**. This is
|
|
73
|
-
a detached signature over a digest, not a Bitcoin script signature — the case ES256K
|
|
74
|
-
(RFC 7515) and WebCrypto both address, and both use `r ‖ s`, not DER.
|
|
75
|
-
|
|
76
|
-
### 4. Low-S is a separate malleability, and raw does not fix it
|
|
77
|
-
|
|
78
|
-
For any ECDSA signature, `s` and `n − s` both verify. They are different bytes, so they
|
|
79
|
-
produce different `proofHash` values. Without a normative rule, two valid certificates
|
|
80
|
-
exist for one signing act — an ambiguity a notarization protocol should not carry.
|
|
81
|
-
|
|
82
|
-
Requiring low-S at signing, and **rejecting** rather than normalising on receipt, keeps
|
|
83
|
-
`proofHash` a function of the certificate as issued.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Note on `toCompact`
|
|
88
|
-
|
|
89
|
-
Some Bitcoin libraries expose a 65-byte "compact" signature. That is not this format: it
|
|
90
|
-
carries a leading recovery byte for public-key recovery. `"raw"` is the bare 64 bytes,
|
|
91
|
-
with no recovery byte, because the public key is already a certificate field.
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Impact on existing certificates
|
|
96
|
-
|
|
97
|
-
None, if no certificate has yet been issued with `encoding: "der"`. If any have, they
|
|
98
|
-
remain valid — `"der"` stays an accepted value, and the SPV envelope and `proofHash`
|
|
99
|
-
semantics are untouched. This amendment defines a field that was previously unspecified;
|
|
100
|
-
it does not change any field that was.
|
|
36
|
+
The batch-leaf clarification written alongside this one was correct, and was confirmed
|
|
37
|
+
against the reference implementation: it was filed as
|
|
38
|
+
[bsv-blockchain/BRCs#246](https://github.com/bsv-blockchain/BRCs/pull/246). See
|
|
39
|
+
[BRC220_BATCH_LEAF_AMENDMENT.md](BRC220_BATCH_LEAF_AMENDMENT.md).
|
package/docs/BRC220_PLAN.md
CHANGED
|
@@ -173,45 +173,44 @@ summarising rather than anything in the document.
|
|
|
173
173
|
- **The service is a role, not a requirement.** §What a certificate proves: "any party
|
|
174
174
|
holding a valid (hash, signature, publicKey) triple may re-anchor it; the attestation
|
|
175
175
|
remains valid". A self-notarizing caller producing its own certificate is conformant.
|
|
176
|
-
- **The batch Merkle leaf is NOT settled by the spec
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
`
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
[
|
|
184
|
-
|
|
176
|
+
- **The batch Merkle leaf is NOT settled by the spec.** §On-chain record writes
|
|
177
|
+
`leaf = SHA256(0x00 ‖ d)`, but that is RFC 6962's own generic notation for the
|
|
178
|
+
construction and `d` is never bound to a value. `canonicalBytes` appears once in the whole
|
|
179
|
+
document, in the `proofHash` definition, and nowhere in the batch text. We read `d` as
|
|
180
|
+
`proofHash`; so does the reference implementation's batcher, and given the same five
|
|
181
|
+
proofs it builds the same root. Reading it as `canonicalBytes` is equally sound and
|
|
182
|
+
produces a different root, so the two do not interoperate. Filed upstream as
|
|
183
|
+
[bsv-blockchain/BRCs#246](https://github.com/bsv-blockchain/BRCs/pull/246); see
|
|
184
|
+
[BRC220_BATCH_LEAF_AMENDMENT.md](BRC220_BATCH_LEAF_AMENDMENT.md), enforced in
|
|
185
|
+
`test/notaryhash/batch_leaf.js`.
|
|
185
186
|
- **`createdAt` is advisory for trust but load-bearing for the hash.** §Verification calls
|
|
186
187
|
it "an advisory client field only" — meaning proof-of-existence time comes from the
|
|
187
188
|
block, not from this field. It is still inside the canonical bytes as `createdAtUnix`,
|
|
188
189
|
so it cannot be altered after issuance.
|
|
189
190
|
|
|
190
|
-
Decided,
|
|
191
|
+
Decided here, then reversed against the reference implementation:
|
|
191
192
|
|
|
192
|
-
- **`encoding`
|
|
193
|
-
|
|
194
|
-
`
|
|
193
|
+
- **`encoding` was defined as `"raw"` — the signature's byte format — and low-S was
|
|
194
|
+
required.** Both were wrong. The spec requires the field without enumerating its values,
|
|
195
|
+
and 8.3.0–9.8.0 filled that gap from this library's own reasoning: raw `r ‖ s` because DER
|
|
196
|
+
is not canonical, low-S because `s` and `n − s` both verify and hash differently.
|
|
195
197
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
198
|
+
The reference implementation, which is what issued certificates are checked against,
|
|
199
|
+
decided otherwise on every point. `encoding` is `"hex"` or `"base64"` — how `publicKey`
|
|
200
|
+
and `signature` are written into the JSON, not what their bytes are. A signature may be
|
|
201
|
+
64-byte `r ‖ s` or DER, told apart by the bytes. A public key may be compressed or
|
|
202
|
+
uncompressed. High-S is accepted deliberately.
|
|
199
203
|
|
|
200
|
-
The
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
The reasoning behind the reversal holds: `proofHash` covers the signature bytes exactly
|
|
205
|
+
as the signer produced them, so a DER or malleated form is a *different* certificate,
|
|
206
|
+
not a forgery of this one. What the original argument protected against — two
|
|
207
|
+
certificates for one signing act — is real, but it is the issuer's choice to make, and
|
|
208
|
+
every certificate still commits to exactly one form.
|
|
205
209
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
**Low-S is required and must be rejected, not normalised.** `s` and `n − s` both verify
|
|
212
|
-
and hash differently, so without the rule two valid certificates exist for one signing
|
|
213
|
-
act. Normalising on receipt would change the signature bytes, which are inside
|
|
214
|
-
`proofHash`. This library already emits low-S and has `Signature.toCanonical()`.
|
|
210
|
+
The library now reads both formats and writes the reference one given
|
|
211
|
+
`format: 'reference'`. Per STABILITY.md the default stays the old format through 9.x,
|
|
212
|
+
with a one-time notice, and becomes 'reference' in 10.0.0. The proposed amendment
|
|
213
|
+
(`docs/BRC220_ENCODING_AMENDMENT.md`) was withdrawn before filing.
|
|
215
214
|
|
|
216
215
|
### The reference implementation
|
|
217
216
|
|
|
@@ -220,10 +219,16 @@ Decided, and proposed back to the spec:
|
|
|
220
219
|
`txidFromRawTx` against the Bitcoin genesis coinbase, and the Merkle fold against the real
|
|
221
220
|
block-170 two-transaction proof.
|
|
222
221
|
|
|
223
|
-
Those vectors are worth more than anything in §6
|
|
224
|
-
|
|
225
|
-
—
|
|
226
|
-
|
|
222
|
+
Those vectors are worth more than anything in §6. This module's characteristic failure is
|
|
223
|
+
being self-consistent and wrong — every local test green, no other implementation agreeing
|
|
224
|
+
— and a golden vector from a second implementation is the only thing that actually rules
|
|
225
|
+
it out. Our own tests cannot.
|
|
226
|
+
|
|
227
|
+
That is exactly how it went. Until the reference was checked, every test here passed and
|
|
228
|
+
this library could not verify one certificate the reference had issued: the cryptography
|
|
229
|
+
agreed and the JSON did not. `test/notaryhash/reference_certs.js` now verifies certificates
|
|
230
|
+
the reference produced — full and hybrid, hex and base64, DER, high-S, an uncompressed key,
|
|
231
|
+
and a five-leaf batch — and rebuilds each one byte for byte.
|
|
227
232
|
|
|
228
233
|
## 8. Not in scope
|
|
229
234
|
|
|
@@ -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.
|
|
58
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@9.9.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.
|
|
64
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@9.9.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.
|
|
70
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@9.9.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.
|
|
85
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.
|
|
86
|
-
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@9.
|
|
87
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.
|
|
88
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.
|
|
89
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.
|
|
90
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.
|
|
91
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.
|
|
92
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.
|
|
93
|
-
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@9.
|
|
94
|
-
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@9.
|
|
95
|
-
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@9.
|
|
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` |
|
|
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.
|
|
104
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
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>
|
|
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.
|
|
110
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
111
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
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>
|
|
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.
|
|
117
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
118
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
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>
|
|
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.
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
137
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
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>
|
|
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.
|
|
149
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.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.
|
|
725
|
+
<script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@9.9.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,
|
|
18
|
+
Tier 1 — 11,962 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,
|
|
18
|
+
Tier 1 — 11,962 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,
|
|
18
|
+
Tier 1 — 11,962 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.
|
|
51
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.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.
|
|
61
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.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.
|
|
75
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
76
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
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>
|
|
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.
|
|
86
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
87
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
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>
|
|
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.
|
|
102
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
103
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
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>
|
|
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.
|
|
118
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.
|
|
119
|
-
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.
|
|
120
|
-
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@9.
|
|
121
|
-
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@9.
|
|
122
|
-
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@9.
|
|
123
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.
|
|
124
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.
|
|
125
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.
|
|
126
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.
|
|
127
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.
|
|
128
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.
|
|
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` |
|
|
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.
|
|
17
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv.min.js"></script>
|
|
18
18
|
|
|
19
19
|
<!-- Everything included (937KB) -->
|
|
20
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
20
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.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.
|
|
130
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv.min.js"></script>
|
|
131
131
|
|
|
132
132
|
<!-- Smart contracts (937KB) -->
|
|
133
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
133
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-smartcontract.min.js"></script>
|
|
134
134
|
|
|
135
135
|
<!-- Legal tokens (1.16MB) -->
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-ltp.min.js"></script>
|
|
137
137
|
|
|
138
138
|
<!-- Digital identity (1.16MB) -->
|
|
139
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
139
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv-gdaf.min.js"></script>
|
|
140
140
|
|
|
141
141
|
<!-- Everything (937KB) -->
|
|
142
|
-
<script src="https://unpkg.com/@smartledger/bsv@9.
|
|
142
|
+
<script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv.bundle.js"></script>
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
## ⚡ **Key Advantages**
|