@smartledger/bsv 4.0.0 → 4.0.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.
@@ -136,9 +136,9 @@ node custom_script_signature_test.js
136
136
  ## 📦 Installation
137
137
 
138
138
  ```bash
139
- npm install smartledger-bsv@3.4.5
139
+ npm install smartledger-bsv@4.0.1
140
140
  # or
141
- npm install @smartledger/bsv@3.4.5
141
+ npm install @smartledger/bsv@4.0.1
142
142
  ```
143
143
 
144
144
  ## ✅ Verification Results
@@ -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@3.4.5/bsv-shamir.min.js`
58
+ - **CDN**: `unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv-gdaf.min.js`
64
+ - **CDN**: `unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv-ltp.min.js`
70
+ - **CDN**: `unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js` |
85
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.4.5/bsv.bundle.js` |
86
- | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js` |
87
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.4.5/bsv-covenant.min.js` |
88
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.4.5/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.5/bsv-security.min.js` |
90
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.4.5/bsv-ecies.min.js` |
91
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.4.5/bsv-message.min.js` |
92
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@3.4.5/bsv-mnemonic.min.js` |
93
- | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-shamir.min.js` |
94
- | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-gdaf.min.js` |
95
- | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-ltp.min.js` |
84
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js` |
85
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@4.0.1/bsv.bundle.js` |
86
+ | **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@4.0.1/bsv-smartcontract.min.js` |
87
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@4.0.1/bsv-covenant.min.js` |
88
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@4.0.1/bsv-script-helper.min.js` |
89
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@4.0.1/bsv-security.min.js` |
90
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@4.0.1/bsv-ecies.min.js` |
91
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@4.0.1/bsv-message.min.js` |
92
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@4.0.1/bsv-mnemonic.min.js` |
93
+ | **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@4.0.1/bsv-shamir.min.js` |
94
+ | **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@4.0.1/bsv-gdaf.min.js` |
95
+ | **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
104
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-script-helper.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
104
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
110
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-covenant.min.js"></script>
111
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js"></script>
109
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
110
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-covenant.min.js"></script>
111
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
117
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-ltp.min.js"></script>
118
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-gdaf.min.js"></script>
116
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
117
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-ltp.min.js"></script>
118
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
136
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-security.min.js"></script>
137
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-shamir.min.js"></script>
135
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-security.min.js"></script>
137
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.bundle.js"></script>
149
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
725
+ <script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@4.0.1/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.4.5
15
+ npm install @smartledger/bsv@4.0.1
16
16
 
17
17
  # Install with exact version lock
18
- npm install --save-exact @smartledger/bsv@3.4.5
18
+ npm install --save-exact @smartledger/bsv@4.0.1
19
19
  ```
20
20
 
21
21
  ### **Usage in Node.js**
@@ -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@3.4.5/bsv.min.js"></script>
51
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.bundle.js"></script>
61
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
75
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-covenant.min.js"></script>
76
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js"></script>
74
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
75
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-covenant.min.js"></script>
76
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
86
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-ltp.min.js"></script>
87
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-gdaf.min.js"></script>
85
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
86
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-ltp.min.js"></script>
87
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
102
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-security.min.js"></script>
103
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-shamir.min.js"></script>
101
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
102
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-security.min.js"></script>
103
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js` |
118
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.4.5/bsv.bundle.js` |
119
- | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js` |
120
- | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-ltp.min.js` |
121
- | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-gdaf.min.js` |
122
- | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-shamir.min.js` |
123
- | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@3.4.5/bsv-security.min.js` |
124
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@3.4.5/bsv-mnemonic.min.js` |
125
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.4.5/bsv-ecies.min.js` |
126
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.4.5/bsv-covenant.min.js` |
127
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.4.5/bsv-script-helper.min.js` |
128
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.4.5/bsv-message.min.js` |
117
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js` |
118
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@4.0.1/bsv.bundle.js` |
119
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@4.0.1/bsv-smartcontract.min.js` |
120
+ | **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@4.0.1/bsv-ltp.min.js` |
121
+ | **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@4.0.1/bsv-gdaf.min.js` |
122
+ | **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@4.0.1/bsv-shamir.min.js` |
123
+ | **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@4.0.1/bsv-security.min.js` |
124
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@4.0.1/bsv-mnemonic.min.js` |
125
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@4.0.1/bsv-ecies.min.js` |
126
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@4.0.1/bsv-covenant.min.js` |
127
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@4.0.1/bsv-script-helper.min.js` |
128
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
17
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
18
18
 
19
19
  <!-- Everything included (937KB) -->
20
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.bundle.js"></script>
20
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
130
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
131
131
 
132
132
  <!-- Smart contracts (937KB) -->
133
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js"></script>
133
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-smartcontract.min.js"></script>
134
134
 
135
135
  <!-- Legal tokens (1.16MB) -->
136
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-ltp.min.js"></script>
136
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-ltp.min.js"></script>
137
137
 
138
138
  <!-- Digital identity (1.16MB) -->
139
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-gdaf.min.js"></script>
139
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-gdaf.min.js"></script>
140
140
 
141
141
  <!-- Everything (937KB) -->
142
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.bundle.js"></script>
142
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.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@3.4.5/bsv.min.js"></script>
162
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.min.js"></script>
163
163
 
164
164
  <!-- Add smart contracts when ready -->
165
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js"></script>
165
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-smartcontract.min.js"></script>
166
166
 
167
167
  <!-- Add advanced features as needed -->
168
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-ltp.min.js"></script>
169
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-gdaf.min.js"></script>
168
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-ltp.min.js"></script>
169
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv-gdaf.min.js"></script>
170
170
 
171
171
  <!-- Everything in one file -->
172
- <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.bundle.js"></script>
172
+ <script src="https://unpkg.com/@smartledger/bsv@4.0.1/bsv.bundle.js"></script>
173
173
  ```
174
174
 
175
175
  ## 🔍 **Testing Your Migration**
package/index.js CHANGED
@@ -148,7 +148,35 @@ try {
148
148
  // Node.js specific tools (advanced development tools)
149
149
  if (typeof window === 'undefined' && typeof require === 'function') {
150
150
  try {
151
- bsv.SmartUTXO = require('./lib/smartutxo')
151
+ // bsv.SmartUTXO is a development-only file-backed UTXO simulator.
152
+ // It writes to node_modules/@smartledger/bsv/utilities/blockchain-state.json,
153
+ // races on shared filesystem state across processes, and only ships with
154
+ // an empty seed (the 3.3 MB dev fixture is npmignored). Exposing it on
155
+ // the main `bsv` namespace creates a real footgun for anyone who assumes
156
+ // a production UTXO manager.
157
+ //
158
+ // Soft-deprecated in v4.0.1: the symbol is preserved (no semver break)
159
+ // but access surfaces a one-shot warning. Direct import remains:
160
+ // require('@smartledger/bsv/lib/smartutxo')
161
+ // The symbol will be removed in v5.0.0.
162
+ var _SmartUTXO
163
+ var _SmartUTXOWarned = false
164
+ Object.defineProperty(bsv, 'SmartUTXO', {
165
+ configurable: true,
166
+ enumerable: true,
167
+ get: function () {
168
+ if (!_SmartUTXOWarned && !(process.env && process.env.BSV_HIDE_DEPRECATIONS)) {
169
+ _SmartUTXOWarned = true
170
+ console.warn('[bsv] bsv.SmartUTXO is a development-only simulator and is deprecated; ' +
171
+ 'it will be removed in v5.0.0. Import directly: ' +
172
+ "require('@smartledger/bsv/lib/smartutxo'). " +
173
+ 'Set BSV_HIDE_DEPRECATIONS=1 to silence this warning.')
174
+ }
175
+ if (!_SmartUTXO) _SmartUTXO = require('./lib/smartutxo')
176
+ return _SmartUTXO
177
+ }
178
+ })
179
+
152
180
  bsv.SmartMiner = require('./lib/smartminer')
153
181
  bsv.CustomScriptHelper = require('./lib/custom-script-helper')
154
182
  } catch (e) {
@@ -32,10 +32,15 @@ function UTXOGenerator(options) {
32
32
  this.keyRing = {} // Store generated keys
33
33
  this.utxoPool = [] // Store generated UTXOs
34
34
 
35
- // Initialize with SmartUTXO integration
36
- if (typeof bsv.SmartUTXO !== 'undefined') {
37
- this.smartUTXO = new bsv.SmartUTXO(this.options)
38
- }
35
+ // Initialize with SmartUTXO integration via direct require so that
36
+ // touching this internal integration path doesn't surface the
37
+ // bsv.SmartUTXO deprecation warning (the warning is for downstream
38
+ // consumers who reach for bsv.SmartUTXO themselves, not for our own
39
+ // internal coupling). Try/catch because smartutxo is Node-only.
40
+ try {
41
+ var SmartUTXO = require('../smartutxo')
42
+ this.smartUTXO = new SmartUTXO(this.options)
43
+ } catch (e) { /* browser context; SmartUTXO unavailable */ }
39
44
  }
40
45
 
41
46
  /**
package/lib/smartutxo.js CHANGED
@@ -1,8 +1,29 @@
1
1
  'use strict'
2
2
 
3
3
  /**
4
- * SmartLedger UTXO Management System
5
- * Provides blockchain state management and UTXO tracking for testing and development
4
+ * SmartLedger UTXO Management System — DEVELOPMENT ONLY
5
+ * =====================================================
6
+ *
7
+ * `SmartUTXOManager` is a file-backed wallet/UTXO simulator intended for
8
+ * local testing and example scripts. It persists state to
9
+ * `<package-root>/utilities/blockchain-state.json`, has no concurrency
10
+ * controls (multiple processes will race on the same file), and ships
11
+ * with an empty seed for npm consumers (the 3.3 MB development fixture
12
+ * is `.npmignore`d). Do NOT use it as a production UTXO manager —
13
+ * production wallets should track UTXOs themselves and never rely on a
14
+ * shared file inside `node_modules`.
15
+ *
16
+ * Supported import path (works in any consumer):
17
+ *
18
+ * const SmartUTXO = require('@smartledger/bsv/lib/smartutxo')
19
+ *
20
+ * Or, from within the smartledger-bsv repo:
21
+ *
22
+ * const SmartUTXO = require('./lib/smartutxo')
23
+ *
24
+ * The legacy `bsv.SmartUTXO` namespace export was soft-deprecated in
25
+ * v4.0.1 (logs a one-shot warning on access) and will be removed in
26
+ * v5.0.0.
6
27
  */
7
28
 
8
29
  // Set BSV_DEBUG=1 (Node) or window.BSV_DEBUG = true (browser) to surface
@@ -119,31 +140,37 @@ class SmartUTXOManager {
119
140
  }
120
141
 
121
142
  /**
122
- * Create mock UTXOs for testing
123
- * @param {string} address - Target address
143
+ * Create mock UTXOs for testing. Each mock has a fresh random txid and
144
+ * a P2PKH locking script that actually encodes the provided address
145
+ * (so any private key for `address` can sign against the resulting
146
+ * `script` via the high-level API).
147
+ *
148
+ * This is a pure factory — the returned UTXOs are NOT added to the
149
+ * simulator state. Call `.addUTXO(...)` on each one to persist them.
150
+ *
151
+ * @param {string} address - Target address (livenet or testnet)
124
152
  * @param {number} count - Number of UTXOs to create
125
153
  * @param {number} satoshis - Satoshis per UTXO
126
154
  * @returns {Array} Array of created UTXOs
127
155
  */
128
156
  createMockUTXOs(address, count = 5, satoshis = 100000) {
157
+ // Use bsv's own RNG so this works in both Node and browser builds
158
+ // (the Node `crypto` import above is undefined in browser context).
159
+ const bsv = require('../')
160
+ const lockingScriptHex = bsv.Script.buildPublicKeyHashOut(
161
+ bsv.Address.fromString(address)
162
+ ).toHex()
163
+
129
164
  const mockUTXOs = []
130
-
131
165
  for (let i = 0; i < count; i++) {
132
- const txid = crypto.randomBytes(32).toString('hex')
133
- const vout = i
134
- const script = `76a914${crypto.randomBytes(20).toString('hex')}88ac` // Mock P2PKH script
135
-
136
- const utxo = {
137
- txid,
138
- vout,
166
+ mockUTXOs.push({
167
+ txid: bsv.crypto.Random.getRandomBuffer(32).toString('hex'),
168
+ vout: i,
139
169
  address,
140
170
  satoshis,
141
- script
142
- }
143
-
144
- mockUTXOs.push(utxo)
171
+ script: lockingScriptHex
172
+ })
145
173
  }
146
-
147
174
  return mockUTXOs
148
175
  }
149
176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartledger/bsv",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "🚀 Complete Bitcoin SV development framework with legally-recognizable DID:web + W3C VC-JWT toolkit, Legal Token Protocol (LTP), Global Digital Attestation Framework (GDAF), StatusList2021 revocation, and 16 flexible loading options. Standards-based credentials with ES256/ES256K support, on-chain BSV anchoring, and comprehensive Bitcoin SV API. Perfect for legal tokens, verifiable credentials, DeFi, smart contracts, and secure Bitcoin applications.",
5
5
  "author": "SmartLedger Technology <hello@smartledger.technology> (https://smartledger.technology)",
6
6
  "homepage": "https://github.com/codenlighten/smartledger-bsv#readme",