@smartledger/bsv 3.3.2 → 3.3.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.
- package/CHANGELOG.md +220 -79
- package/README.md +283 -71
- package/bsv-covenant.min.js +26 -3
- package/bsv-gdaf.min.js +11 -9
- package/bsv-ltp.min.js +10 -8
- package/bsv-mnemonic.min.js +4 -4
- package/bsv-script-helper.min.js +2 -2
- package/bsv-security.min.js +3 -24
- package/bsv-shamir.min.js +2 -2
- package/bsv-smartcontract.min.js +10 -8
- package/bsv.bundle.js +9 -9
- package/bsv.min.js +10 -8
- package/build/webpack.bundle.config.js +2 -2
- package/build/webpack.config.js +2 -2
- package/build/webpack.covenant.config.js +2 -2
- package/build/webpack.gdaf.config.js +6 -43
- package/build/webpack.script-helper.config.js +2 -2
- package/build/webpack.security.config.js +2 -2
- package/build/webpack.smartcontract.config.js +2 -2
- package/bundle-entry.js +1 -341
- package/covenant-entry.js +1 -44
- package/demos/README.md +188 -0
- package/{architecture_demo.js → demos/architecture_demo.js} +2 -2
- package/demos/bsv_wallet_demo.js +242 -0
- package/{complete_ltp_demo.js → demos/complete_ltp_demo.js} +1 -1
- package/demos/debug_tools_demo.js +87 -0
- package/demos/demo_features.js +123 -0
- package/demos/easy_interface_demo.js +109 -0
- package/demos/ecies_demo.js +182 -0
- package/demos/gdaf_core_test.js +131 -0
- package/demos/gdaf_demo.js +237 -0
- package/demos/ltp_demo.js +361 -0
- package/demos/ltp_primitives_demo.js +403 -0
- package/demos/message_demo.js +209 -0
- package/demos/preimage_separation_demo.js +383 -0
- package/demos/script_helper_demo.js +289 -0
- package/demos/security_demo.js +287 -0
- package/{shamir_demo.js → demos/shamir_demo.js} +1 -1
- package/{simple_demo.js → demos/simple_demo.js} +1 -1
- package/demos/simple_p2pkh_demo.js +169 -0
- package/demos/simple_utxo_preimage_demo.js +196 -0
- package/demos/smart_contract_demo.html +1347 -0
- package/demos/smart_contract_demo.js +910 -0
- package/demos/utxo_generator_demo.js +244 -0
- package/demos/validation_pipeline_demo.js +155 -0
- package/demos/web3keys.html +740 -0
- package/docs/BUNDLE_UPDATE_SUMMARY.md +40 -0
- package/docs/DOCUMENTATION_REVIEW_REPORT.md +295 -0
- package/docs/FIX_CREATEHMAC_ISSUE.md +91 -0
- package/docs/MODULE_REFERENCE_COMPLETE.md +330 -0
- package/docs/README.md +107 -79
- package/docs/SMARTLEDGER_BSV_USAGE_ANSWERS.md +477 -0
- package/docs/SMARTLEDGER_BSV_USAGE_EXAMPLES.js +372 -0
- package/docs/SMARTLEDGER_BSV_USAGE_GUIDE.md +555 -0
- package/docs/SMART_CONTRACT_DEVELOPMENT_GUIDE.md +1459 -0
- package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +411 -0
- package/docs/advanced/SMART_CONTRACT_GUIDE.md +1255 -0
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +851 -0
- package/docs/api/LTP.md +334 -0
- package/docs/getting-started/INSTALLATION.md +410 -0
- package/docs/getting-started/QUICK_START.md +180 -0
- package/docs/migration/FROM_BSV_1_5_6.md +260 -0
- package/docs/technical/GDAF_DEVELOPER_INTERFACE.md +187 -0
- package/docs/technical/GDAF_IMPLEMENTATION_COMPLETE.md +190 -0
- package/docs/technical/SHAMIR_INTEGRATION_SUMMARY.md +165 -0
- package/docs/technical/roadmap.md +1250 -0
- package/docs/technical/trust_law.md +142 -0
- package/examples/complete_workflow_demo.js +783 -0
- package/examples/definitive_working_demo.js +261 -0
- package/examples/final_working_contracts.js +338 -0
- package/examples/smart_contract_templates.js +718 -0
- package/examples/working_smart_contracts.js +348 -0
- package/gdaf-entry.js +2 -54
- package/index.js +32 -0
- package/lib/mnemonic/pbkdf2.browser.js +69 -0
- package/lib/mnemonic/pbkdf2.js +2 -68
- package/lib/mnemonic/pbkdf2.node.js +68 -0
- package/ltp-entry.js +2 -92
- package/package.json +21 -8
- package/script-helper-entry.js +1 -49
- package/security-entry.js +1 -70
- package/shamir-entry.js +1 -173
- package/smartcontract-entry.js +1 -133
- package/tests/browser-compatibility/README.md +35 -0
- package/tests/browser-compatibility/test-cdn-vs-local.html +186 -0
- package/tests/browser-compatibility/test-pbkdf2.html +51 -0
- package/tests/test_builtin_verify.js +117 -0
- package/tests/test_debug_integration.js +71 -0
- package/tests/test_ecdsa_little.js +70 -0
- package/tests/test_smartverify_der.js +110 -0
- package/utilities/blockchain-state.js +155 -155
- package/utilities/blockchain-state.json +103293 -5244
- package/utilities/miner-simulator.js +354 -358
- package/utilities/mock-utxo-generator.js +54 -54
- package/utilities/raw-tx-examples.js +120 -122
- package/utilities/success-demo.js +104 -105
- package/utilities/transaction-examples.js +188 -188
- package/utilities/utxo-manager.js +91 -91
- package/utilities/wallet-setup.js +79 -80
- package/utilities/working-signature-demo.js +108 -110
- package/SECURITY.md +0 -75
- package/build/bsv-covenant.min.js +0 -10
- package/build/bsv-script-helper.min.js +0 -10
- package/build/bsv-security.min.js +0 -31
- package/build/bsv-smartcontract.min.js +0 -39
- package/build/bsv.bundle.js +0 -39
- package/build/bsv.min.js +0 -39
- package/validation_test.js +0 -97
- /package/docs/{ADVANCED_COVENANT_DEVELOPMENT.md → advanced/ADVANCED_COVENANT_DEVELOPMENT.md} +0 -0
- /package/docs/{CUSTOM_SCRIPT_DEVELOPMENT.md → advanced/CUSTOM_SCRIPT_DEVELOPMENT.md} +0 -0
- /package/docs/{block.md → api/BLOCKS.md} +0 -0
- /package/docs/{ecies.md → api/ECIES.md} +0 -0
- /package/docs/{networks.md → api/NETWORKS.md} +0 -0
- /package/docs/{script.md → api/SCRIPTS.md} +0 -0
- /package/docs/{transaction.md → api/TRANSACTIONS.md} +0 -0
- /package/docs/{unspentoutput.md → api/UTXO.md} +0 -0
- /package/{test_shamir.js → tests/test_shamir.js} +0 -0
- /package/{test_standalone_shamir.html → tests/test_standalone_shamir.html} +0 -0
package/README.md
CHANGED
|
@@ -1,27 +1,47 @@
|
|
|
1
1
|
# SmartLedger-BSV
|
|
2
2
|
|
|
3
|
-
**🚀 Complete Bitcoin SV Development Framework with
|
|
3
|
+
**🚀 Complete Bitcoin SV Development Framework with Legal Compliance, Digital Identity, and 12 Flexible Loading Options**
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@smartledger/bsv)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://bitcoinsv.com/)
|
|
8
8
|
[](#loading-options)
|
|
9
9
|
|
|
10
|
-
The most comprehensive and flexible Bitcoin SV library available. Choose from
|
|
10
|
+
The most comprehensive and flexible Bitcoin SV library available. Choose from 12 different distribution methods: standalone modules, complete bundle, or mix-and-match approach. Perfect for everything from simple transactions to complex DeFi protocols, smart contracts, legal tokenization, digital identity, and threshold cryptography.
|
|
11
11
|
|
|
12
|
-
## 🎯 **
|
|
12
|
+
## 🎯 **12 Loading Options - Choose Your Approach**
|
|
13
13
|
|
|
14
|
+
### **Core Modules**
|
|
14
15
|
| Module | Size | Use Case | CDN |
|
|
15
16
|
|--------|------|----------|-----|
|
|
16
|
-
| **bsv.min.js** | 449KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.
|
|
17
|
-
| **bsv.bundle.js** |
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
|
21
|
-
|
|
22
|
-
| **bsv-
|
|
23
|
-
| **bsv-
|
|
24
|
-
| **bsv-
|
|
17
|
+
| **bsv.min.js** | 449KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js` |
|
|
18
|
+
| **bsv.bundle.js** | 885KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.3.3/bsv.bundle.js` |
|
|
19
|
+
|
|
20
|
+
### **Smart Contract & Development**
|
|
21
|
+
| Module | Size | Use Case | CDN |
|
|
22
|
+
|--------|------|----------|-----|
|
|
23
|
+
| **bsv-smartcontract.min.js** | 451KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@3.3.3/bsv-smartcontract.min.js` |
|
|
24
|
+
| **bsv-covenant.min.js** | 32KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.3.3/bsv-covenant.min.js` |
|
|
25
|
+
| **bsv-script-helper.min.js** | 27KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.3.3/bsv-script-helper.min.js` |
|
|
26
|
+
| **bsv-security.min.js** | 290KB | Security enhancements | `unpkg.com/@smartledger/bsv@3.3.3/bsv-security.min.js` |
|
|
27
|
+
|
|
28
|
+
### **🆕 Legal & Compliance**
|
|
29
|
+
| Module | Size | Use Case | CDN |
|
|
30
|
+
|--------|------|----------|-----|
|
|
31
|
+
| **🟢 bsv-ltp.min.js** | 817KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@3.3.3/bsv-ltp.min.js` |
|
|
32
|
+
| **🟢 bsv-gdaf.min.js** | 604KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@3.3.3/bsv-gdaf.min.js` |
|
|
33
|
+
|
|
34
|
+
### **🆕 Advanced Cryptography**
|
|
35
|
+
| Module | Size | Use Case | CDN |
|
|
36
|
+
|--------|------|----------|-----|
|
|
37
|
+
| **🟢 bsv-shamir.min.js** | 433KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@3.3.3/bsv-shamir.min.js` |
|
|
38
|
+
|
|
39
|
+
### **Utilities**
|
|
40
|
+
| Module | Size | Use Case | CDN |
|
|
41
|
+
|--------|------|----------|-----|
|
|
42
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.3.3/bsv-ecies.min.js` |
|
|
43
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.3.3/bsv-message.min.js` |
|
|
44
|
+
| **bsv-mnemonic.min.js** | 670KB | HD wallets | `unpkg.com/@smartledger/bsv@3.3.3/bsv-mnemonic.min.js` |
|
|
25
45
|
|
|
26
46
|
## ⚡ **2-Minute Quick Start**
|
|
27
47
|
|
|
@@ -32,7 +52,7 @@ Get started with Bitcoin SV development in under 2 minutes:
|
|
|
32
52
|
npm install @smartledger/bsv
|
|
33
53
|
|
|
34
54
|
# Or include in HTML
|
|
35
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
55
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js"></script>
|
|
36
56
|
```
|
|
37
57
|
|
|
38
58
|
**Basic Transaction (30 seconds):**
|
|
@@ -54,28 +74,50 @@ const tx = new bsv.Transaction()
|
|
|
54
74
|
console.log('Transaction ID:', tx.id);
|
|
55
75
|
```
|
|
56
76
|
|
|
57
|
-
|
|
77
|
+
**🆕 Legal Token Development (60 seconds):**
|
|
58
78
|
```javascript
|
|
59
|
-
//
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
outputs: [{ address: targetAddress, satoshis: 99000 }]
|
|
79
|
+
// Create legal property token
|
|
80
|
+
const propertyToken = bsv.createPropertyToken({
|
|
81
|
+
propertyType: 'real_estate',
|
|
82
|
+
jurisdiction: 'us_delaware',
|
|
83
|
+
legalDescription: 'Lot 15, Block 3, Subdivision ABC',
|
|
84
|
+
ownerIdentity: ownerDID
|
|
66
85
|
});
|
|
67
86
|
|
|
68
|
-
//
|
|
69
|
-
const
|
|
87
|
+
// Generate W3C Verifiable Credential
|
|
88
|
+
const credential = bsv.createEmailCredential(
|
|
89
|
+
issuerDID, subjectDID, 'user@example.com', issuerPrivateKey
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// Threshold cryptography for secure key management
|
|
93
|
+
const shares = bsv.splitSecret('private_key_backup', 5, 3); // 5 shares, 3 needed
|
|
94
|
+
```
|
|
70
95
|
|
|
71
|
-
|
|
72
|
-
|
|
96
|
+
**🆕 Smart Contract Development (90 seconds):**
|
|
97
|
+
```javascript
|
|
98
|
+
// Generate authentic UTXOs for testing
|
|
99
|
+
const utxoGenerator = new bsv.SmartContract.UTXOGenerator();
|
|
100
|
+
const utxos = utxoGenerator.createRealUTXOs(2, 100000);
|
|
101
|
+
|
|
102
|
+
// Create BIP-143 preimage and extract fields
|
|
103
|
+
const preimage = new bsv.SmartContract.Preimage(preimageHex);
|
|
104
|
+
const amount = preimage.getField('amount');
|
|
105
|
+
|
|
106
|
+
// Build covenant with JavaScript-to-Script translation
|
|
107
|
+
const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
108
|
+
.extractField('amount')
|
|
109
|
+
.push(50000)
|
|
110
|
+
.greaterThanOrEqual()
|
|
111
|
+
.verify()
|
|
112
|
+
.build();
|
|
73
113
|
```
|
|
74
114
|
|
|
75
115
|
**Next Steps:**
|
|
76
|
-
- 📖 [
|
|
77
|
-
-
|
|
78
|
-
-
|
|
116
|
+
- 📖 [SmartContract Guide](docs/SMART_CONTRACT_GUIDE.md)
|
|
117
|
+
- ⚖️ [Legal Token Protocol Guide](docs/LTP_LEGAL_TOKENS_GUIDE.md)
|
|
118
|
+
- 🌐 [Digital Identity Guide](docs/GDAF_DIGITAL_ATTESTATION_GUIDE.md)
|
|
119
|
+
- � [Threshold Cryptography Guide](docs/SHAMIR_SECRET_SHARING_GUIDE.md)
|
|
120
|
+
- �️ [UTXO Manager Guide](docs/UTXO_MANAGER_GUIDE.md)
|
|
79
121
|
- 💡 [Examples Directory](examples/)
|
|
80
122
|
|
|
81
123
|
## 🔧 **API Reference**
|
|
@@ -101,58 +143,95 @@ const signature = covenant.createSignature(tx, privateKey, 0, script, satoshis);
|
|
|
101
143
|
|
|
102
144
|
## 📚 **Quick Start Examples**
|
|
103
145
|
|
|
104
|
-
###
|
|
146
|
+
### 🔧 **Basic Development** (476KB total)
|
|
105
147
|
```html
|
|
106
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
107
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
148
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js"></script>
|
|
149
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-script-helper.min.js"></script>
|
|
108
150
|
<script>
|
|
109
151
|
const privateKey = new bsv.PrivateKey();
|
|
110
|
-
const
|
|
152
|
+
const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
|
|
111
153
|
</script>
|
|
112
154
|
```
|
|
113
155
|
|
|
114
|
-
###
|
|
156
|
+
### 🔒 **Smart Contract Development** (932KB total)
|
|
115
157
|
```html
|
|
116
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
117
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
118
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
158
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js"></script>
|
|
159
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-covenant.min.js"></script>
|
|
160
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-smartcontract.min.js"></script>
|
|
119
161
|
<script>
|
|
120
|
-
const covenant =
|
|
121
|
-
|
|
122
|
-
const debugInfo = SmartContract.examineStack(script);
|
|
162
|
+
const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
163
|
+
.extractField('amount').push(50000).greaterThanOrEqual().verify().build();
|
|
164
|
+
const debugInfo = bsv.SmartContract.examineStack(script);
|
|
123
165
|
</script>
|
|
124
166
|
```
|
|
125
167
|
|
|
126
|
-
###
|
|
168
|
+
### 🆕 **Legal & Identity Development** (1.87MB total)
|
|
127
169
|
```html
|
|
128
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
170
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js"></script>
|
|
171
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-ltp.min.js"></script>
|
|
172
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-gdaf.min.js"></script>
|
|
173
|
+
<script>
|
|
174
|
+
// Legal Token Protocol
|
|
175
|
+
const propertyToken = bsv.createPropertyToken({
|
|
176
|
+
propertyType: 'real_estate', jurisdiction: 'us_delaware'
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Digital Identity
|
|
180
|
+
const credential = bsv.createEmailCredential(issuerDID, subjectDID, 'user@example.com', key);
|
|
181
|
+
</script>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 🆕 **Security & Cryptography** (1.17MB total)
|
|
185
|
+
```html
|
|
186
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js"></script>
|
|
187
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-security.min.js"></script>
|
|
188
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-shamir.min.js"></script>
|
|
189
|
+
<script>
|
|
190
|
+
// Threshold Cryptography
|
|
191
|
+
const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
|
|
192
|
+
|
|
193
|
+
// Enhanced Security
|
|
194
|
+
const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
|
|
195
|
+
</script>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 🎯 **Everything Bundle** (885KB)
|
|
199
|
+
```html
|
|
200
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.bundle.js"></script>
|
|
129
201
|
<script>
|
|
130
202
|
// Everything available immediately
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
const
|
|
203
|
+
const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
|
|
204
|
+
const credential = bsv.createDID(publicKey); // Digital Identity
|
|
205
|
+
const propertyToken = bsv.createPropertyToken({...}); // Legal Tokens
|
|
206
|
+
const covenant = bsv.SmartContract.createCovenantBuilder(); // Smart Contracts
|
|
134
207
|
</script>
|
|
135
208
|
```
|
|
136
209
|
|
|
137
210
|
## 🎯 **Key Features**
|
|
138
211
|
|
|
139
|
-
###
|
|
140
|
-
- ✅ **
|
|
141
|
-
- ✅ **
|
|
142
|
-
- ✅ **
|
|
143
|
-
- ✅ **
|
|
144
|
-
- ✅ **TypeScript Ready**: Complete type definitions included
|
|
145
|
-
|
|
146
|
-
### Advanced Development Tools
|
|
147
|
-
- � **Covenant Interface**: High-level covenant development framework → [Covenant Guide](docs/ADVANCED_COVENANT_DEVELOPMENT.md)
|
|
148
|
-
- � **Custom Script Helper**: Simplified API for script creation and signing → [Script Development](docs/CUSTOM_SCRIPT_DEVELOPMENT.md)
|
|
149
|
-
- 🔒 **Debug Tools**: Script interpreter, stack examiner, metrics, and optimizer → [Debug Examples](tests/smartcontract-test.html)
|
|
150
|
-
- 🔒 **BIP143 Compliant**: Complete preimage parsing and manipulation → [Preimage Tools](examples/preimage/)
|
|
151
|
-
- 🔒 **PUSHTX Integration**: nChain techniques for advanced covenant patterns → [PUSHTX Insights](docs/pushtx-key-insights.md)
|
|
212
|
+
### 🚀 **Unique Capabilities** (Only Bitcoin Library with These Features)
|
|
213
|
+
- ✅ **Legal Token Protocol**: Compliant tokenization of real-world assets → [Legal Guide](docs/LTP_LEGAL_TOKENS_GUIDE.md)
|
|
214
|
+
- ✅ **Digital Identity Framework**: W3C Verifiable Credentials and DIDs → [Identity Guide](docs/GDAF_DIGITAL_ATTESTATION_GUIDE.md)
|
|
215
|
+
- ✅ **Threshold Cryptography**: Shamir Secret Sharing for secure key management → [Cryptography Guide](docs/SHAMIR_SECRET_SHARING_GUIDE.md)
|
|
216
|
+
- ✅ **Complete Smart Contract Suite**: 23+ production-ready covenant features → [SmartContract Guide](docs/SMART_CONTRACT_GUIDE.md)
|
|
152
217
|
|
|
153
|
-
###
|
|
154
|
-
-
|
|
155
|
-
-
|
|
218
|
+
### 💼 **Core Library Excellence**
|
|
219
|
+
- ✅ **Complete BSV API**: Full Bitcoin SV blockchain operations → [API Reference](#api-reference)
|
|
220
|
+
- ✅ **Security Hardened**: SmartLedger elliptic curve fixes and enhanced validation → [Security Features](#security-features)
|
|
221
|
+
- ✅ **Browser + Node.js**: Universal compatibility with proper polyfills → [Loading Options](#12-loading-options--choose-your-approach)
|
|
222
|
+
- ✅ **TypeScript Ready**: Complete type definitions included
|
|
223
|
+
- ✅ **Ultra-Low Fees**: 0.01 sats/byte configuration (91% fee reduction)
|
|
224
|
+
|
|
225
|
+
### 🛠️ **Advanced Development Tools**
|
|
226
|
+
- 🔧 **JavaScript-to-Script**: High-level covenant development with 121 opcode mapping → [Covenant Guide](docs/ADVANCED_COVENANT_DEVELOPMENT.md)
|
|
227
|
+
- 🔧 **UTXO Generator**: Create authentic test UTXOs for development → [UTXO Guide](docs/UTXO_MANAGER_GUIDE.md)
|
|
228
|
+
- 🔧 **Preimage Parser**: Complete BIP-143 field extraction and manipulation → [Preimage Tools](examples/preimage/)
|
|
229
|
+
- � **Debug Framework**: Script interpreter, stack examiner, and optimizer → [Debug Examples](tests/smartcontract-test.html)
|
|
230
|
+
- � **PUSHTX Integration**: nChain techniques for advanced covenant patterns → [PUSHTX Insights](docs/pushtx-key-insights.md)
|
|
231
|
+
|
|
232
|
+
### 📦 **Flexible Architecture**
|
|
233
|
+
- 📦 **12 Modular Options**: Load only what you need (27KB to 885KB) → [Loading Strategy](#loading-strategy-examples)
|
|
234
|
+
- 📦 **Standalone Modules**: Independent legal, identity, and crypto modules → [Standalone Test](tests/standalone-modules-test.html)
|
|
156
235
|
- 📦 **Complete Bundle**: Everything in one file for convenience → [Bundle Demo](tests/bundle-demo.html)
|
|
157
236
|
- 📦 **CDN Ready**: All modules available via unpkg and jsDelivr
|
|
158
237
|
- 📦 **Webpack Optimized**: Tree-shakeable and build-tool friendly
|
|
@@ -198,8 +277,8 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
198
277
|
|
|
199
278
|
#### 1. **Minimal Setup** - Core + Script Helper (476KB)
|
|
200
279
|
```html
|
|
201
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
202
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
280
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js"></script>
|
|
281
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-script-helper.min.js"></script>
|
|
203
282
|
<script>
|
|
204
283
|
const tx = new bsv.Transaction();
|
|
205
284
|
const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
|
|
@@ -208,9 +287,9 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
208
287
|
|
|
209
288
|
#### 2. **DeFi Development** - Core + Covenants + Debug (932KB)
|
|
210
289
|
```html
|
|
211
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
212
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
213
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
290
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js"></script>
|
|
291
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-covenant.min.js"></script>
|
|
292
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-smartcontract.min.js"></script>
|
|
214
293
|
<script>
|
|
215
294
|
const covenant = new bsvCovenant.CovenantInterface();
|
|
216
295
|
const debugInfo = SmartContract.interpretScript(script);
|
|
@@ -220,8 +299,8 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
220
299
|
|
|
221
300
|
#### 3. **Security First** - Core + Enhanced Security (739KB)
|
|
222
301
|
```html
|
|
223
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
224
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
302
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.min.js"></script>
|
|
303
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv-security.min.js"></script>
|
|
225
304
|
<script>
|
|
226
305
|
const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
|
|
227
306
|
const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
|
|
@@ -230,7 +309,7 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
230
309
|
|
|
231
310
|
#### 4. **Everything Bundle** - One File Solution (764KB)
|
|
232
311
|
```html
|
|
233
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
312
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.3.3/bsv.bundle.js"></script>
|
|
234
313
|
<script>
|
|
235
314
|
// Everything available under bsv namespace
|
|
236
315
|
const keys = bsv.SmartLedgerBundle.generateKeys();
|
|
@@ -290,6 +369,87 @@ const utxoManager = {
|
|
|
290
369
|
};
|
|
291
370
|
```
|
|
292
371
|
|
|
372
|
+
## 🆕 **Advanced Features** (Unique to SmartLedger-BSV)
|
|
373
|
+
|
|
374
|
+
### ⚖️ Legal Token Protocol (LTP)
|
|
375
|
+
```javascript
|
|
376
|
+
const bsv = require('@smartledger/bsv');
|
|
377
|
+
|
|
378
|
+
// Create property rights token
|
|
379
|
+
const propertyToken = bsv.createPropertyToken({
|
|
380
|
+
propertyType: 'real_estate',
|
|
381
|
+
jurisdiction: 'us_delaware',
|
|
382
|
+
legalDescription: 'Lot 15, Block 3, Subdivision ABC',
|
|
383
|
+
ownerIdentity: ownerDID,
|
|
384
|
+
attestations: [titleAttestation, valuationAttestation]
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Create obligation token
|
|
388
|
+
const obligation = bsv.createObligationToken({
|
|
389
|
+
obligationType: 'payment',
|
|
390
|
+
amount: 100000, // satoshis
|
|
391
|
+
dueDate: '2025-12-31',
|
|
392
|
+
creditor: creditorDID,
|
|
393
|
+
debtor: debtorDID
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
// Validate legal compliance
|
|
397
|
+
const compliance = bsv.validateLegalCompliance(propertyToken, 'us_delaware');
|
|
398
|
+
console.log('Legally compliant:', compliance.isValid);
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### 🌐 Global Digital Attestation Framework (GDAF)
|
|
402
|
+
```javascript
|
|
403
|
+
// Simple Interface - Direct from bsv object
|
|
404
|
+
const issuerDID = bsv.createDID(privateKey.toPublicKey());
|
|
405
|
+
|
|
406
|
+
// Create W3C Verifiable Credentials
|
|
407
|
+
const emailCredential = bsv.createEmailCredential(
|
|
408
|
+
issuerDID, subjectDID, 'user@example.com', issuerPrivateKey
|
|
409
|
+
);
|
|
410
|
+
|
|
411
|
+
// Generate zero-knowledge proofs
|
|
412
|
+
const proof = bsv.generateSelectiveProof(
|
|
413
|
+
emailCredential,
|
|
414
|
+
['credentialSubject.verified'],
|
|
415
|
+
nonce
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
// Verify age without revealing exact age
|
|
419
|
+
const ageProof = bsv.generateAgeProof(credential, 18);
|
|
420
|
+
const isAdult = bsv.verifyAgeProof(ageProof, 18, issuerDID);
|
|
421
|
+
|
|
422
|
+
// Advanced Interface for complex applications
|
|
423
|
+
const gdaf = new bsv.GDAF({
|
|
424
|
+
anchor: { network: 'mainnet' },
|
|
425
|
+
attestationSigner: { customConfig: true }
|
|
426
|
+
});
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### 🔐 Shamir Secret Sharing
|
|
430
|
+
```javascript
|
|
431
|
+
// Split secret into threshold shares
|
|
432
|
+
const secret = 'my_private_key_backup';
|
|
433
|
+
const shares = bsv.splitSecret(secret, 5, 3); // 5 shares, need 3 to reconstruct
|
|
434
|
+
|
|
435
|
+
console.log('Generated', shares.length, 'shares');
|
|
436
|
+
shares.forEach((share, i) => {
|
|
437
|
+
console.log(`Share ${i + 1}:`, share);
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// Reconstruct secret from any 3 shares
|
|
441
|
+
const reconstructed = bsv.reconstructSecret([shares[0], shares[2], shares[4]]);
|
|
442
|
+
console.log('Secret recovered:', reconstructed === secret);
|
|
443
|
+
|
|
444
|
+
// Validate share integrity
|
|
445
|
+
shares.forEach((share, i) => {
|
|
446
|
+
const isValid = bsv.validateShare(share);
|
|
447
|
+
console.log(`Share ${i + 1} valid:`, isValid);
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
// Use cases: Key backup, multi-party security, recovery systems
|
|
451
|
+
```
|
|
452
|
+
|
|
293
453
|
## 🔒 Covenant Framework
|
|
294
454
|
|
|
295
455
|
### JavaScript-to-Bitcoin Script Translation
|
|
@@ -501,7 +661,59 @@ const timelockScript = helper.createTimelockScript(
|
|
|
501
661
|
|
|
502
662
|
---
|
|
503
663
|
|
|
504
|
-
##
|
|
664
|
+
## � **Complete Documentation**
|
|
665
|
+
|
|
666
|
+
### 📚 **Getting Started Guides**
|
|
667
|
+
- [📋 **UTXO Manager Guide**](docs/UTXO_MANAGER_GUIDE.md) - Complete UTXO management and mock generation
|
|
668
|
+
- [🔒 **Smart Contract Guide**](docs/SMART_CONTRACT_GUIDE.md) - Comprehensive covenant development
|
|
669
|
+
- [🛠️ **Custom Script Development**](docs/CUSTOM_SCRIPT_DEVELOPMENT.md) - Build custom Bitcoin scripts
|
|
670
|
+
- [🚀 **Advanced Covenant Development**](docs/ADVANCED_COVENANT_DEVELOPMENT.md) - Production-ready covenants
|
|
671
|
+
|
|
672
|
+
### 🆕 **Advanced Features Documentation**
|
|
673
|
+
- [⚖️ **Legal Token Protocol Guide**](docs/LTP_LEGAL_TOKENS_GUIDE.md) - Property rights & obligation tokens
|
|
674
|
+
- [🌐 **Digital Attestation Guide**](docs/GDAF_DIGITAL_ATTESTATION_GUIDE.md) - DIDs & verifiable credentials
|
|
675
|
+
- [🔐 **Shamir Secret Sharing Guide**](docs/SHAMIR_SECRET_SHARING_GUIDE.md) - Threshold cryptography & key backup
|
|
676
|
+
- [🛡️ **Security Features**](SECURITY_SUMMARY.md) - Enhanced validation & smart verification
|
|
677
|
+
|
|
678
|
+
### 📊 **Technical References**
|
|
679
|
+
- [📝 **Module Reference**](docs/MODULE_REFERENCE_COMPLETE.md) - All 12 modules explained
|
|
680
|
+
- [🔍 **Documentation Review Report**](docs/DOCUMENTATION_REVIEW_REPORT.md) - Comprehensive analysis
|
|
681
|
+
- [📋 **API Reference**](docs/api/) - Complete API documentation
|
|
682
|
+
- [🔧 **Integration Guide**](SMARTCONTRACT_INTEGRATION.md) - Smart contract integration
|
|
683
|
+
|
|
684
|
+
### 📋 **Examples & Demos**
|
|
685
|
+
- [� **Interactive Demos**](demos/) - **NEW!** HTML & Node.js smart contract demos
|
|
686
|
+
- [�📁 **Examples Directory**](examples/) - Working code examples
|
|
687
|
+
- [🎯 **Basic Examples**](examples/basic/) - Simple transactions & addresses
|
|
688
|
+
- [🔒 **Covenant Examples**](examples/covenants/) - Smart contract patterns
|
|
689
|
+
- [📊 **Advanced Examples**](examples/covenants2/) - Production patterns
|
|
690
|
+
|
|
691
|
+
**🎮 Try the Interactive Demos:**
|
|
692
|
+
```bash
|
|
693
|
+
# Terminal-based interactive demo
|
|
694
|
+
npm run demo
|
|
695
|
+
|
|
696
|
+
# Or run specific features
|
|
697
|
+
npm run demo:basics # Library basics & tests
|
|
698
|
+
npm run demo:covenant # Covenant builder
|
|
699
|
+
npm run demo:preimage # BIP-143 preimage parser
|
|
700
|
+
npm run demo:utxo # UTXO generator
|
|
701
|
+
npm run demo:scripts # Script tools
|
|
702
|
+
|
|
703
|
+
# Web-based demo (open in browser)
|
|
704
|
+
npm run demo:web
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
### 🔍 **Troubleshooting & Support**
|
|
708
|
+
- [📚 **Complete Documentation**](docs/README.md) - Organized documentation hub
|
|
709
|
+
- [❓ **Issues & Solutions**](https://github.com/codenlighten/smartledger-bsv/issues) - Community support
|
|
710
|
+
- [📈 **Status Reports**](SMARTLEDGER_V302_STATUS_REPORT.md) - Latest updates
|
|
711
|
+
- [🔒 **Security Policy**](SECURITY.md) - Security guidelines
|
|
712
|
+
- [📝 **Changelog**](CHANGELOG.md) - Version history
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
## �📄 **License**
|
|
505
717
|
|
|
506
718
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
507
719
|
|
|
@@ -518,6 +730,6 @@ We welcome contributions to SmartLedger-BSV! Please see our [Contributing Guide]
|
|
|
518
730
|
|
|
519
731
|
---
|
|
520
732
|
|
|
521
|
-
**SmartLedger-BSV v3.
|
|
733
|
+
**SmartLedger-BSV v3.3.3** - *Complete Bitcoin SV Development Framework*
|
|
522
734
|
|
|
523
735
|
Built with ❤️ for the Bitcoin SV ecosystem • 9 Loading Options • Enterprise Ready
|