@smartledger/bsv 9.0.0 → 9.1.1

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 (155) hide show
  1. package/CHANGELOG.md +164 -0
  2. package/README.md +152 -1041
  3. package/STABILITY.md +134 -0
  4. package/bsv-gdaf.min.js +53 -48
  5. package/bsv-ltp.min.js +23 -18
  6. package/bsv-smartcontract.min.js +18 -18
  7. package/bsv.bundle.js +53 -48
  8. package/bsv.min.js +53 -48
  9. package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
  10. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  11. package/docs/getting-started/INSTALLATION.md +23 -23
  12. package/docs/getting-started/QUICK_START.md +7 -7
  13. package/docs/migration/FROM_BSV_1_5_6.md +5 -5
  14. package/docs/proposals/10.0.0-package-split.md +131 -0
  15. package/index.js +5 -0
  16. package/lib/block/merkleblock.js +53 -9
  17. package/lib/hdprivatekey.js +15 -0
  18. package/lib/script/interpreter.js +109 -1
  19. package/lib/smart_contract/builder.js +14 -0
  20. package/lib/util/deprecate.js +159 -0
  21. package/package.json +19 -82
  22. package/version.js +1 -1
  23. package/.mocharc.json +0 -5
  24. package/test/address.js +0 -629
  25. package/test/block/block.js +0 -239
  26. package/test/block/blockheader.js +0 -270
  27. package/test/block/merkleblock.js +0 -207
  28. package/test/build/bundle_crypto_shim.js +0 -104
  29. package/test/build/bundle_externals.js +0 -125
  30. package/test/build/bundle_smoke.js +0 -55
  31. package/test/build/esbuild_main.js +0 -65
  32. package/test/build/esm_wrapper.js +0 -97
  33. package/test/build/exports_resolution.js +0 -84
  34. package/test/build/version_sync.js +0 -14
  35. package/test/cli/smoke.js +0 -261
  36. package/test/consensus/base58-vectors.js +0 -120
  37. package/test/consensus/sv-script-vectors.js +0 -81
  38. package/test/consensus/sv-sighash-vectors.js +0 -51
  39. package/test/consensus/sv-tx-vectors.js +0 -48
  40. package/test/credentials-test.js +0 -332
  41. package/test/crypto/backend_selection.js +0 -126
  42. package/test/crypto/bn.js +0 -168
  43. package/test/crypto/ecdsa.js +0 -426
  44. package/test/crypto/elliptic-fixed.js +0 -61
  45. package/test/crypto/hash.browser.js +0 -121
  46. package/test/crypto/hash.js +0 -122
  47. package/test/crypto/point.js +0 -193
  48. package/test/crypto/random.js +0 -105
  49. package/test/crypto/security.js +0 -176
  50. package/test/crypto/shamir.js +0 -177
  51. package/test/crypto/shamir_rngcap.js +0 -29
  52. package/test/crypto/signature.js +0 -399
  53. package/test/data/bip69.json +0 -215
  54. package/test/data/bitcoin-sv/README.md +0 -170
  55. package/test/data/bitcoin-sv/base58_encode_decode.json +0 -14
  56. package/test/data/bitcoin-sv/base58_keys_invalid.json +0 -152
  57. package/test/data/bitcoin-sv/base58_keys_valid.json +0 -452
  58. package/test/data/bitcoin-sv/script_tests.json +0 -2591
  59. package/test/data/bitcoin-sv/sighash.json +0 -1003
  60. package/test/data/bitcoin-sv/tx_invalid.json +0 -285
  61. package/test/data/bitcoin-sv/tx_valid.json +0 -367
  62. package/test/data/bitcoind/base58_keys_invalid.json +0 -152
  63. package/test/data/bitcoind/base58_keys_valid.json +0 -452
  64. package/test/data/bitcoind/blocks.json +0 -27
  65. package/test/data/bitcoind/script_tests.json +0 -2244
  66. package/test/data/bitcoind/sig_canonical.json +0 -7
  67. package/test/data/bitcoind/sig_noncanonical.json +0 -22
  68. package/test/data/bitcoind/tx_invalid.json +0 -177
  69. package/test/data/bitcoind/tx_valid.json +0 -224
  70. package/test/data/blk86756-testnet.dat +0 -0
  71. package/test/data/blk86756-testnet.js +0 -12
  72. package/test/data/blk86756-testnet.json +0 -684
  73. package/test/data/brc220-batch-vector.json +0 -129
  74. package/test/data/ecdsa.json +0 -230
  75. package/test/data/merkleblocks.js +0 -486
  76. package/test/data/messages.json +0 -22
  77. package/test/data/sighash.json +0 -1004
  78. package/test/data/tx_creation.json +0 -85
  79. package/test/didweb/relationships.js +0 -144
  80. package/test/ecies/bitcore-ecies.js +0 -178
  81. package/test/ecies/electrum-ecies.js +0 -206
  82. package/test/encoding/base58.js +0 -131
  83. package/test/encoding/base58check.js +0 -145
  84. package/test/encoding/bufferreader.js +0 -328
  85. package/test/encoding/bufferwriter.js +0 -160
  86. package/test/encoding/varint.js +0 -104
  87. package/test/gdaf/anchor_no_key_leak.js +0 -146
  88. package/test/gdaf/anchor_spv.js +0 -163
  89. package/test/gdaf/canonicalization.js +0 -106
  90. package/test/gdaf/canonicalize.js +0 -140
  91. package/test/gdaf/zk_prover.js +0 -204
  92. package/test/hdkeys.js +0 -365
  93. package/test/hdprivatekey.js +0 -339
  94. package/test/hdpublickey.js +0 -293
  95. package/test/index.js +0 -16
  96. package/test/ltp/ids.js +0 -74
  97. package/test/ltp/right.js +0 -198
  98. package/test/ltp/verify_failclosed.js +0 -134
  99. package/test/message/message.js +0 -190
  100. package/test/mnemonic/data/fixtures.json +0 -300
  101. package/test/mnemonic/mnemonic.js +0 -277
  102. package/test/mnemonic/mocha.opts +0 -1
  103. package/test/mnemonic/pbkdf2.test.js +0 -43
  104. package/test/networks.js +0 -207
  105. package/test/notaryhash/batch_leaf.js +0 -140
  106. package/test/notaryhash/batch_vector.js +0 -282
  107. package/test/notaryhash/certificate.js +0 -249
  108. package/test/notaryhash/encoding.js +0 -186
  109. package/test/notaryhash/interop.js +0 -112
  110. package/test/notaryhash/merkle.js +0 -181
  111. package/test/notaryhash/script.js +0 -270
  112. package/test/notaryhash/verify.js +0 -342
  113. package/test/opcode.js +0 -186
  114. package/test/ordinals/bsv20.js +0 -337
  115. package/test/ordinals/inscription.js +0 -329
  116. package/test/ordinals/ordlock.js +0 -567
  117. package/test/privatekey.js +0 -540
  118. package/test/publickey.js +0 -411
  119. package/test/regressions.js +0 -215
  120. package/test/script/chronicle.js +0 -543
  121. package/test/script/defaults.js +0 -160
  122. package/test/script/genesis_limits.js +0 -203
  123. package/test/script/interpreter.js +0 -776
  124. package/test/script/script.js +0 -1259
  125. package/test/script/string_ops.js +0 -88
  126. package/test/security/fail_closed_contracts.js +0 -104
  127. package/test/security/threat_model_coverage.js +0 -31
  128. package/test/smart_contract/covenants.js +0 -207
  129. package/test/smart_contract/dsl_debugger.js +0 -92
  130. package/test/smart_contract/extract_field.js +0 -61
  131. package/test/smart_contract/nonenforcing_guard.js +0 -44
  132. package/test/smart_contract/ordinal_transfer.js +0 -71
  133. package/test/smart_contract/preimage.js +0 -98
  134. package/test/smart_contract/sighash_marketplace.js +0 -98
  135. package/test/smart_contract/token_generalized.js +0 -175
  136. package/test/spv/headerchain.js +0 -86
  137. package/test/spv/merkleproof.js +0 -133
  138. package/test/statuslist/failclosed.js +0 -78
  139. package/test/transaction/deserialize.js +0 -33
  140. package/test/transaction/input/input.js +0 -92
  141. package/test/transaction/input/multisig.js +0 -174
  142. package/test/transaction/input/multisigscripthash.js +0 -111
  143. package/test/transaction/input/publickey.js +0 -68
  144. package/test/transaction/input/publickeyhash.js +0 -59
  145. package/test/transaction/output.js +0 -185
  146. package/test/transaction/sighash.js +0 -91
  147. package/test/transaction/signature.js +0 -127
  148. package/test/transaction/transaction.js +0 -1299
  149. package/test/transaction/unspentoutput.js +0 -97
  150. package/test/types/dts_drift.js +0 -124
  151. package/test/types/surface_honesty.js +0 -102
  152. package/test/util/id.js +0 -72
  153. package/test/util/js.js +0 -76
  154. package/test/util/preconditions.js +0 -79
  155. package/test/vcjwt/interop.js +0 -126
@@ -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.0.0/bsv-shamir.min.js`
58
+ - **CDN**: `unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js` |
85
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.0.0/bsv.bundle.js` |
86
- | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@9.0.0/bsv-smartcontract.min.js` |
87
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.0.0/bsv-covenant.min.js` |
88
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.0.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.0.0/bsv-security.min.js` |
90
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.0.0/bsv-ecies.min.js` |
91
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.0.0/bsv-message.min.js` |
92
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.0.0/bsv-mnemonic.min.js` |
93
- | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@9.0.0/bsv-shamir.min.js` |
94
- | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@9.0.0/bsv-gdaf.min.js` |
95
- | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@9.0.0/bsv-ltp.min.js` |
84
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.1.1/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@9.1.1/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.1.1/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.1.1/bsv-script-helper.min.js` |
89
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.1.1/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.1.1/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.1.1/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.1.1/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@9.1.1/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@9.1.1/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
104
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-script-helper.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
110
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-covenant.min.js"></script>
111
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-smartcontract.min.js"></script>
109
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
117
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-ltp.min.js"></script>
118
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-gdaf.min.js"></script>
116
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
136
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-security.min.js"></script>
137
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-shamir.min.js"></script>
135
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@9.1.1/bsv.min.js"></script>
726
726
  </head>
727
727
  <body>
728
728
  <script>
@@ -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.0.0/bsv.min.js"></script>
51
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
75
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-covenant.min.js"></script>
76
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-smartcontract.min.js"></script>
74
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
86
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-ltp.min.js"></script>
87
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-gdaf.min.js"></script>
85
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
102
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-security.min.js"></script>
103
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-shamir.min.js"></script>
101
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js` |
118
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.0.0/bsv.bundle.js` |
119
- | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.0.0/bsv-smartcontract.min.js` |
120
- | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@9.0.0/bsv-ltp.min.js` |
121
- | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@9.0.0/bsv-gdaf.min.js` |
122
- | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@9.0.0/bsv-shamir.min.js` |
123
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.0.0/bsv-security.min.js` |
124
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.0.0/bsv-mnemonic.min.js` |
125
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.0.0/bsv-ecies.min.js` |
126
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.0.0/bsv-covenant.min.js` |
127
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.0.0/bsv-script-helper.min.js` |
128
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.0.0/bsv-message.min.js` |
117
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.1.1/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.1.1/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@9.1.1/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@9.1.1/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@9.1.1/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.1.1/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.1.1/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.1.1/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.1.1/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.1.1/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
17
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
18
18
 
19
19
  <!-- Everything included (937KB) -->
20
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv.bundle.js"></script>
20
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/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.0.0/bsv.min.js"></script>
130
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
131
131
 
132
132
  <!-- Smart contracts (937KB) -->
133
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-smartcontract.min.js"></script>
133
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-smartcontract.min.js"></script>
134
134
 
135
135
  <!-- Legal tokens (1.16MB) -->
136
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-ltp.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-ltp.min.js"></script>
137
137
 
138
138
  <!-- Digital identity (1.16MB) -->
139
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-gdaf.min.js"></script>
139
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-gdaf.min.js"></script>
140
140
 
141
141
  <!-- Everything (937KB) -->
142
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv.bundle.js"></script>
142
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.bundle.js"></script>
143
143
  ```
144
144
 
145
145
  ## ⚡ **Key Advantages**
@@ -159,17 +159,17 @@ const recovered = bsv.reconstructSecret([shares[0], shares[2], shares[4]]);
159
159
  ### **New Modular Options**
160
160
  ```html
161
161
  <!-- Core compatibility (same size as bsv@1.5.6) -->
162
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv.min.js"></script>
162
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.min.js"></script>
163
163
 
164
164
  <!-- Add smart contracts when ready -->
165
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-smartcontract.min.js"></script>
165
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-smartcontract.min.js"></script>
166
166
 
167
167
  <!-- Add advanced features as needed -->
168
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-ltp.min.js"></script>
169
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv-gdaf.min.js"></script>
168
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-ltp.min.js"></script>
169
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv-gdaf.min.js"></script>
170
170
 
171
171
  <!-- Everything in one file -->
172
- <script src="https://unpkg.com/@smartledger/bsv@9.0.0/bsv.bundle.js"></script>
172
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.1/bsv.bundle.js"></script>
173
173
  ```
174
174
 
175
175
  ## 🔍 **Testing Your Migration**
@@ -0,0 +1,131 @@
1
+ # Proposal: split the package for 10.0.0
2
+
3
+ Status: draft, for discussion. Nothing here ships in 9.x.
4
+
5
+ ## The problem, measured
6
+
7
+ `@smartledger/bsv` is currently a Bitcoin library, a W3C VC-JWT toolkit, a
8
+ DID:web resolver, a legal-token protocol and an attestation framework in one
9
+ install. The cost is paid by everyone, including the majority who want one of
10
+ those things.
11
+
12
+ Requiring the root to get `Script`:
13
+
14
+ | | modules | time | heap |
15
+ |---|---|---|---|
16
+ | `require('@smartledger/bsv')` | 129 | 270ms | 12.7MB |
17
+ | `require('@smartledger/bsv/lib/script')` | 24 | 106ms | — |
18
+
19
+ Per subsystem, loaded alone:
20
+
21
+ | subsystem | modules |
22
+ |---|---|
23
+ | `lib/script` | 24 |
24
+ | `lib/transaction` | 40 |
25
+ | `lib/covenant` | 43 |
26
+ | `lib/ltp` | 48 |
27
+ | `lib/smart_contract` | 62 |
28
+ | `lib/gdaf` | 65 |
29
+
30
+ Two things make this worse than the numbers suggest:
31
+
32
+ 1. **Nothing tree-shakes.** `index.mjs` is a named-export wrapper over the CJS
33
+ build, so a bundler that sees `import { Script }` still pulls GDAF and LTP
34
+ into the browser bundle. The subpaths in `exports` are the only escape, and
35
+ they are not what the README teaches.
36
+ 2. **The npm listing has to describe all of it.** A BSV script developer
37
+ searching npm reads a description that leads with legal tokens and
38
+ credentials. The audience most likely to adopt is the one least addressed.
39
+
40
+ The subpath exports already work and already carry the fix. What is missing is
41
+ that the *default* path is the expensive one.
42
+
43
+ ## Shape
44
+
45
+ Five packages, one repository, published together.
46
+
47
+ | package | contains | approx modules |
48
+ |---|---|---|
49
+ | `@smartledger/bsv-core` | keys, addresses, script, transaction, block, SPV, crypto, encoding | ~45 |
50
+ | `@smartledger/bsv-script` | `SmartContract`, covenants, OP_PUSH_TX, PELS, ordinals, NotaryHash, script helper | ~62 |
51
+ | `@smartledger/bsv-crypto` | ECIES, Message, Mnemonic, Shamir | ~30 |
52
+ | `@smartledger/bsv-vc` | DID:web, VC-JWT, StatusList, GDAF, Anchor | ~65 |
53
+ | `@smartledger/bsv-ltp` | Legal Token Protocol | ~48 |
54
+ | `@smartledger/bsv` | **meta-package**: depends on all five, re-exports everything | unchanged |
55
+
56
+ The meta-package is the whole compatibility story. `require('@smartledger/bsv')`
57
+ keeps returning exactly what it returns today, including the ~74 flat
58
+ convenience functions (`createDID`, `prepareRightToken`, …) that currently sit
59
+ at top level. Nobody's install moves.
60
+
61
+ ## Sequencing
62
+
63
+ The split is a breaking change for anyone who deep-requires `lib/**`, and it
64
+ cannot share a release with a stability promise. It also must not become the
65
+ seventh major in a year. So:
66
+
67
+ **9.x (now → 2027-09-01)** — nothing changes. Optionally, the new packages are
68
+ published *additively* during this window: `bsv-core` and `bsv-script` go out as
69
+ real packages, `@smartledger/bsv` starts depending on them internally, and its
70
+ public surface is unchanged. Consumers who want the small thing can adopt early;
71
+ consumers who do nothing notice nothing. The API surface guard
72
+ (`test/api_surface.js`) proves the surface held.
73
+
74
+ **10.0.0 (2027-09 or later)** — the meta-package remains and keeps working. What
75
+ breaks is only:
76
+
77
+ - deep requires past the declared `exports` (already excluded by STABILITY.md)
78
+ - the three near-duplicate ~1041KB bundles, if they are dropped in the same
79
+ release
80
+
81
+ **Never** — removing the meta-package. It costs almost nothing to maintain once
82
+ the split exists, and removing it would strand every existing install for no
83
+ benefit.
84
+
85
+ ## What this fixes that subpaths alone do not
86
+
87
+ Subpath exports already let a careful consumer load 24 modules instead of 129.
88
+ Three things they cannot fix:
89
+
90
+ 1. **The default.** Most consumers write `require('@smartledger/bsv')` because
91
+ that is what the README shows. Making the small package a separate install
92
+ makes the cheap path the obvious one.
93
+ 2. **npm positioning.** A package can only have one description and one keyword
94
+ set. `bsv-script` can say "OP_PUSH_TX covenants and an interpreter-verified
95
+ script engine" without competing with credentials for the same 15 keywords.
96
+ 3. **Tree-shaking.** Separate packages can ship real ESM with `sideEffects:
97
+ false`, which the current CJS-wrapper cannot.
98
+
99
+ ## Open questions
100
+
101
+ - **Do `bsv-core` and `bsv-script` merge?** The script engine is the
102
+ differentiator and splitting it from `Transaction` may be an artificial line —
103
+ a covenant author needs both. Merging gives one ~62-module package that is
104
+ still less than half the current root. I lean toward merging.
105
+ - **Version alignment.** Lockstep versioning across all six is simplest to
106
+ reason about and wastes version numbers on packages that did not change.
107
+ Independent versioning is more honest and much harder to support. Lockstep
108
+ is probably right for a team this size.
109
+ - **The three ~1041KB bundles.** `bsv.min.js`, `bsv.bundle.js` and
110
+ `bsv-gdaf.min.js` are byte-comparable supersets. They are documented CDN
111
+ entries, so removing them breaks floating `@latest` URLs — which is why they
112
+ survive 9.x untouched. 10.0.0 is the moment to consolidate, with the old names
113
+ kept as redirects for one major if the CDN allows it.
114
+ - **Does the credential CLI move?** `bin/cli.js` is mostly credential
115
+ workflows. It probably belongs with `bsv-vc`, which means the meta-package
116
+ either loses the `smartledger-bsv` binary or keeps a thin shim.
117
+
118
+ ## What would make this a bad idea
119
+
120
+ Worth stating plainly, because the answer might be no.
121
+
122
+ Six packages is six release processes, six changelogs and a lockfile matrix, for
123
+ a maintainer count in the low single digits. If the credentials and LTP
124
+ subsystems have real users who install the root package deliberately — not
125
+ incidentally — then the current arrangement is serving them and the only genuine
126
+ problem is npm positioning, which a rewritten description already improved.
127
+
128
+ Before committing to this, the number worth having is **how many installs use
129
+ only the Bitcoin surface**. If that is most of them, split. If the install base
130
+ is genuinely using credentials alongside Bitcoin primitives, keep one package,
131
+ fix the ESM wrapper so it tree-shakes, and stop there.
package/index.js CHANGED
@@ -105,6 +105,11 @@ bsv.encoding.Varint = require('./lib/encoding/varint')
105
105
  bsv.util = {}
106
106
  bsv.util.js = require('./lib/util/js')
107
107
  bsv.util.preconditions = require('./lib/util/preconditions')
108
+ // Exposed so the deprecation notices have an off switch that does not require an
109
+ // environment variable. STABILITY.md documents BSV_NO_DEPRECATION_WARNINGS=1, which a
110
+ // browser consumer cannot set; without a programmatic control they had no way to
111
+ // silence a notice at all. `fired()` also lets tooling read what a run triggered.
112
+ bsv.util.deprecate = require('./lib/util/deprecate')
108
113
 
109
114
  // errors thrown by the library
110
115
  bsv.errors = require('./lib/errors')
@@ -8,6 +8,33 @@ var Hash = require('../crypto/hash')
8
8
  var Transaction = require('../transaction')
9
9
  var errors = require('../errors')
10
10
  var $ = require('../util/preconditions')
11
+ var deprecate = require('../util/deprecate')
12
+
13
+ /**
14
+ * Shallow-copy an array so the caller's array and ours are not the same object.
15
+ *
16
+ * The constructor used to store `arg.hashes` and `arg.flags` directly, and
17
+ * `toObject()` used to hand the same arrays back out. Both directions aliased, so a
18
+ * MerkleBlock and the object it was built from — or the object it produced — shared
19
+ * mutable state. Mutating either changed the other at a distance:
20
+ *
21
+ * var mb = new MerkleBlock(obj)
22
+ * mb.hashes.push(x) // obj.hashes grew too
23
+ * var out = mb.toObject()
24
+ * out.flags.pop() // mb.flags shrank too
25
+ *
26
+ * This surfaced as order-dependence in this library's own suite: tests that mutate a
27
+ * block built from a shared fixture corrupted that fixture for every test after them,
28
+ * so a new test passed alone and failed in the full run. The tests were the messenger;
29
+ * the aliasing is the defect, and a caller hits it the same way.
30
+ *
31
+ * Non-arrays are passed through untouched rather than coerced. The constructor never
32
+ * validated these fields, and turning a previously-tolerated input into a throw would
33
+ * be a breaking change — which 9.x is committed against. See STABILITY.md.
34
+ */
35
+ function copyArray (value) {
36
+ return Array.isArray(value) ? value.slice() : value
37
+ }
11
38
 
12
39
  /**
13
40
  * Instantiate a MerkleBlock from a Buffer, JSON object, or Object with
@@ -47,12 +74,12 @@ function MerkleBlock (arg) {
47
74
  * @name MerkleBlock#hashes
48
75
  * @type {String[]}
49
76
  */
50
- hashes: arg.hashes,
77
+ hashes: copyArray(arg.hashes),
51
78
  /**
52
79
  * @name MerkleBlock#flags
53
80
  * @type {Number[]}
54
81
  */
55
- flags: arg.flags
82
+ flags: copyArray(arg.flags)
56
83
  }
57
84
  } else {
58
85
  throw new TypeError('Unrecognized argument for MerkleBlock')
@@ -115,8 +142,12 @@ MerkleBlock.prototype.toObject = MerkleBlock.prototype.toJSON = function toObjec
115
142
  return {
116
143
  header: this.header.toObject(),
117
144
  numTransactions: this.numTransactions,
118
- hashes: this.hashes,
119
- flags: this.flags
145
+ // Copies, not the live arrays. Handing out the internals meant a caller who
146
+ // mutated the result of toObject() silently changed the MerkleBlock it came
147
+ // from — and `toObject` reads as a serializer, which is exactly the API you
148
+ // expect to be able to modify freely.
149
+ hashes: copyArray(this.hashes),
150
+ flags: copyArray(this.flags)
120
151
  }
121
152
  }
122
153
 
@@ -148,14 +179,27 @@ MerkleBlock.prototype.validMerkleTree = function validMerkleTree () {
148
179
  }
149
180
 
150
181
  /**
151
- * WARNING: This method is deprecated. Use filteredTxsHash instead.
182
+ * @deprecated Misspelling of `filteredTxsHash` (the `e` is missing). Identical
183
+ * behaviour; this delegates.
184
+ *
185
+ * It threw rather than delegating, which made a typo fix a breaking change for
186
+ * anyone who had written the typo. Restoring it costs nothing: the name is
187
+ * unambiguous, there is exactly one thing it can mean, and no caller can be
188
+ * harmed by getting what they asked for. Contrast `HDPrivateKey#derive`, which
189
+ * keeps throwing because its replacements return DIFFERENT keys.
152
190
  *
153
- * Return a list of all the txs hash that match the filter
154
191
  * @returns {Array} - txs hash that match the filter
155
192
  */
156
- MerkleBlock.prototype.filterdTxsHash = function filterdTxsHash () {
157
- throw new Error('filterdTxsHash has been deprecated. use filteredTxsHash.')
158
- }
193
+ MerkleBlock.prototype.filterdTxsHash = deprecate.fn(
194
+ function filterdTxsHash () { return this.filteredTxsHash() },
195
+ {
196
+ what: 'MerkleBlock#filterdTxsHash',
197
+ since: '9.1.0',
198
+ removeIn: '10.0.0',
199
+ use: 'MerkleBlock#filteredTxsHash',
200
+ why: 'the name is a misspelling'
201
+ }
202
+ )
159
203
 
160
204
  /**
161
205
  * Return a list of all the txs hash that match the filter
@@ -133,6 +133,21 @@ HDPrivateKey._getDerivationIndexes = function (path) {
133
133
  /**
134
134
  * WARNING: This method is deprecated. Use deriveChild or deriveNonCompliantChild instead. This is not BIP32 compliant
135
135
  *
136
+ * This one keeps THROWING rather than warning and delegating, and the reason is
137
+ * worth stating because it is the exception STABILITY.md carves out rather than
138
+ * an oversight.
139
+ *
140
+ * `derive` is ambiguous. Its two replacements return DIFFERENT KEYS:
141
+ * `deriveChild` is BIP32-compliant, `deriveNonCompliantChild` reproduces the old
142
+ * behaviour. Picking one here would silently hand roughly half of all callers
143
+ * keys they did not ask for — and a wrong derivation path means addresses whose
144
+ * funds cannot be recovered with the key the caller believes they hold. There is
145
+ * no default that is safe for everyone, so the caller has to choose, and the
146
+ * error names both options.
147
+ *
148
+ * A deprecation warning is the right tool when the replacement is obvious (see
149
+ * `MerkleBlock#filterdTxsHash`, a misspelling that now delegates). It is the
150
+ * wrong tool when guessing costs money.
136
151
  *
137
152
  * Get a derived child based on a string or number.
138
153
  *