bsv-sdk 0.7.0 → 0.8.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +406 -146
  3. data/lib/bsv/identity/client.rb +11 -5
  4. data/lib/bsv/overlay/topic_broadcaster.rb +1 -3
  5. data/lib/bsv/primitives/openssl_ec_shim.rb +8 -4
  6. data/lib/bsv/primitives/secp256k1.rb +11 -1
  7. data/lib/bsv/transaction/beef.rb +45 -38
  8. data/lib/bsv/transaction/merkle_path.rb +64 -0
  9. data/lib/bsv/transaction/transaction.rb +3 -2
  10. data/lib/bsv/version.rb +1 -1
  11. metadata +2 -32
  12. data/lib/bsv/attest/configuration.rb +0 -9
  13. data/lib/bsv/attest/response.rb +0 -19
  14. data/lib/bsv/attest/verification_error.rb +0 -7
  15. data/lib/bsv/attest/version.rb +0 -7
  16. data/lib/bsv/attest.rb +0 -71
  17. data/lib/bsv/wallet_interface/chain_provider.rb +0 -37
  18. data/lib/bsv/wallet_interface/errors/invalid_hmac_error.rb +0 -11
  19. data/lib/bsv/wallet_interface/errors/invalid_parameter_error.rb +0 -14
  20. data/lib/bsv/wallet_interface/errors/invalid_signature_error.rb +0 -11
  21. data/lib/bsv/wallet_interface/errors/unsupported_action_error.rb +0 -11
  22. data/lib/bsv/wallet_interface/errors/wallet_error.rb +0 -14
  23. data/lib/bsv/wallet_interface/file_store.rb +0 -222
  24. data/lib/bsv/wallet_interface/interface.rb +0 -384
  25. data/lib/bsv/wallet_interface/key_deriver.rb +0 -144
  26. data/lib/bsv/wallet_interface/local_proof_store.rb +0 -42
  27. data/lib/bsv/wallet_interface/memory_store.rb +0 -149
  28. data/lib/bsv/wallet_interface/null_chain_provider.rb +0 -22
  29. data/lib/bsv/wallet_interface/proof_store.rb +0 -32
  30. data/lib/bsv/wallet_interface/proto_wallet.rb +0 -361
  31. data/lib/bsv/wallet_interface/storage_adapter.rb +0 -71
  32. data/lib/bsv/wallet_interface/validators.rb +0 -126
  33. data/lib/bsv/wallet_interface/version.rb +0 -7
  34. data/lib/bsv/wallet_interface/wallet_client.rb +0 -874
  35. data/lib/bsv/wallet_interface/wire/reader.rb +0 -238
  36. data/lib/bsv/wallet_interface/wire/serializer.rb +0 -1993
  37. data/lib/bsv/wallet_interface/wire/writer.rb +0 -214
  38. data/lib/bsv/wallet_interface/wire.rb +0 -19
  39. data/lib/bsv/wallet_interface.rb +0 -31
  40. data/lib/bsv-attest.rb +0 -4
  41. data/lib/bsv-wallet.rb +0 -4
data/CHANGELOG.md CHANGED
@@ -2,230 +2,482 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ This repository ships two gems with independent versioning:
6
+
7
+ - **`bsv-sdk`** — the declarative SDK (primitives, script, transaction, etc.)
8
+ - **`bsv-wallet`** — the BRC-100 wallet interface gem (depends on `bsv-sdk`)
9
+
10
+ The two gems may release on different schedules. Section headers identify
11
+ which gem(s) released, e.g.:
12
+
13
+ - `## sdk-0.7.0 / wallet-0.3.0 — 2026-04-06` — both gems released together
14
+ - `## sdk-0.6.1 — 2026-04-05` — sdk-only release
15
+ - `## wallet-0.3.3 — 2026-04-06` — wallet-only release
16
+
17
+ Every bullet is prefixed with `[sdk]` or `[wallet]` to disambiguate which gem
18
+ the change belongs to, regardless of which header it sits under.
19
+
5
20
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
21
+ and each gem adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
22
+ independently.
23
+
24
+ ## sdk-0.8.0 — 2026-04-08
25
+
26
+ ### Added
27
+
28
+ - [sdk] **`MerklePath.from_tsc`** — convert WhatsOnChain TSC merkle proofs
29
+ (the flat leaf-to-root sibling list returned by
30
+ `/tx/{txid}/proof/tsc`) into BRC-74 BUMP format. Verified end-to-end
31
+ against a real mainnet vector (block 612251). Closes #280.
32
+ - [sdk] **`Beef#version=`** writer — promoted from internal
33
+ `instance_variable_set` to a proper accessor.
34
+
35
+ ### Changed
36
+
37
+ - [sdk] **`Beef#to_binary` rewrite** — serialises BUMPs from the canonical
38
+ `@bumps` array and uses `beef_tx.bump_index` as the on-wire reference,
39
+ instead of walking each transaction's `merkle_path` via object identity.
40
+ Fixes duplicate-BUMP serialisation for same-block ancestors that
41
+ previously caused ARC `468 BEEF invalid` rejections. Matches the TS and
42
+ Go reference SDKs. Closes #288.
43
+ - [sdk] **`Beef#to_hex`** preserves the bundle's `@version` so a BEEF
44
+ parsed from V2 round-trips to V2 hex (and V1 to V1) instead of always
45
+ silently downgrading to V1. The original docstring already claimed
46
+ "V2 hex string" — this fix matches the original intent. Closes #292.
47
+ - [sdk] **`Beef#initialize`** default `version:` parameter changed from
48
+ `BEEF_V2` to `BEEF_V1` to match `to_binary`'s default. Every existing
49
+ `Beef.new + to_hex` caller continues to emit V1 (preserving every
50
+ existing observable behaviour). Closes #292.
51
+ - [sdk] **`bsv-sdk` gem packaging** — explicit module list in
52
+ `bsv-sdk.gemspec` excludes `bsv-attest` and `bsv-wallet` code. Reduces
53
+ `bsv-sdk` from 144 files to 98 (24% smaller); no overlap with the
54
+ sibling gems except `LICENSE`.
55
+ - [sdk] `Transaction#to_beef` docstring corrected from "BEEF V2 binary
56
+ bundle" to "BEEF V1 binary bundle (BRC-62)" to match what the method
57
+ actually emits.
58
+
59
+ ### Fixed
60
+
61
+ - [sdk] **`Beef#to_binary`** raises `ArgumentError` upfront when V1
62
+ (BRC-62) is requested for a bundle containing `FORMAT_TXID_ONLY`
63
+ entries, instead of crashing deep inside `write_v1_tx` with
64
+ `NoMethodError`. V2 (BRC-96) supports TXID-only and is unaffected. The
65
+ error message points the caller at `version: BEEF_V2`. Closes #290.
66
+ - [sdk] **`Beef#merge`** raises `ArgumentError` on inconsistent
67
+ `bump_index` from the source bundle (when the source has a transaction
68
+ pointing at a `bump_index` that doesn't exist in the source's
69
+ `@bumps`), instead of silently propagating a stale index that could
70
+ attach the wrong merkle path to a transaction in the merged bundle.
71
+ Closes #291.
72
+ - [sdk] **`Beef::BeefTx#initialize`** validates that
73
+ `FORMAT_RAW_TX_AND_BUMP` requires a non-nil `bump_index`, failing fast
74
+ in the constructor instead of crashing later in `VarInt.encode(nil)`.
75
+ - [sdk] **`Beef#merge_raw_tx`** bounds-checks the `bump_index` parameter
76
+ and raises `ArgumentError` if out of range, instead of silently writing
77
+ an invalid index that downstream parsers would misinterpret.
78
+
79
+ ### Internal
80
+
81
+ - [sdk] CI is now green: 73 pre-existing RuboCop offenses across
82
+ `spec/conformance/openssl_shim_compliance/` resolved. Closes #293.
83
+ - [sdk] OpenSSL EC shim conformance suite is now skipped on Ruby 2.7,
84
+ where stock `OpenSSL::PKey::EC::Point#add` is unavailable. The shim
85
+ itself still has direct unit-test coverage on every supported Ruby.
86
+
87
+ ## wallet-0.3.3 — 2026-04-06
88
+
89
+ ### Fixed
90
+
91
+ - [wallet] `finalize_action` now stores the spending transaction so subsequent
92
+ `internalize_action` / proof resolution flows can find it. Previously the
93
+ wallet remembered the inputs and outputs but not the finalised tx itself.
94
+
95
+ ## wallet-0.3.2 — 2026-04-06
96
+
97
+ ### Fixed
98
+
99
+ - [wallet] `internalize_action` now stores **all** transactions from the
100
+ incoming BEEF, not just the proven ones. Unproven ancestors are needed for
101
+ later BEEF reconstruction in `create_action` → `to_beef`.
102
+
103
+ ## wallet-0.3.1 — 2026-04-06
104
+
105
+ ### Fixed
7
106
 
8
- ## [0.7.0] - 2026-04-06
107
+ - [wallet] `internalize_action` now stores the subject transaction hex (not
108
+ just its proof and outputs), so the wallet can rebuild BEEF for spends of
109
+ the inbound outputs without re-fetching the tx.
110
+
111
+ ## sdk-0.7.0 / wallet-0.3.0 — 2026-04-06
9
112
 
10
113
  ### Added
11
114
 
12
- - **Wallet** — pluggable proof store for merkle proof persistence. The wallet is now a lightweight SPV node: `internalize_action` extracts and stores merkle proofs from incoming BEEF; `create_action` reattaches them to produce valid BEEF with BUMPs for ARC broadcast.
13
- - `ProofStore` interface with `store_proof` / `resolve_proof`
14
- - `LocalProofStore` default implementation using `StorageAdapter`
15
- - `WalletClient` accepts injectable `proof_store:` parameter
16
- - Transaction caching (`store_transaction` / `find_transaction`) for ancestry reconstruction
17
- - **Wallet** — `StorageAdapter` gains `store_proof`, `find_proof`, `store_transaction`, `find_transaction` methods, implemented in both `MemoryStore` and `FileStore`.
115
+ - [wallet] **Pluggable proof store** for merkle proof persistence. The wallet
116
+ is now a lightweight SPV node: `internalize_action` extracts and stores
117
+ merkle proofs from incoming BEEF; `create_action` reattaches them to
118
+ produce valid BEEF with BUMPs for ARC broadcast.
119
+ - `ProofStore` interface with `store_proof` / `resolve_proof`.
120
+ - `LocalProofStore` default implementation using `StorageAdapter`.
121
+ - `WalletClient` accepts injectable `proof_store:` parameter.
122
+ - Transaction caching (`store_transaction` / `find_transaction`) for
123
+ ancestry reconstruction.
124
+ - [wallet] `StorageAdapter` gains `store_proof`, `find_proof`,
125
+ `store_transaction`, `find_transaction` methods, implemented in both
126
+ `MemoryStore` and `FileStore`.
18
127
 
19
128
  ### Changed
20
129
 
21
- - **Transaction** `Beef#to_binary` now defaults to BEEF V1 (BRC-62) format, matching the TS reference SDK's `Transaction#toBEEF()`. ARC's parser does not support V2. Pass `version: BEEF_V2` for BRC-96 format. Atomic BEEF (BRC-95) inner envelope remains V2 per spec.
130
+ - [sdk] `Beef#to_binary` now defaults to BEEF V1 (BRC-62) format, matching
131
+ the TS reference SDK's `Transaction#toBEEF()`. ARC's parser does not
132
+ support V2. Pass `version: BEEF_V2` for BRC-96 format. Atomic BEEF (BRC-95)
133
+ inner envelope remains V2 per spec.
22
134
 
23
135
  ### Fixed
24
136
 
25
- - **Wallet** `wire_source_from_storage` resolves merkle proofs via proof store so `to_beef` produces valid BEEF that ARC accepts. Previously, BEEF contained source transactions without proofs, causing ARC 463/468 rejections.
137
+ - [wallet] `wire_source_from_storage` resolves merkle proofs via proof store
138
+ so `to_beef` produces valid BEEF that ARC accepts. Previously, BEEF
139
+ contained source transactions without proofs, causing ARC 463/468
140
+ rejections.
141
+
142
+ ## wallet-0.2.2 — 2026-04-06
143
+
144
+ ### Fixed
26
145
 
27
- ## [0.6.2] - 2026-04-06
146
+ - [wallet] `to_beef` now includes source transactions in the BEEF output, not
147
+ just the subject transaction. Without ancestors, ARC could not validate the
148
+ spend graph.
149
+
150
+ ## sdk-0.6.2 / wallet-0.2.1 — 2026-04-06
28
151
 
29
152
  ### Added
30
153
 
31
- - **Wallet** `WalletClient#create_action` now accepts `UnlockingScriptTemplate` objects (e.g. `P2PKH`) as input unlocking scripts, enabling template-based signing without BEEF.
32
- - **Wallet** `wire_source_from_storage` fallback populates `source_satoshis` and `source_locking_script` from wallet storage when BEEF is absent or incomplete, enabling BIP-143 sighash computation for wallet-tracked outputs.
33
- - **Wallet** — `finalize_action` resolves template inputs via `sign_all` before serialisation.
34
- - **Storage** `MemoryStore#filter_outputs` supports outpoint filtering for efficient single-output lookups.
154
+ - [wallet] `WalletClient#create_action` now accepts `UnlockingScriptTemplate`
155
+ objects (e.g. `P2PKH`) as input unlocking scripts, enabling template-based
156
+ signing without BEEF.
157
+ - [wallet] `wire_source_from_storage` fallback populates `source_satoshis`
158
+ and `source_locking_script` from wallet storage when BEEF is absent or
159
+ incomplete, enabling BIP-143 sighash computation for wallet-tracked
160
+ outputs.
161
+ - [wallet] `finalize_action` resolves template inputs via `sign_all` before
162
+ serialisation.
163
+ - [wallet] `MemoryStore#filter_outputs` supports outpoint filtering for
164
+ efficient single-output lookups.
165
+
166
+ The sdk gem was re-released alongside this wallet change with no
167
+ behavioural changes of its own.
35
168
 
36
- ## [0.6.1] - 2026-04-05
169
+ ## sdk-0.6.1 2026-04-05
37
170
 
38
171
  ### Fixed
39
172
 
40
- - **Transaction** use internal byte order for Atomic BEEF subject txid lookup, fixing serialisation of transactions loaded from Atomic BEEF format.
173
+ - [sdk] Use internal byte order for Atomic BEEF subject txid lookup, fixing
174
+ serialisation of transactions loaded from Atomic BEEF format.
41
175
 
42
- ## [0.6.0] - 2026-04-04
176
+ ## sdk-0.6.0 2026-04-04
43
177
 
44
178
  ### Added
45
179
 
46
180
  #### Primitives
47
181
 
48
- - **Pure Ruby secp256k1** — native Ruby implementation of secp256k1 elliptic curve operations, ported from the TypeScript reference SDK. Replaces OpenSSL's EC point arithmetic with an OpenSSL compatibility shim — zero consumer code changes required. See [docs/about/secp256k1.md](docs/about/secp256k1.md).
49
- - Field arithmetic (modular multiplication, inversion, square root) over the secp256k1 prime.
50
- - Jacobian coordinate point operations (addition, doubling, scalar multiplication).
182
+ - [sdk] **Pure Ruby secp256k1** — native Ruby implementation of secp256k1
183
+ elliptic curve operations, ported from the TypeScript reference SDK.
184
+ Replaces OpenSSL's EC point arithmetic with an OpenSSL compatibility shim
185
+ — zero consumer code changes required. See
186
+ [docs/about/secp256k1.md](docs/about/secp256k1.md).
187
+ - Field arithmetic (modular multiplication, inversion, square root) over
188
+ the secp256k1 prime.
189
+ - Jacobian coordinate point operations (addition, doubling, scalar
190
+ multiplication).
51
191
  - Windowed-NAF (w=5) scalar multiplication with precomputed table caching.
52
192
  - SEC 1 point serialisation (compressed and uncompressed).
53
193
  - 126 byte-for-byte compliance specs against real OpenSSL.
54
- - 24 process-isolated integration tests (separate Ruby processes, MD5 file comparison).
194
+ - 24 process-isolated integration tests (separate Ruby processes, MD5
195
+ file comparison).
55
196
 
56
197
  #### Registry
57
198
 
58
- - **Registry client** — `BSV::Registry` module for on-chain definition management.
59
- - `Client` — register, resolve, list, revoke, and update definitions for protocols, baskets, and certificate types via PushDrop tokens on the overlay network.
60
- - Per-type overlay topics (`tm_basketmap`, `tm_protomap`, `tm_certmap`) and lookup services matching TS and Go SDKs.
61
- - Types: `BasketDefinitionData`, `ProtocolDefinitionData`, `CertificateDefinitionData`, `CertificateFieldDescriptor`, `RegisteredDefinition`.
62
- - Ownership verification before revocation. BEEF Array/String normalisation for wire format compatibility.
199
+ - [sdk] **Registry client** — `BSV::Registry` module for on-chain definition
200
+ management.
201
+ - `Client` register, resolve, list, revoke, and update definitions for
202
+ protocols, baskets, and certificate types via PushDrop tokens on the
203
+ overlay network.
204
+ - Per-type overlay topics (`tm_basketmap`, `tm_protomap`, `tm_certmap`)
205
+ and lookup services matching TS and Go SDKs.
206
+ - Types: `BasketDefinitionData`, `ProtocolDefinitionData`,
207
+ `CertificateDefinitionData`, `CertificateFieldDescriptor`,
208
+ `RegisteredDefinition`.
209
+ - Ownership verification before revocation. BEEF Array/String
210
+ normalisation for wire format compatibility.
63
211
 
64
212
  ### Changed
65
213
 
66
- - **OpenSSL usage reduced** — OpenSSL now used only for hashing (SHA/RIPEMD), HMAC, PBKDF2, AES, and constant-time comparison. Elliptic curve operations are pure Ruby.
214
+ - [sdk] OpenSSL usage reduced — OpenSSL now used only for hashing
215
+ (SHA/RIPEMD), HMAC, PBKDF2, AES, and constant-time comparison. Elliptic
216
+ curve operations are pure Ruby.
67
217
 
68
- ## [0.5.0] - 2026-04-04
218
+ ## sdk-0.5.0 2026-04-04
69
219
 
70
220
  ### Added
71
221
 
72
222
  #### Overlay
73
223
 
74
- - **SHIP/SLAP overlay services** — `BSV::Overlay` module for topic-based transaction broadcasting and service discovery.
75
- - `TopicBroadcaster` (aliased as `SHIPBroadcaster`) — broadcasts tagged BEEF to topic-interested hosts with configurable acknowledgement modes (all/any/specific hosts) and STEAK response parsing.
76
- - `LookupResolver` discovers competent hosts via SLAP trackers, queries in parallel, aggregates and deduplicates results. TTL-based host caching.
77
- - `HostReputationTracker` EWMA latency scoring with exponential backoff, DNS error escalation, thread-safe. Optional persistence via injectable store adapter.
78
- - `AdminTokenTemplate` — decode/lock/unlock for SHIP/SLAP advertisement PushDrop tokens with BRC-42 wallet key derivation.
79
- - Abstract base classes (`LookupFacilitator`, `BroadcastFacilitator`) with default HTTPS implementations all dependencies injectable via constructor.
80
- - SSRF protection for SLAP-discovered domains (private/loopback IP rejection).
224
+ - [sdk] **SHIP/SLAP overlay services** — `BSV::Overlay` module for
225
+ topic-based transaction broadcasting and service discovery.
226
+ - `TopicBroadcaster` (aliased as `SHIPBroadcaster`) broadcasts tagged
227
+ BEEF to topic-interested hosts with configurable acknowledgement modes
228
+ (all/any/specific hosts) and STEAK response parsing.
229
+ - `LookupResolver` discovers competent hosts via SLAP trackers, queries
230
+ in parallel, aggregates and deduplicates results. TTL-based host
231
+ caching.
232
+ - `HostReputationTracker` — EWMA latency scoring with exponential
233
+ backoff, DNS error escalation, thread-safe. Optional persistence via
234
+ injectable store adapter.
235
+ - `AdminTokenTemplate` — decode/lock/unlock for SHIP/SLAP advertisement
236
+ PushDrop tokens with BRC-42 wallet key derivation.
237
+ - Abstract base classes (`LookupFacilitator`, `BroadcastFacilitator`)
238
+ with default HTTPS implementations — all dependencies injectable via
239
+ constructor.
240
+ - SSRF protection for SLAP-discovered domains (private/loopback IP
241
+ rejection).
81
242
 
82
243
  #### Identity
83
244
 
84
- - **Identity client** — `BSV::Identity` module for certificate-based identity resolution and publication.
85
- - `Client` resolve identities by key or attributes, publicly reveal certificate fields on-chain, revoke revelations. All overlay dependencies injectable.
86
- - `IdentityParser` — converts identity certificates to `DisplayableIdentity`, handling all 9 known types (xCert, discordCert, phoneCert, emailCert, identiCert, registrant, coolCert, anyone, self) plus generic field-name heuristic fallback.
87
- - Types: `DisplayableIdentity`, `IdentityCertificate`, `CertifierInfo`, `ClientOptions` with cross-SDK constant alignment.
88
- - Certificate verifier injectable with safe-by-default (raises `NotImplementedError`).
245
+ - [sdk] **Identity client** — `BSV::Identity` module for certificate-based
246
+ identity resolution and publication.
247
+ - `Client` — resolve identities by key or attributes, publicly reveal
248
+ certificate fields on-chain, revoke revelations. All overlay
249
+ dependencies injectable.
250
+ - `IdentityParser` — converts identity certificates to
251
+ `DisplayableIdentity`, handling all 9 known types (xCert, discordCert,
252
+ phoneCert, emailCert, identiCert, registrant, coolCert, anyone, self)
253
+ plus generic field-name heuristic fallback.
254
+ - Types: `DisplayableIdentity`, `IdentityCertificate`, `CertifierInfo`,
255
+ `ClientOptions` with cross-SDK constant alignment.
256
+ - Certificate verifier injectable with safe-by-default (raises
257
+ `NotImplementedError`).
89
258
 
90
259
  #### Script
91
260
 
92
- - **PushDropTemplate** — reusable wallet-aware PushDrop template with BRC-42 key derivation, optional ECDSA field signing, and P2PKH lock/unlock. Used by Identity client, reusable for ContactsManager and other PushDrop-based features.
261
+ - [sdk] **PushDropTemplate** — reusable wallet-aware PushDrop template with
262
+ BRC-42 key derivation, optional ECDSA field signing, and P2PKH
263
+ lock/unlock. Used by Identity client, reusable for ContactsManager and
264
+ other PushDrop-based features.
93
265
 
94
266
  ### Fixed
95
267
 
96
- - `ProtoWallet` parameter name mismatch: `_originator:` → `originator:` to match the `WalletInterface` contract.
268
+ - [sdk] `ProtoWallet` parameter name mismatch: `_originator:` →
269
+ `originator:` to match the `WalletInterface` contract.
97
270
 
98
- ## [0.4.0] - 2026-04-01
271
+ ## sdk-0.4.0 / wallet-0.2.0 2026-04-01
99
272
 
100
273
  ### Added
101
274
 
102
275
  #### Primitives
103
276
 
104
- - **Bitcore ECIES** — `ECIES.bitcore_encrypt` / `ECIES.bitcore_decrypt`. AES-256-CBC with random IV, SHA-512(X-coordinate) key derivation. Matches ts-sdk and go-sdk Bitcore variants.
277
+ - [sdk] **Bitcore ECIES** — `ECIES.bitcore_encrypt` /
278
+ `ECIES.bitcore_decrypt`. AES-256-CBC with random IV, SHA-512(X-coordinate)
279
+ key derivation. Matches ts-sdk and go-sdk Bitcore variants.
105
280
 
106
281
  #### Transaction
107
282
 
108
- - **LivePolicy.default** — one-line convenience for live fee queries via GorillaPool ARC with 5-minute cache and 100 sat/kB fallback.
283
+ - [sdk] **`LivePolicy.default`** — one-line convenience for live fee queries
284
+ via GorillaPool ARC with 5-minute cache and 100 sat/kB fallback. (The
285
+ underlying `LivePolicy` fee model itself shipped in sdk-0.3.2.)
286
+
287
+ #### Wallet
288
+
289
+ - [wallet] **FileStore** — JSON file-backed persistent storage, now the
290
+ default for `WalletClient`. Data survives process restarts. `MemoryStore`
291
+ becomes explicit opt-in for tests.
292
+ - [wallet] **File permissions** — directory created with 0700, files with
293
+ 0600. Warns via Logger on startup if permissions are too open.
109
294
 
110
295
  ### Changed
111
296
 
112
- - **Default fee rate**: `SatoshisPerKilobyte` default changed from 50 to 100 sat/kB (matches ts-sdk LivePolicy fallback). `Wallet#fund` default changed from 0.5 to 0.1 sat/byte.
297
+ - [sdk] **Default fee rate**: `SatoshisPerKilobyte` default changed from 50
298
+ to 100 sat/kB (matches ts-sdk LivePolicy fallback).
299
+
300
+ ## sdk-0.3.2 / wallet-0.1.2 — 2026-03-30
301
+
302
+ ### Added
113
303
 
114
- ### bsv-wallet v0.2.0
304
+ #### Script
115
305
 
116
- - **FileStore** — JSON file-backed persistent storage, now the default for `WalletClient`. Data survives process restarts. MemoryStore becomes explicit opt-in for tests.
117
- - **File permissions** — directory created with 0700, files with 0600. Warns via Logger on startup if permissions are too open.
118
- - **BRC-31 Auth/Peer** — mutual authentication with nonce-based challenges, ECDSA signatures, and session management.
119
- - **Wire protocol** — binary ABI serialisation for all 28 BRC-100 methods (call codes 1-28, VarInt encoding).
120
- - **Certificate issuance** — `acquire_certificate` with `'issuance'` protocol (POST to certifier URL).
121
- - **OpCat template** — OP_CAT concatenation script template with lock/unlock constructors.
122
- - **Live fee policy** `LivePolicy` fee model fetching from ARC `/v1/policy`.
306
+ - [sdk] **OP_CAT template** — OP_CAT concatenation script template with
307
+ lock/unlock constructors.
308
+
309
+ #### Transaction
310
+
311
+ - [sdk] **LivePolicy fee model** — fetches policy from ARC `/v1/policy`
312
+ endpoint. (The convenience constructor `LivePolicy.default` was added
313
+ in sdk-0.4.0.)
314
+
315
+ #### Wallet
316
+
317
+ - [wallet] **BRC-31 Auth/Peer** — mutual authentication with nonce-based
318
+ challenges, ECDSA signatures, and session management.
319
+ - [wallet] **BRC-100 wire protocol** — binary ABI serialisation for all 28
320
+ BRC-100 methods (call codes 1-28, VarInt encoding).
321
+ - [wallet] **Certificate issuance** — `acquire_certificate` with
322
+ `'issuance'` protocol (POST to certifier URL).
123
323
 
124
324
  ### Fixed
125
325
 
126
- - Subject and certifier pinned in certificate issuance response (not overridable by remote certifier)
127
- - Wire reader negative privileged_reason length crash
128
- - PUSHDATA1/2/4 bounds check (silent data corruption on truncated scripts)
129
- - Extended key path validation (reject non-numeric indices)
326
+ - [sdk] PUSHDATA1/2/4 bounds check (silent data corruption on truncated
327
+ scripts).
328
+ - [sdk] Extended key path validation (reject non-numeric indices).
329
+ - [wallet] Subject and certifier pinned in certificate issuance response
330
+ (not overridable by remote certifier).
331
+ - [wallet] Wire reader negative `privileged_reason` length crash.
332
+
333
+ This was the first formal `bsv-wallet` gem release tag. Wallet code that
334
+ landed in master before this date (notably the BRC-100 identity certificate
335
+ methods and the BRC-100 blockchain-data / authentication methods committed
336
+ during the sdk-0.3.1 window) is part of this gem's initial released state.
337
+
338
+ ## sdk-0.3.1 — 2026-03-27
130
339
 
131
- ## [0.3.0] - 2026-03-27
340
+ ### Added
341
+
342
+ #### Network
343
+
344
+ - [sdk] **`ARC#broadcast` `wait_for:` parameter** — sets the `X-WaitFor`
345
+ header (RECEIVED, STORED, ANNOUNCED_TO_NETWORK, SEEN_ON_NETWORK, MINED)
346
+ so callers can choose how long ARC blocks before responding.
347
+
348
+ ## sdk-0.3.0 — 2026-03-27
132
349
 
133
350
  ### Added
134
351
 
135
352
  #### Primitives
136
353
 
137
- - **SymmetricKey** — AES-256-GCM encryption/decryption with 32-byte IV (cross-SDK compatible). Construct from random, ECDH, or raw bytes.
138
- - **BRC-77 SignedMessage** — authenticated message signing and verification using BRC-42 derived keys. Supports targeted (specific verifier) and "anyone" modes.
139
- - **BRC-78 EncryptedMessage** — end-to-end encrypted messaging using ECDH-derived symmetric keys.
140
- - **Schnorr ZKP (BRC-94)** zero-knowledge proof of ECDH shared secret knowledge. `Schnorr.generate_proof` / `Schnorr.verify_proof`.
141
- - **Shamir's Secret Sharing** — split private keys into threshold shares (`PrivateKey#to_key_shares`) with Lagrange interpolation reconstruction. Backup format with integrity check.
354
+ - [sdk] **SymmetricKey** — AES-256-GCM encryption/decryption with 32-byte
355
+ IV (cross-SDK compatible). Construct from random, ECDH, or raw bytes.
356
+ - [sdk] **BRC-77 SignedMessage** — authenticated message signing and
357
+ verification using BRC-42 derived keys. Supports targeted (specific
358
+ verifier) and "anyone" modes.
359
+ - [sdk] **BRC-78 EncryptedMessage** — end-to-end encrypted messaging using
360
+ ECDH-derived symmetric keys.
361
+ - [sdk] **Schnorr ZKP (BRC-94)** — zero-knowledge proof of ECDH shared
362
+ secret knowledge. `Schnorr.generate_proof` / `Schnorr.verify_proof`.
363
+ - [sdk] **Shamir's Secret Sharing** — split private keys into threshold
364
+ shares (`PrivateKey#to_key_shares`) with Lagrange interpolation
365
+ reconstruction. Backup format with integrity check.
142
366
 
143
367
  #### Script
144
368
 
145
- - **PushDrop template** — data carrier with P2PK spending. `Script.pushdrop_lock` / `Script.pushdrop_unlock` with field extraction.
146
- - **RPuzzle template** — R-puzzle hash-based spending with 6 hash type variants (raw, SHA1, SHA256, RIPEMD160, HASH160, HASH256).
369
+ - [sdk] **PushDrop template** — data carrier with P2PK spending.
370
+ `Script.pushdrop_lock` / `Script.pushdrop_unlock` with field extraction.
371
+ - [sdk] **RPuzzle template** — R-puzzle hash-based spending with 6 hash
372
+ type variants (raw, SHA1, SHA256, RIPEMD160, HASH160, HASH256).
147
373
 
148
374
  #### Transaction
149
375
 
150
- - **Benford's law change distribution** — privacy-preserving change output splitting using Benford's first-digit distribution.
151
- - **ARC X-WaitFor** `ARC#broadcast` gains `wait_for:` parameter for `X-WaitFor` header (RECEIVED, STORED, ANNOUNCED_TO_NETWORK, SEEN_ON_NETWORK, MINED).
376
+ - [sdk] **Benford's law change distribution** — privacy-preserving change
377
+ output splitting using Benford's first-digit distribution.
152
378
 
153
379
  ### Fixed
154
380
 
155
- - Empty plaintext/ciphertext handling on older OpenSSL versions
156
- - PushDrop detection for minimally-encoded fields
381
+ - [sdk] Empty plaintext/ciphertext handling on older OpenSSL versions.
382
+ - [sdk] PushDrop detection for minimally-encoded fields.
157
383
 
158
384
  ### Changed
159
385
 
160
- - `Transaction#fee` change distribution uses Benford's law (was equal split)
161
- - `LineLength` raised to 150
386
+ - [sdk] `Transaction#fee` change distribution uses Benford's law (was equal
387
+ split).
388
+ - [sdk] `LineLength` raised to 150.
162
389
 
163
- ## [0.2.1] - 2026-03-07
390
+ ## sdk-0.2.1 2026-03-07
164
391
 
165
392
  ### Fixed
166
393
 
167
- - Truncated OP_PUSHDATA1/2/4 scripts now raise `ArgumentError` instead of crashing with `TypeError`
168
- - `Transaction#to_beef` uses `merge_bump` to correctly handle multiple ancestors at the same block height
169
- - `PrivateKey#derive_child` uses `BN.mod_add` instead of Integer roundtrip for modular addition
170
- - Fixed txid byte-order documentation (display order, not internal order)
394
+ - [sdk] Truncated `OP_PUSHDATA1`/`2`/`4` scripts now raise `ArgumentError`
395
+ instead of crashing with `TypeError`.
396
+ - [sdk] `Transaction#to_beef` uses `merge_bump` to correctly handle
397
+ multiple ancestors at the same block height.
398
+ - [sdk] `PrivateKey#derive_child` uses `BN.mod_add` instead of Integer
399
+ roundtrip for modular addition.
400
+ - [sdk] Fixed txid byte-order documentation (display order, not internal
401
+ order).
171
402
 
172
403
  ### Testing
173
404
 
174
- - FORKID enforcement spec verifying interpreter rejects signatures without SIGHASH_FORKID
175
- - ExtendedKey fingerprint chain integrity across 3-generation derivation
176
- - Mnemonic entropy round-trip across all 5 valid entropy lengths
177
- - BEEF spec for multiple ancestors at the same block height
405
+ - [sdk] FORKID enforcement spec verifying interpreter rejects signatures
406
+ without SIGHASH_FORKID.
407
+ - [sdk] ExtendedKey fingerprint chain integrity across 3-generation
408
+ derivation.
409
+ - [sdk] Mnemonic entropy round-trip across all 5 valid entropy lengths.
410
+ - [sdk] BEEF spec for multiple ancestors at the same block height.
178
411
 
179
- ## [0.2.0] - 2026-03-07
412
+ ## sdk-0.2.0 2026-03-07
180
413
 
181
414
  ### Added
182
415
 
183
416
  #### Primitives
184
417
 
185
- - ECDH shared secret derivation (`PrivateKey#derive_shared_secret`, `PublicKey#derive_shared_secret`)
186
- - BRC-42 key derivation (`PrivateKey#derive_child`, `PublicKey#derive_child`) with official spec test vectors
418
+ - [sdk] ECDH shared secret derivation
419
+ (`PrivateKey#derive_shared_secret`, `PublicKey#derive_shared_secret`).
420
+ - [sdk] BRC-42 key derivation (`PrivateKey#derive_child`,
421
+ `PublicKey#derive_child`) with official spec test vectors.
187
422
 
188
423
  #### Transaction
189
424
 
190
- - Chain tracker interface (`ChainTracker` base class) with WhatsOnChain implementation
191
- - Fee model interface (`FeeModel` base class) with `SatoshisPerKilobyte` implementation
192
- - `Transaction#fee` with change output distribution across multiple change outputs
193
- - `Transaction#verify` for full SPV verification (merkle path, script execution, recursive ancestry)
194
- - `TransactionOutput#change` flag for identifying change outputs
195
- - `MerklePath#verify` for SPV chain tracker integration
196
- - BEEF completion: `Beef#merge`, `Beef#valid?`, lookup methods (`find_bump`, `find_transaction_for_signing`)
197
- - `Transaction#to_beef` / `Transaction.from_beef` convenience methods
198
- - Extended Format (EF) transaction serialisation (`to_ef`, `to_ef_hex`, `from_ef`, `from_ef_hex`)
199
- - `VerificationError` with typed error codes for SPV verification failures
425
+ - [sdk] Chain tracker interface (`ChainTracker` base class) with
426
+ WhatsOnChain implementation.
427
+ - [sdk] Fee model interface (`FeeModel` base class) with
428
+ `SatoshisPerKilobyte` implementation.
429
+ - [sdk] `Transaction#fee` with change output distribution across multiple
430
+ change outputs.
431
+ - [sdk] `Transaction#verify` for full SPV verification (merkle path,
432
+ script execution, recursive ancestry).
433
+ - [sdk] `TransactionOutput#change` flag for identifying change outputs.
434
+ - [sdk] `MerklePath#verify` for SPV chain tracker integration.
435
+ - [sdk] BEEF completion: `Beef#merge`, `Beef#valid?`, lookup methods
436
+ (`find_bump`, `find_transaction_for_signing`).
437
+ - [sdk] `Transaction#to_beef` / `Transaction.from_beef` convenience
438
+ methods.
439
+ - [sdk] Extended Format (EF) transaction serialisation (`to_ef`,
440
+ `to_ef_hex`, `from_ef`, `from_ef_hex`).
441
+ - [sdk] `VerificationError` with typed error codes for SPV verification
442
+ failures.
200
443
 
201
444
  ### Changed
202
445
 
203
- - ECIES refactored to use `PrivateKey#derive_shared_secret` internally (no API change)
204
- - `Transaction#estimated_size` made public for fee model access
446
+ - [sdk] ECIES refactored to use `PrivateKey#derive_shared_secret`
447
+ internally (no API change).
448
+ - [sdk] `Transaction#estimated_size` made public for fee model access.
205
449
 
206
450
  ### Fixed
207
451
 
208
- - Nil `source_satoshis` now raises instead of silently coercing to zero in fee distribution and verification
209
- - Script chunk round-trips preserve original push encoding
210
- - `OP_RETURN` inside conditionals correctly checked for conditional balance
211
- - Point x-coordinate extraction preserves leading zeros via octet string
212
- - `Integer#nobits?` replaced with Ruby 2.7-compatible bitwise check
213
- - Defensive parsing with descriptive errors for truncated binary input
452
+ - [sdk] Nil `source_satoshis` now raises instead of silently coercing to
453
+ zero in fee distribution and verification.
454
+ - [sdk] Script chunk round-trips preserve original push encoding.
455
+ - [sdk] `OP_RETURN` inside conditionals correctly checked for conditional
456
+ balance.
457
+ - [sdk] Point x-coordinate extraction preserves leading zeros via octet
458
+ string.
459
+ - [sdk] `Integer#nobits?` replaced with Ruby 2.7-compatible bitwise check.
460
+ - [sdk] Defensive parsing with descriptive errors for truncated binary
461
+ input.
214
462
 
215
463
  ### Testing
216
464
 
217
- - BRC-42 conformance specs with 9 official specification test vectors
218
- - ECDH conformance specs (commutativity, cross-method, pinned known-key vector)
219
- - SPV verification conformance specs (merkle path, script execution, ancestry)
220
- - Fee model conformance specs (formula validation, default rate, change distribution)
221
- - Chain tracker conformance specs
222
- - BEEF cross-SDK conformance vectors
223
- - Schnorr (BRC-94) cross-SDK interoperability vectors
224
- - 6 exact-match RFC 6979 vectors from Trezor/CoreBitcoin
225
- - VarInt boundary tests at size-prefix transitions
226
- - Script vectors converted to tracked known-failures system
227
-
228
- ## [0.1.0] - 2026-02-14
465
+ - [sdk] BRC-42 conformance specs with 9 official specification test
466
+ vectors.
467
+ - [sdk] ECDH conformance specs (commutativity, cross-method, pinned
468
+ known-key vector).
469
+ - [sdk] SPV verification conformance specs (merkle path, script execution,
470
+ ancestry).
471
+ - [sdk] Fee model conformance specs (formula validation, default rate,
472
+ change distribution).
473
+ - [sdk] Chain tracker conformance specs.
474
+ - [sdk] BEEF cross-SDK conformance vectors.
475
+ - [sdk] Schnorr (BRC-94) cross-SDK interoperability vectors.
476
+ - [sdk] 6 exact-match RFC 6979 vectors from Trezor/CoreBitcoin.
477
+ - [sdk] VarInt boundary tests at size-prefix transitions.
478
+ - [sdk] Script vectors converted to tracked known-failures system.
479
+
480
+ ## sdk-0.1.0 — 2026-02-14
229
481
 
230
482
  Initial release of the BSV Ruby SDK.
231
483
 
@@ -233,46 +485,54 @@ Initial release of the BSV Ruby SDK.
233
485
 
234
486
  #### Primitives
235
487
 
236
- - secp256k1 elliptic curve operations (point arithmetic, scalar multiplication)
237
- - ECDSA signing and verification with RFC 6979 deterministic nonces
238
- - Public and private key handling (WIF import/export, compressed/uncompressed formats)
239
- - Base58Check encoding and decoding
240
- - Hash functions: SHA-256, RIPEMD-160, Hash160 (SHA-256 + RIPEMD-160), SHA-512, HMAC
241
- - BIP-32 hierarchical deterministic key derivation (extended keys, hardened/normal child paths)
242
- - BIP-39 mnemonic phrase generation and seed derivation
243
- - ECIES encryption and decryption (BIE1 format)
244
- - Bitcoin Signed Message (BSM) signing and verification
488
+ - [sdk] secp256k1 elliptic curve operations (point arithmetic, scalar
489
+ multiplication).
490
+ - [sdk] ECDSA signing and verification with RFC 6979 deterministic nonces.
491
+ - [sdk] Public and private key handling (WIF import/export,
492
+ compressed/uncompressed formats).
493
+ - [sdk] Base58Check encoding and decoding.
494
+ - [sdk] Hash functions: SHA-256, RIPEMD-160, Hash160 (SHA-256 +
495
+ RIPEMD-160), SHA-512, HMAC.
496
+ - [sdk] BIP-32 hierarchical deterministic key derivation (extended keys,
497
+ hardened/normal child paths).
498
+ - [sdk] BIP-39 mnemonic phrase generation and seed derivation.
499
+ - [sdk] ECIES encryption and decryption (BIE1 format).
500
+ - [sdk] Bitcoin Signed Message (BSM) signing and verification.
245
501
 
246
502
  #### Script
247
503
 
248
- - Opcode constants (full set)
249
- - Script chunk representation and parsing
250
- - Script serialisation and deserialisation
251
- - Script templates: P2PKH, P2PK, P2MS (multisig), OP_RETURN data
252
- - Script type detection (including read-only recognition of P2SH and other legacy types)
253
- - Script builder API for programmatic construction
254
- - Script interpreter with stack operations, arithmetic, crypto, flow control, splice, and bitwise ops
504
+ - [sdk] Opcode constants (full set).
505
+ - [sdk] Script chunk representation and parsing.
506
+ - [sdk] Script serialisation and deserialisation.
507
+ - [sdk] Script templates: P2PKH, P2PK, P2MS (multisig), OP_RETURN data.
508
+ - [sdk] Script type detection (including read-only recognition of P2SH and
509
+ other legacy types).
510
+ - [sdk] Script builder API for programmatic construction.
511
+ - [sdk] Script interpreter with stack operations, arithmetic, crypto, flow
512
+ control, splice, and bitwise ops.
255
513
 
256
514
  #### Transaction
257
515
 
258
- - Transaction construction and serialisation (raw format)
259
- - BIP-143 sighash computation (all hash types with FORKID)
260
- - Transaction signing with configurable sighash flags
261
- - BEEF serialisation (BRC-95/BRC-96)
262
- - Merkle path representation and verification
263
- - Fee estimation
264
- - Script verification during signing
265
- - Unlocking script templates for common script types
516
+ - [sdk] Transaction construction and serialisation (raw format).
517
+ - [sdk] BIP-143 sighash computation (all hash types with FORKID).
518
+ - [sdk] Transaction signing with configurable sighash flags.
519
+ - [sdk] BEEF serialisation (BRC-95/BRC-96).
520
+ - [sdk] Merkle path representation and verification.
521
+ - [sdk] Fee estimation.
522
+ - [sdk] Script verification during signing.
523
+ - [sdk] Unlocking script templates for common script types.
266
524
 
267
525
  #### Network
268
526
 
269
- - ARC broadcaster for transaction submission
270
- - WhatsOnChain chain data provider
271
- - Basic wallet functionality
527
+ - [sdk] ARC broadcaster for transaction submission.
528
+ - [sdk] WhatsOnChain chain data provider.
529
+ - [sdk] Basic wallet functionality.
272
530
 
273
531
  #### Testing
274
532
 
275
- - Cross-SDK test vectors from Go, TypeScript, and Python reference implementations
276
- - NIST and RFC hash function test vectors
277
- - Bitcoin Core script interpreter test suite
278
- - Protocol conformance specs for opcodes, sighash flags, and transaction templates
533
+ - [sdk] Cross-SDK test vectors from Go, TypeScript, and Python reference
534
+ implementations.
535
+ - [sdk] NIST and RFC hash function test vectors.
536
+ - [sdk] Bitcoin Core script interpreter test suite.
537
+ - [sdk] Protocol conformance specs for opcodes, sighash flags, and
538
+ transaction templates.