@smartledger/bsv 9.0.0 → 9.1.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 (155) hide show
  1. package/CHANGELOG.md +137 -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 +19 -5
  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.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.0.0/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@9.1.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.0.0/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.1.0/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@9.1.0/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.1.0/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.1.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.1.0/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.1.0/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.1.0/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.1.0/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@9.1.0/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@9.1.0/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.0.0/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.0.0/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@9.1.0/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.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.0.0/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.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.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.0/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.1.0/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.1.0/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@9.1.0/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@9.1.0/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@9.1.0/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@9.1.0/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@9.1.0/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@9.1.0/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.1.0/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.1.0/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@9.1.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.0.0/bsv.min.js"></script>
17
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/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.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.0.0/bsv.min.js"></script>
130
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/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.0/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.0/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.0/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.0/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.0/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.0/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.0/bsv-ltp.min.js"></script>
169
+ <script src="https://unpkg.com/@smartledger/bsv@9.1.0/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.0/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,7 @@ 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')
11
12
 
12
13
  /**
13
14
  * Instantiate a MerkleBlock from a Buffer, JSON object, or Object with
@@ -148,14 +149,27 @@ MerkleBlock.prototype.validMerkleTree = function validMerkleTree () {
148
149
  }
149
150
 
150
151
  /**
151
- * WARNING: This method is deprecated. Use filteredTxsHash instead.
152
+ * @deprecated Misspelling of `filteredTxsHash` (the `e` is missing). Identical
153
+ * behaviour; this delegates.
154
+ *
155
+ * It threw rather than delegating, which made a typo fix a breaking change for
156
+ * anyone who had written the typo. Restoring it costs nothing: the name is
157
+ * unambiguous, there is exactly one thing it can mean, and no caller can be
158
+ * harmed by getting what they asked for. Contrast `HDPrivateKey#derive`, which
159
+ * keeps throwing because its replacements return DIFFERENT keys.
152
160
  *
153
- * Return a list of all the txs hash that match the filter
154
161
  * @returns {Array} - txs hash that match the filter
155
162
  */
156
- MerkleBlock.prototype.filterdTxsHash = function filterdTxsHash () {
157
- throw new Error('filterdTxsHash has been deprecated. use filteredTxsHash.')
158
- }
163
+ MerkleBlock.prototype.filterdTxsHash = deprecate.fn(
164
+ function filterdTxsHash () { return this.filteredTxsHash() },
165
+ {
166
+ what: 'MerkleBlock#filterdTxsHash',
167
+ since: '9.1.0',
168
+ removeIn: '10.0.0',
169
+ use: 'MerkleBlock#filteredTxsHash',
170
+ why: 'the name is a misspelling'
171
+ }
172
+ )
159
173
 
160
174
  /**
161
175
  * 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
  *
@@ -65,7 +65,7 @@ var Interpreter = function Interpreter (obj) {
65
65
  *
66
66
  * Translated from bitcoind's VerifyScript
67
67
  */
68
- Interpreter.prototype.verify = function (scriptSig, scriptPubkey, tx, nin, flags, satoshisBN) {
68
+ Interpreter.prototype._verifyCore = function (scriptSig, scriptPubkey, tx, nin, flags, satoshisBN) {
69
69
  var Transaction = require('../transaction')
70
70
 
71
71
  if (_.isUndefined(tx)) {
@@ -506,6 +506,114 @@ Interpreter.SCRIPT_UTXO_AFTER_CHRONICLE = (1 << 21)
506
506
  */
507
507
  Interpreter.CHRONICLE_ACTIVATION_HEIGHT = 943816
508
508
 
509
+ /**
510
+ * Flags and *limits* are separate mechanisms. The era bits below are what the
511
+ * interpreter derives its element-size, script-size, opcode-count and
512
+ * script-number caps from — so a caller who hand-assembles a flag word out of
513
+ * named constants gets the feature opcodes they asked for while silently keeping
514
+ * the pre-Genesis caps. The script runs, which is what makes it hard to see;
515
+ * nothing looks wrong until a large push is rejected and the error names the
516
+ * push rather than the flags.
517
+ *
518
+ * Warning on every era-less verify() is not an option. Pre-Genesis validation is
519
+ * legitimate and common: the reference script_tests.json vectors are era-less by
520
+ * construction, and roughly three quarters of this library's own verify() calls
521
+ * are era-less for that reason. So the notice fires only on the intersection of
522
+ * two facts — an explicit era-less flag word AND a failure whose threshold is
523
+ * era-derived. Measured across the suite that combination accounts for ~5% of
524
+ * era-less failures, all of them genuine pre-Genesis vectors, and it is exactly
525
+ * the state a covenant author who guessed at flags ends up in.
526
+ */
527
+ /**
528
+ * Failures whose threshold moved with an era: the cap that moved, and the flag
529
+ * that ACTUALLY lifts it.
530
+ *
531
+ * `lifts` is per-error on purpose. An earlier version tested a single ERA_FLAGS
532
+ * word containing all four era bits, which silenced the notice for the most likely
533
+ * form of the mistake: `SCRIPT_GENESIS` is the constant a hand-assembling caller
534
+ * reaches for — it is the one named "GENESIS" — but the size caps read
535
+ * `isAfterGenesis()`, which tests SCRIPT_UTXO_AFTER_GENESIS and nothing else. A
536
+ * flag word carrying SCRIPT_GENESIS alone still gets the 520-byte cap, still fails
537
+ * with PUSH_SIZE, and got no explanation.
538
+ *
539
+ * Each entry therefore names the bit its own cap is derived from:
540
+ * maxScriptElementSize/maxScriptSize/maxOpsPerScript -> isAfterGenesis()
541
+ * maxScriptNumLength -> isAfterChronicle(), then isAfterGenesis()
542
+ */
543
+ Interpreter.ERA_SENSITIVE_ERRORS = {
544
+ SCRIPT_ERR_PUSH_SIZE: {
545
+ cap: 'stack element size (capped at 520 bytes pre-Genesis, unbounded after)',
546
+ lifts: Interpreter.SCRIPT_UTXO_AFTER_GENESIS
547
+ },
548
+ SCRIPT_ERR_SCRIPT_SIZE: {
549
+ cap: 'total script size (capped at 10,000 bytes pre-Genesis, unbounded after)',
550
+ lifts: Interpreter.SCRIPT_UTXO_AFTER_GENESIS
551
+ },
552
+ SCRIPT_ERR_OP_COUNT: {
553
+ cap: 'opcode count (capped at 201 pre-Genesis, unbounded after)',
554
+ lifts: Interpreter.SCRIPT_UTXO_AFTER_GENESIS
555
+ },
556
+ SCRIPT_ERR_SCRIPTNUM_OVERFLOW: {
557
+ cap: 'script number width (4 bytes pre-Genesis, 750,000 after Genesis, 32,000,000 after Chronicle)',
558
+ lifts: Interpreter.SCRIPT_UTXO_AFTER_GENESIS | Interpreter.SCRIPT_UTXO_AFTER_CHRONICLE
559
+ }
560
+ }
561
+
562
+ /**
563
+ * Every era bit, kept for callers that want to ask "is this flag word era-aware at
564
+ * all". NOT used to gate the diagnostic — see ERA_SENSITIVE_ERRORS.lifts.
565
+ */
566
+ Interpreter.ERA_FLAGS =
567
+ Interpreter.SCRIPT_GENESIS |
568
+ Interpreter.SCRIPT_UTXO_AFTER_GENESIS |
569
+ Interpreter.SCRIPT_ENABLE_CHRONICLE |
570
+ Interpreter.SCRIPT_UTXO_AFTER_CHRONICLE
571
+
572
+ /** Set false to silence the notice. `eraHint` is still populated. */
573
+ Interpreter.eraDiagnostics =
574
+ !(typeof process !== 'undefined' && process.env && process.env.BSV_NO_ERA_HINT === '1')
575
+
576
+ var eraWarned = false
577
+
578
+ Interpreter.prototype._eraDiagnose = function (flags) {
579
+ // Only an EXPLICIT flag word can be wrong this way; omitting flags already
580
+ // resolves to current mainnet via currentConsensusFlags().
581
+ if (flags === undefined) return
582
+ var entry = Interpreter.ERA_SENSITIVE_ERRORS[this.errstr]
583
+ if (!entry) return
584
+ // Gate on the bit that lifts THIS cap, not on any era bit being present.
585
+ if ((flags & entry.lifts) !== 0) return
586
+ var cap = entry.cap
587
+
588
+ this.eraHint =
589
+ this.errstr + ' was produced under PRE-GENESIS limits: ' + cap + '.\n' +
590
+ 'The flags passed to verify() (0x' + (flags >>> 0).toString(16) + ') carry no era bit, ' +
591
+ 'so those caps applied regardless of which feature opcodes were enabled.\n' +
592
+ 'To validate against BSV as it is today, omit the flags argument or pass ' +
593
+ 'Interpreter.mainnetFlags(). If you are deliberately testing pre-Genesis ' +
594
+ 'consensus this failure is correct — set Interpreter.eraDiagnostics = false ' +
595
+ '(or BSV_NO_ERA_HINT=1) to silence this.'
596
+
597
+ if (Interpreter.eraDiagnostics && !eraWarned) {
598
+ eraWarned = true
599
+ console.warn('\n[@smartledger/bsv] ' + this.eraHint + '\n(shown once per process)\n')
600
+ }
601
+ }
602
+
603
+ /**
604
+ * Verify, then explain an era-caused failure if that is what happened.
605
+ * Wraps _verifyCore rather than editing its ten-odd early returns.
606
+ */
607
+ Interpreter.prototype.verify = function (scriptSig, scriptPubkey, tx, nin, flags, satoshisBN) {
608
+ this.eraHint = null
609
+ var ok = this._verifyCore(scriptSig, scriptPubkey, tx, nin, flags, satoshisBN)
610
+ if (!ok) this._eraDiagnose(flags)
611
+ return ok
612
+ }
613
+
614
+ /** Test hook: forget that the notice has been shown. */
615
+ Interpreter._resetEraWarning = function () { eraWarned = false }
616
+
509
617
  /**
510
618
  * The script-verification flags matching BSV mainnet consensus.
511
619
  *
@@ -20,6 +20,7 @@ var Hash = require('../crypto/hash')
20
20
  var BN = require('../crypto/bn')
21
21
  var Transaction = require('../transaction')
22
22
  var Script = require('../script')
23
+ var deprecate = require('../util/deprecate')
23
24
 
24
25
  /**
25
26
  * @deprecated NON-ENFORCING. `buildLockingScript` / `createCovenant` emit
@@ -57,6 +58,19 @@ function Builder(privateKey, options) {
57
58
  // The scripts this class builds are non-enforcing (see the class @deprecated note).
58
59
  // Refuse to hand one back as if it were a real covenant unless explicitly acknowledged.
59
60
  Builder.prototype._assertEnforcingAllowed = function () {
61
+ if (this.allowNonEnforcing) {
62
+ // Opting in is legitimate (demos, tests, the docs' worked examples) but it
63
+ // is not permanent. Say so once, and here rather than at construction, so the
64
+ // notice fires only for callers actually taking a script away with them.
65
+ deprecate({
66
+ what: 'SmartContract.Builder ({ allowNonEnforcing: true })',
67
+ since: '9.1.0',
68
+ removeIn: '10.0.0',
69
+ use: 'SmartContract.policy(), or SmartContract.PushTx / Token / valueCovenant',
70
+ why: 'the scripts it emits reduce to plain P2PK and constrain nothing about the spend'
71
+ })
72
+ return
73
+ }
60
74
  if (!this.allowNonEnforcing) {
61
75
  throw new Error(
62
76
  'SmartContract.Builder produces a NON-ENFORCING script (constant hash-lock → ' +