@smartledger/bsv 3.4.2 → 3.4.4

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 (88) hide show
  1. package/CHANGELOG.md +336 -0
  2. package/README.md +72 -72
  3. package/SECURITY.md +88 -0
  4. package/bin/cli.js +13 -8
  5. package/bsv-covenant.min.js +4 -4
  6. package/bsv-gdaf.min.js +5 -5
  7. package/bsv-ltp.min.js +7 -7
  8. package/bsv-smartcontract.min.js +5 -5
  9. package/bsv.bundle.js +5 -5
  10. package/bsv.d.ts +486 -9
  11. package/bsv.min.js +5 -5
  12. package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +2 -2
  13. package/docs/MODULE_REFERENCE_COMPLETE.md +61 -58
  14. package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +3 -3
  15. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  16. package/docs/getting-started/INSTALLATION.md +30 -30
  17. package/docs/getting-started/QUICK_START.md +18 -18
  18. package/docs/migration/FROM_BSV_1_5_6.md +16 -10
  19. package/gdaf-entry.js +1 -2
  20. package/index.js +20 -7
  21. package/lib/smart_contract/covenant.js +10 -1
  22. package/lib/smartutxo.js +20 -12
  23. package/lib/transaction/transaction.js +7 -0
  24. package/ltp-entry.js +1 -2
  25. package/package.json +3 -3
  26. package/utilities/blockchain-state.js +32 -23
  27. package/demos/README.md +0 -188
  28. package/demos/architecture_demo.js +0 -247
  29. package/demos/browser-test.html +0 -1208
  30. package/demos/bsv_wallet_demo.js +0 -242
  31. package/demos/complete_ltp_demo.js +0 -511
  32. package/demos/debug_tools_demo.js +0 -87
  33. package/demos/demo_features.js +0 -123
  34. package/demos/easy_interface_demo.js +0 -109
  35. package/demos/ecies_demo.js +0 -182
  36. package/demos/gdaf_demo.js +0 -237
  37. package/demos/ltp_demo.js +0 -361
  38. package/demos/ltp_primitives_demo.js +0 -403
  39. package/demos/message_demo.js +0 -209
  40. package/demos/preimage_separation_demo.js +0 -383
  41. package/demos/script_helper_demo.js +0 -289
  42. package/demos/security_demo.js +0 -287
  43. package/demos/shamir_demo.js +0 -121
  44. package/demos/simple_demo.js +0 -204
  45. package/demos/simple_p2pkh_demo.js +0 -169
  46. package/demos/simple_utxo_preimage_demo.js +0 -196
  47. package/demos/smart_contract_demo.html +0 -1347
  48. package/demos/smart_contract_demo.js +0 -910
  49. package/demos/utxo_generator_demo.js +0 -244
  50. package/demos/validation_pipeline_demo.js +0 -155
  51. package/demos/web3keys.html +0 -740
  52. package/examples/README.md +0 -200
  53. package/examples/basic/transaction-creation.js +0 -534
  54. package/examples/basic/transaction_signature_api_gap.js +0 -178
  55. package/examples/complete_workflow_demo.js +0 -783
  56. package/examples/covenants/advanced_covenant_demo.js +0 -219
  57. package/examples/covenants/covenant_interface_demo.js +0 -270
  58. package/examples/covenants/covenant_manual_signature_resolved.js +0 -212
  59. package/examples/covenants/covenant_signature_template.js +0 -117
  60. package/examples/covenants2/covenant_bidirectional_example.js +0 -262
  61. package/examples/covenants2/covenant_utils_demo.js +0 -120
  62. package/examples/covenants2/preimage_covenant_utils.js +0 -287
  63. package/examples/covenants2/production_integration.js +0 -256
  64. package/examples/data/covenant_utxos.json +0 -28
  65. package/examples/data/utxos.json +0 -26
  66. package/examples/definitive_working_demo.js +0 -261
  67. package/examples/final_working_contracts.js +0 -338
  68. package/examples/legacy/README.md +0 -11
  69. package/examples/legacy/smart_contract_test_integration.js +0 -269
  70. package/examples/legacy/test_builtin_verify.js +0 -117
  71. package/examples/legacy/test_debug_integration.js +0 -71
  72. package/examples/legacy/test_ecdsa_little.js +0 -70
  73. package/examples/legacy/test_shamir.js +0 -221
  74. package/examples/legacy/test_smartverify_der.js +0 -110
  75. package/examples/preimage/README.md +0 -178
  76. package/examples/preimage/extract_preimage_bidirectional.js +0 -421
  77. package/examples/preimage/generate_sample_preimage.js +0 -208
  78. package/examples/preimage/generate_sighash_examples.js +0 -152
  79. package/examples/preimage/parse_preimage.js +0 -117
  80. package/examples/preimage/test_preimage_extractor.js +0 -53
  81. package/examples/preimage/test_varint_extraction.js +0 -95
  82. package/examples/scripts/custom_script_helper_example.js +0 -273
  83. package/examples/scripts/script_interpreter.js +0 -193
  84. package/examples/smart_contract/complete_workflow_demo.js +0 -343
  85. package/examples/smart_contract/covenant_builder_demo.js +0 -176
  86. package/examples/smart_contract/script_testing_integration.js +0 -198
  87. package/examples/smart_contract_templates.js +0 -718
  88. package/examples/working_smart_contracts.js +0 -348
@@ -136,9 +136,9 @@ node custom_script_signature_test.js
136
136
  ## 📦 Installation
137
137
 
138
138
  ```bash
139
- npm install smartledger-bsv@3.1.1
139
+ npm install smartledger-bsv@3.4.0
140
140
  # or
141
- npm install @smartledger/bsv@3.1.1
141
+ npm install @smartledger/bsv@3.4.4
142
142
  ```
143
143
 
144
144
  ## ✅ Verification Results
@@ -15,17 +15,17 @@ Based on actual library analysis, SmartLedger-BSV provides **12 distinct modules
15
15
 
16
16
  | Module | File | Size | Purpose | Status in Docs |
17
17
  |--------|------|------|---------|----------------|
18
- | **bsv.min.js** | Core BSV + SmartContract | 449KB | Complete BSV development | ✅ Documented |
19
- | **bsv.bundle.js** | Everything in one | 885KB | All features included | ⚠️ Size wrong (764KB→885KB) |
18
+ | **bsv.min.js** | Core BSV + SmartContract | 937KB | Complete BSV development | ✅ Documented |
19
+ | **bsv.bundle.js** | Everything in one | 937KB | All features included | Documented |
20
20
 
21
21
  ### **Specialized Modules**
22
22
 
23
23
  | Module | File | Size | Purpose | Status in Docs |
24
24
  |--------|------|------|---------|----------------|
25
- | **bsv-smartcontract.min.js** | SmartContract framework | 451KB | Covenant development | ✅ Documented |
26
- | **bsv-covenant.min.js** | Covenant interface | 32KB | Covenant operations | ✅ Documented |
27
- | **bsv-script-helper.min.js** | Custom script tools | 27KB | Script development | ✅ Documented |
28
- | **bsv-security.min.js** | Security enhancements | 290KB | Hardened crypto | ✅ Documented |
25
+ | **bsv-smartcontract.min.js** | SmartContract framework | 937KB | Covenant development | ✅ Documented |
26
+ | **bsv-covenant.min.js** | Covenant interface | 913KB | Covenant operations | ✅ Documented |
27
+ | **bsv-script-helper.min.js** | Custom script tools | 26KB | Script development | ✅ Documented |
28
+ | **bsv-security.min.js** | Security enhancements (opt-in helpers) | 26KB | `SmartVerify` / `EllipticFixed` | ✅ Documented |
29
29
 
30
30
  ### **Utility Modules**
31
31
 
@@ -33,15 +33,15 @@ Based on actual library analysis, SmartLedger-BSV provides **12 distinct modules
33
33
  |--------|------|------|---------|----------------|
34
34
  | **bsv-ecies.min.js** | ECIES encryption | 71KB | Message encryption | ✅ Documented |
35
35
  | **bsv-message.min.js** | Message signing | 26KB | Message operations | ✅ Documented |
36
- | **bsv-mnemonic.min.js** | HD wallet support | 670KB | Mnemonic operations | ✅ Documented |
36
+ | **bsv-mnemonic.min.js** | HD wallet support | 681KB | Mnemonic operations | ✅ Documented |
37
37
 
38
38
  ### **🆕 Advanced Modules (Missing from Documentation!)**
39
39
 
40
40
  | Module | File | Size | Purpose | Status in Docs |
41
41
  |--------|------|------|---------|----------------|
42
- | **🔐 bsv-shamir.min.js** | Shamir Secret Sharing | 433KB | Threshold cryptography | **NOT DOCUMENTED** |
43
- | **🌐 bsv-gdaf.min.js** | Global Digital Attestation | 604KB | Verifiable credentials | **NOT DOCUMENTED** |
44
- | **⚖️ bsv-ltp.min.js** | Legal Token Protocol | 817KB | Legal compliance tokens | **NOT DOCUMENTED** |
42
+ | **🔐 bsv-shamir.min.js** | Shamir Secret Sharing | 432KB | Threshold cryptography | Documented |
43
+ | **🌐 bsv-gdaf.min.js** | Global Digital Attestation | 1184KB | Verifiable credentials | Documented |
44
+ | **⚖️ bsv-ltp.min.js** | Legal Token Protocol | 1184KB | Legal compliance tokens | Documented |
45
45
 
46
46
  ---
47
47
 
@@ -49,32 +49,31 @@ Based on actual library analysis, SmartLedger-BSV provides **12 distinct modules
49
49
 
50
50
  ### **1. Missing Advanced Modules (40% of library undocumented!)**
51
51
 
52
- Three major modules totaling **1.82MB** of functionality are completely missing from documentation:
52
+ Three advanced modules totaling **~2.7MB** of functionality:
53
53
 
54
- #### **🔐 Shamir Secret Sharing (433KB)**
54
+ #### **🔐 Shamir Secret Sharing (432KB)**
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@3.3.4/bsv-shamir.min.js`
58
+ - **CDN**: `unpkg.com/@smartledger/bsv@3.4.4/bsv-shamir.min.js`
59
59
 
60
- #### **🌐 Global Digital Attestation Framework - GDAF (604KB)**
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@3.3.4/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js`
65
65
 
66
- #### **⚖️ Legal Token Protocol - LTP (817KB)**
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@3.3.4/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js`
71
71
 
72
72
  ### **2. Incorrect File Sizes in Documentation**
73
73
 
74
74
  | Module | Documented Size | Actual Size | Difference |
75
75
  |--------|----------------|-------------|------------|
76
- | `bsv.bundle.js` | 764KB | 885KB | +121KB (+16%) |
77
- | All others | Accurate | Accurate | ✅ Correct |
76
+ | All bundles | Documented | Match disk | Resolved as of v3.4.4 |
78
77
 
79
78
  ---
80
79
 
@@ -82,41 +81,41 @@ Three major modules totaling **1.82MB** of functionality are completely missing
82
81
 
83
82
  | Module | Size | Use Case | CDN Link |
84
83
  |--------|------|----------|----------|
85
- | **bsv.min.js** | 449KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js` |
86
- | **bsv.bundle.js** | 885KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js` |
87
- | **bsv-smartcontract.min.js** | 451KB | Covenant development | `unpkg.com/@smartledger/bsv@3.3.4/bsv-smartcontract.min.js` |
88
- | **bsv-covenant.min.js** | 32KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.3.4/bsv-covenant.min.js` |
89
- | **bsv-script-helper.min.js** | 27KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.3.4/bsv-script-helper.min.js` |
90
- | **bsv-security.min.js** | 290KB | Security enhancements | `unpkg.com/@smartledger/bsv@3.3.4/bsv-security.min.js` |
91
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.3.4/bsv-ecies.min.js` |
92
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.3.4/bsv-message.min.js` |
93
- | **bsv-mnemonic.min.js** | 670KB | HD wallets | `unpkg.com/@smartledger/bsv@3.3.4/bsv-mnemonic.min.js` |
94
- | **🆕 bsv-shamir.min.js** | 433KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@3.3.4/bsv-shamir.min.js` |
95
- | **🆕 bsv-gdaf.min.js** | 604KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@3.3.4/bsv-gdaf.min.js` |
96
- | **🆕 bsv-ltp.min.js** | 817KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@3.3.4/bsv-ltp.min.js` |
84
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.4.4/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.4.4/bsv-script-helper.min.js` |
89
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@3.4.4/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.4.4/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.4.4/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@3.4.4/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js` |
97
96
 
98
97
  ## 🎯 **Updated Usage Examples**
99
98
 
100
99
  ### **Complete Loading Strategy Examples**
101
100
 
102
- #### **1. Basic Development (476KB)**
101
+ #### **1. Basic Development (~963KB)**
103
102
  ```html
104
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
105
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-script-helper.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-script-helper.min.js"></script>
106
105
  ```
107
106
 
108
- #### **2. Smart Contract Development (932KB)**
107
+ #### **2. Smart Contract Development (~2.7MB — each bundle re-embeds core BSV)**
109
108
  ```html
110
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
111
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-covenant.min.js"></script>
112
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-smartcontract.min.js"></script>
109
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js"></script>
113
112
  ```
114
113
 
115
- #### **3. 🆕 Legal & Compliance Development (1.7MB)**
114
+ #### **3. 🆕 Legal & Compliance Development (~3.2MB — each bundle re-embeds core BSV)**
116
115
  ```html
117
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
118
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-ltp.min.js"></script>
119
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-gdaf.min.js"></script>
116
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js"></script>
120
119
  <script>
121
120
  // Legal Token Protocol
122
121
  const legalToken = bsv.createLegalToken({
@@ -131,11 +130,11 @@ Three major modules totaling **1.82MB** of functionality are completely missing
131
130
  </script>
132
131
  ```
133
132
 
134
- #### **4. 🆕 Security & Cryptography (1.35MB)**
133
+ #### **4. 🆕 Security & Cryptography (~1.4MB)**
135
134
  ```html
136
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
137
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-security.min.js"></script>
138
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-shamir.min.js"></script>
135
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-shamir.min.js"></script>
139
138
  <script>
140
139
  // Shamir Secret Sharing
141
140
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -145,9 +144,9 @@ Three major modules totaling **1.82MB** of functionality are completely missing
145
144
  </script>
146
145
  ```
147
146
 
148
- #### **5. Everything Bundle (885KB)**
147
+ #### **5. Everything Bundle (937KB)**
149
148
  ```html
150
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js"></script>
151
150
  <script>
152
151
  // Everything available immediately
153
152
  const shares = bsv.splitSecret('secret', 5, 3);
@@ -249,16 +248,20 @@ const obligationPrep = bsv.prepareObligationToken('PaymentObligation', issuerDID
249
248
 
250
249
  ## 📈 **Module Size Analysis**
251
250
 
252
- ### **Total Library Capabilities**: 4.82MB across 12 modules
251
+ ### **Total Library Capabilities**: ~8.9MB across 16 standalone bundles
253
252
 
254
- | Category | Modules | Total Size | Percentage |
255
- |----------|---------|------------|------------|
256
- | **Core & Smart Contracts** | 4 modules | 1.39MB | 29% |
257
- | **🆕 Legal & Identity** | 2 modules | 1.42MB | 29% |
258
- | **Utilities** | 3 modules | 767KB | 16% |
259
- | **🆕 Advanced Crypto** | 1 module | 433KB | 9% |
260
- | **Security** | 1 module | 290KB | 6% |
261
- | **Everything Bundle** | 1 file | 885KB | 18% |
253
+ Each standalone bundle is self-contained (it re-embeds core BSV at ~937KB),
254
+ so the total is the sum of independently-loadable file sizes — not the
255
+ working-set size if you load multiple.
256
+
257
+ | Category | Modules | Total Size |
258
+ |----------|---------|------------|
259
+ | **Core / Smart Contracts** | bsv.min, bsv.bundle, bsv-smartcontract, bsv-covenant, bsv-script-helper | ~3.75MB |
260
+ | **🆕 Credentials (3.4.x)** | bsv-didweb, bsv-vcjwt, bsv-statuslist, bsv-anchor | ~1.65MB |
261
+ | **🆕 Legal & Identity** | bsv-ltp, bsv-gdaf | ~2.31MB |
262
+ | **Utilities** | bsv-ecies, bsv-message, bsv-mnemonic | ~778KB |
263
+ | **🆕 Advanced Crypto** | bsv-shamir | 432KB |
264
+ | **Security** | bsv-security | 26KB |
262
265
 
263
266
  ### **Modular Loading Benefits**
264
267
 
@@ -276,7 +279,7 @@ const obligationPrep = bsv.prepareObligationToken('PaymentObligation', issuerDID
276
279
  **Files to Update:**
277
280
  - `README.md` - Add 3 new modules to loading options table
278
281
  - `README.md` - Add usage examples for Shamir, GDAF, LTP
279
- - `README.md` - Update file sizes (bundle.js: 764KB → 885KB)
282
+ - ~~`README.md` - Update file sizes (bundle.js: 764KB → 885KB)~~ — resolved; bundle.js is now 937KB and accurate everywhere
280
283
 
281
284
  **New Sections Needed:**
282
285
  - Shamir Secret Sharing usage guide
@@ -165,7 +165,7 @@ LTP is built on top of SmartLedger-BSV's modular architecture and integrates sea
165
165
 
166
166
  #### **Foundation Layer (Required)**
167
167
  - **Core BSV (`bsv.min.js`)**: Provides Bitcoin SV primitives (keys, transactions, addresses)
168
- - **Cryptographic Functions**: Uses hardened elliptic curve implementations for all signatures
168
+ - **Cryptographic Functions**: Token signing uses BSV's standard ECDSA path (the same one used by Bitcoin transaction signing). For stricter verification of incoming tokens from untrusted sources, callers can route verification through `bsv.SmartVerify.smartVerify(...)` explicitly — it is not on by default. See [README › Security](../../README.md#-security).
169
169
 
170
170
  #### **Identity Layer (Recommended)**
171
171
  - **GDAF Module (`bsv-gdaf.min.js`)**: Provides DID creation and Verifiable Credential standards
@@ -242,7 +242,7 @@ const propertyToken = bsv.createRightToken({
242
242
  type: 'PropertyTitle', // LTP: Legal structure
243
243
  owner: ownerDID, // GDAF: Digital identity
244
244
  jurisdiction: 'US-CA', // LTP: Legal compliance
245
- // Signed with hardened crypto // Core: Enhanced security
245
+ // Signed with BSV's standard ECDSA // Core: Bitcoin SV signature
246
246
  // Can be covenant-protected // SmartContract: Enforcement
247
247
  // Keys can use Shamir sharing // Shamir: Distributed control
248
248
  });
@@ -301,7 +301,7 @@ const anchor = bsv.LTP.Anchor.prepareCommitment(rightToken); // 6. Pr
301
301
 
302
302
  ## 🔐 Security & Trust Features
303
303
 
304
- - **🔒 Cryptographic Signatures** - All tokens signed with enhanced elliptic curves
304
+ - **🔒 Cryptographic Signatures** - Tokens signed with BSV's standard secp256k1 ECDSA path. Opt-in `bsv.SmartVerify` available for stricter verification of incoming tokens.
305
305
  - **🎭 Selective Disclosure** - Privacy-preserving proof generation with zero-knowledge
306
306
  - **⚖️ Legal Validity Proofs** - Jurisdiction-specific compliance verification
307
307
  - **⛓️ Blockchain Anchoring** - Immutable commitment proofs on BSV blockchain
@@ -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@3.3.4/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@3.4.4/bsv.min.js"></script>
726
726
  </head>
727
727
  <body>
728
728
  <script>
@@ -12,10 +12,10 @@ SmartLedger-BSV offers multiple installation methods to suit different developme
12
12
  npm install @smartledger/bsv
13
13
 
14
14
  # Install specific version
15
- npm install @smartledger/bsv@3.3.4
15
+ npm install @smartledger/bsv@3.4.4
16
16
 
17
17
  # Install with exact version lock
18
- npm install --save-exact @smartledger/bsv@3.3.4
18
+ npm install --save-exact @smartledger/bsv@3.4.4
19
19
  ```
20
20
 
21
21
  ### **Usage in Node.js**
@@ -45,20 +45,20 @@ const tx: Transaction = new Transaction();
45
45
 
46
46
  ### **CDN Links (Instant Setup)**
47
47
 
48
- #### **Core Library Only (449KB)**
48
+ #### **Core Library Only (937KB)**
49
49
  For basic Bitcoin SV operations:
50
50
  ```html
51
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
51
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
52
52
  <script>
53
53
  const privateKey = new bsv.PrivateKey();
54
54
  const address = privateKey.toAddress();
55
55
  </script>
56
56
  ```
57
57
 
58
- #### **Complete Bundle (885KB)**
58
+ #### **Complete Bundle (937KB)**
59
59
  Everything in one file:
60
60
  ```html
61
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js"></script>
62
62
  <script>
63
63
  // All features available immediately
64
64
  const shares = bsv.splitSecret('secret', 5, 3);
@@ -69,22 +69,22 @@ Everything in one file:
69
69
 
70
70
  ### **Modular Loading (Choose What You Need)**
71
71
 
72
- #### **Smart Contract Development (932KB total)**
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@3.3.4/bsv.min.js"></script>
75
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-covenant.min.js"></script>
76
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-smartcontract.min.js"></script>
74
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js"></script>
77
77
  <script>
78
78
  const covenant = bsv.SmartContract.createCovenantBuilder()
79
79
  .extractField('amount').push(50000).greaterThanOrEqual().build();
80
80
  </script>
81
81
  ```
82
82
 
83
- #### **Legal & Identity Development (1.87MB total)**
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@3.3.4/bsv.min.js"></script>
86
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-ltp.min.js"></script>
87
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-gdaf.min.js"></script>
85
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js"></script>
88
88
  <script>
89
89
  // Legal Token Protocol
90
90
  const propertyToken = bsv.createPropertyToken({
@@ -96,11 +96,11 @@ Everything in one file:
96
96
  </script>
97
97
  ```
98
98
 
99
- #### **Security & Cryptography (1.17MB total)**
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@3.3.4/bsv.min.js"></script>
102
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-security.min.js"></script>
103
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-shamir.min.js"></script>
101
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/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** | 449KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js` |
118
- | **bsv.bundle.js** | 885KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js` |
119
- | **bsv-smartcontract.min.js** | 451KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@3.3.4/bsv-smartcontract.min.js` |
120
- | **bsv-ltp.min.js** | 817KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@3.3.4/bsv-ltp.min.js` |
121
- | **bsv-gdaf.min.js** | 604KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@3.3.4/bsv-gdaf.min.js` |
122
- | **bsv-shamir.min.js** | 433KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@3.3.4/bsv-shamir.min.js` |
123
- | **bsv-security.min.js** | 290KB | Security enhancements | `unpkg.com/@smartledger/bsv@3.3.4/bsv-security.min.js` |
124
- | **bsv-mnemonic.min.js** | 670KB | HD wallets | `unpkg.com/@smartledger/bsv@3.3.4/bsv-mnemonic.min.js` |
125
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.3.4/bsv-ecies.min.js` |
126
- | **bsv-covenant.min.js** | 32KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.3.4/bsv-covenant.min.js` |
127
- | **bsv-script-helper.min.js** | 27KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.3.4/bsv-script-helper.min.js` |
128
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.3.4/bsv-message.min.js` |
117
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@3.4.4/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@3.4.4/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.4.4/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.4.4/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.4.4/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.4.4/bsv-message.min.js` |
129
129
 
130
130
  ## ⚙️ **Development Environment Setup**
131
131
 
@@ -13,11 +13,11 @@ npm install @smartledger/bsv
13
13
 
14
14
  ### Browser CDN (Instant)
15
15
  ```html
16
- <!-- Core library (449KB) -->
17
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
16
+ <!-- Core library (937KB) -->
17
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
18
18
 
19
- <!-- Everything included (885KB) -->
20
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js"></script>
19
+ <!-- Everything included (937KB) -->
20
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js"></script>
21
21
  ```
22
22
 
23
23
  ## 💰 **Your First Transaction (60 seconds)**
@@ -126,28 +126,28 @@ const amount = preimage.getField('amount');
126
126
  SmartLedger-BSV offers 12 different loading options - use only what you need:
127
127
 
128
128
  ```html
129
- <!-- Core BSV only (449KB) -->
130
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
129
+ <!-- Core BSV only (937KB) -->
130
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
131
131
 
132
- <!-- Smart contracts (873KB) -->
133
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-smartcontract.min.js"></script>
132
+ <!-- Smart contracts (937KB) -->
133
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js"></script>
134
134
 
135
- <!-- Legal tokens (1.1MB) -->
136
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-ltp.min.js"></script>
135
+ <!-- Legal tokens (1.16MB) -->
136
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js"></script>
137
137
 
138
- <!-- Digital identity (1.1MB) -->
139
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-gdaf.min.js"></script>
138
+ <!-- Digital identity (1.16MB) -->
139
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js"></script>
140
140
 
141
- <!-- Everything (885KB) -->
142
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js"></script>
141
+ <!-- Everything (937KB) -->
142
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js"></script>
143
143
  ```
144
144
 
145
145
  ## ⚡ **Key Advantages**
146
146
 
147
- ### **Security First**
148
- - ✅ **Elliptic curve hardening** - Enhanced cryptographic security
149
- - ✅ **Production tested** - Battle-tested in real applications
150
- - ✅ **Comprehensive validation** - Built-in error checking
147
+ ### **Security helpers (opt-in)**
148
+ - ✅ **`bsv.SmartVerify` / `bsv.EllipticFixed`** - hardened verify with strict input validation and low-`s` canonicalization. Call explicitly; the default `signature.verify()` does **not** route through them. See [README › Security](../../README.md#-security).
149
+ - ✅ **Pinned dependencies** - `elliptic@6.6.1` (upstream-patched), `bn.js@4.11.9`, `bs58@4.0.1`
150
+ - ✅ **Comprehensive validation** - Built-in error checking and 534+ mocha tests
151
151
 
152
152
  ### **Developer Experience**
153
153
  - ✅ **Zero breaking changes** - Drop-in replacement for bsv@1.5.6
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Seamless upgrade path with zero breaking changes**
4
4
 
5
- SmartLedger-BSV is designed as a **100% backward-compatible** drop-in replacement for bsv@1.5.6. Your existing code will work unchanged while gaining access to enhanced security and powerful new features.
5
+ SmartLedger-BSV is designed as a **100% backward-compatible** drop-in replacement for bsv@1.5.6. Your existing code will work unchanged while gaining access to optional hardening helpers and powerful new features.
6
6
 
7
7
  ## 🔄 **Instant Migration (30 seconds)**
8
8
 
@@ -73,13 +73,19 @@ const hdKey = bsv.HDPrivateKey.fromSeed(mnemonic.toSeed());
73
73
 
74
74
  ## 🚀 **What You Gain (No Code Changes Required)**
75
75
 
76
- ### **Enhanced Security**
76
+ ### **Optional hardening helpers (opt-in)**
77
77
  ```javascript
78
- // Same API, enhanced security under the hood
79
- const privateKey = new bsv.PrivateKey(); // Now with hardened elliptic curves
80
- const signature = privateKey.sign(hash); // Enhanced cryptographic operations
78
+ // Standard API behaves identically to bsv@1.5.6
79
+ const privateKey = new bsv.PrivateKey();
80
+ const signature = privateKey.sign(hash);
81
+
82
+ // Opt-in: stricter verification helpers that reject malformed signatures
83
+ // (r=0, s=0, r>=n, s>=n) and canonicalize s to the low half. Call explicitly.
84
+ const ok = bsv.SmartVerify.smartVerify(msgHashBuffer, derSigBuffer, publicKey);
81
85
  ```
82
86
 
87
+ > **Note:** the standard `signature.verify()` / `transaction.verify()` / `Message().verify()` paths in this library use BSV's own pure-JS ECDSA and are **not** routed through `SmartVerify` or `EllipticFixed` by default. See the [Security section in the README](../../README.md#-security) for details on what's opt-in vs. on by default.
88
+
83
89
  ### **Improved Performance**
84
90
  - ✅ **Optimized operations** - Faster transaction creation and signing
85
91
  - ✅ **Better memory usage** - Reduced memory footprint
@@ -153,17 +159,17 @@ const recovered = bsv.reconstructSecret([shares[0], shares[2], shares[4]]);
153
159
  ### **New Modular Options**
154
160
  ```html
155
161
  <!-- Core compatibility (same size as bsv@1.5.6) -->
156
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
162
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
157
163
 
158
164
  <!-- Add smart contracts when ready -->
159
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-smartcontract.min.js"></script>
165
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js"></script>
160
166
 
161
167
  <!-- Add advanced features as needed -->
162
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-ltp.min.js"></script>
163
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-gdaf.min.js"></script>
168
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js"></script>
169
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js"></script>
164
170
 
165
171
  <!-- Everything in one file -->
166
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js"></script>
172
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js"></script>
167
173
  ```
168
174
 
169
175
  ## 🔍 **Testing Your Migration**
package/gdaf-entry.js CHANGED
@@ -1,2 +1 @@
1
- // GDAF module placeholder - will be implemented in future release
2
- module.exports = require('./lib/smart_contract');
1
+ module.exports = require('./lib/gdaf')
package/index.js CHANGED
@@ -2,17 +2,30 @@
2
2
 
3
3
  var bsv = module.exports
4
4
 
5
- // Initialize dependencies first to avoid circular dependency issues
5
+ // Initialize dependencies first to avoid circular dependency issues.
6
+ //
7
+ // `bn.js`, `bs58`, and `elliptic` are declared runtime deps in
8
+ // package.json. In Node they MUST be installed — silently swallowing
9
+ // a require() failure here used to mask broken installs behind cryptic
10
+ // downstream errors in lib/crypto/bn.js etc. We now let those throw in
11
+ // Node so the failure points at the real cause (`npm install` is broken).
12
+ // In a browser context the bundler is expected to inline these; if it
13
+ // somehow didn't, we tolerate the absence rather than block the whole
14
+ // library load.
6
15
  bsv.deps = bsv.deps || {}
7
- try {
16
+ bsv.deps._ = require('./lib/util/_')
17
+ bsv.deps.Buffer = (typeof Buffer !== 'undefined') ? Buffer : null
18
+
19
+ if (typeof window === 'undefined') {
20
+ // Node — hard require; failure means broken install.
8
21
  bsv.deps.bnjs = require('bn.js')
9
22
  bsv.deps.bs58 = require('bs58')
10
- bsv.deps.Buffer = (typeof Buffer !== 'undefined') ? Buffer : null
11
23
  bsv.deps.elliptic = require('elliptic')
12
- bsv.deps._ = require('./lib/util/_')
13
- } catch (e) {
14
- // Handle browser environment gracefully
15
- console.warn('Some dependencies may not be available in browser environment:', e.message)
24
+ } else {
25
+ // Browser bundler-resolved; tolerate absence individually.
26
+ try { bsv.deps.bnjs = require('bn.js') } catch (e) { /* polyfilled by bundler */ }
27
+ try { bsv.deps.bs58 = require('bs58') } catch (e) { /* polyfilled by bundler */ }
28
+ try { bsv.deps.elliptic = require('elliptic') } catch (e) { /* polyfilled by bundler */ }
16
29
  }
17
30
 
18
31
  // module information
@@ -26,6 +26,15 @@ try {
26
26
  fs = null
27
27
  }
28
28
 
29
+ // Set BSV_DEBUG=1 (Node) or window.BSV_DEBUG = true (browser) to surface
30
+ // informational warnings from this module. Matches the gating pattern
31
+ // used by lib/browser-utxo-manager-es5.js since v3.4.1.
32
+ var debug = function () {
33
+ var enabled = (typeof process !== 'undefined' && process.env && process.env.BSV_DEBUG) ||
34
+ (typeof window !== 'undefined' && window.BSV_DEBUG)
35
+ if (enabled) console.log.apply(console, arguments)
36
+ }
37
+
29
38
  /**
30
39
  * Covenant Class - Advanced covenant management
31
40
  * @param {PrivateKey} privateKey - Private key for covenant operations
@@ -212,7 +221,7 @@ Covenant.prototype.validate = function(spendingTx, covenantUtxo) {
212
221
  */
213
222
  Covenant.prototype.save = function(covenantUtxo) {
214
223
  if (!fs) {
215
- console.warn('File system operations not available in browser environment')
224
+ debug('File system operations not available in browser environment')
216
225
  return covenantUtxo
217
226
  }
218
227