smartledger-bsv 3.3.2 → 3.3.3

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 (79) hide show
  1. package/CHANGELOG.md +211 -83
  2. package/README.md +266 -71
  3. package/bsv-covenant.min.js +26 -3
  4. package/bsv-gdaf.min.js +11 -9
  5. package/bsv-ltp.min.js +10 -8
  6. package/bsv-script-helper.min.js +2 -2
  7. package/bsv-security.min.js +3 -24
  8. package/bsv-shamir.min.js +2 -2
  9. package/bsv-smartcontract.min.js +10 -8
  10. package/bsv.bundle.js +9 -9
  11. package/bsv.min.js +10 -8
  12. package/build/webpack.bundle.config.js +2 -2
  13. package/build/webpack.config.js +2 -2
  14. package/build/webpack.covenant.config.js +2 -2
  15. package/build/webpack.gdaf.config.js +6 -43
  16. package/build/webpack.script-helper.config.js +2 -2
  17. package/build/webpack.security.config.js +2 -2
  18. package/build/webpack.smartcontract.config.js +2 -2
  19. package/bundle-entry.js +1 -341
  20. package/covenant-entry.js +1 -44
  21. package/docs/DOCUMENTATION_REVIEW_REPORT.md +295 -0
  22. package/docs/MODULE_REFERENCE_COMPLETE.md +330 -0
  23. package/docs/README.md +107 -79
  24. package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +411 -0
  25. package/docs/advanced/SMART_CONTRACT_GUIDE.md +1255 -0
  26. package/docs/advanced/UTXO_MANAGER_GUIDE.md +851 -0
  27. package/docs/api/LTP.md +334 -0
  28. package/docs/getting-started/INSTALLATION.md +410 -0
  29. package/docs/getting-started/QUICK_START.md +180 -0
  30. package/docs/migration/FROM_BSV_1_5_6.md +260 -0
  31. package/docs/technical/GDAF_DEVELOPER_INTERFACE.md +187 -0
  32. package/docs/technical/GDAF_IMPLEMENTATION_COMPLETE.md +190 -0
  33. package/docs/technical/SHAMIR_INTEGRATION_SUMMARY.md +165 -0
  34. package/docs/technical/roadmap.md +1250 -0
  35. package/docs/technical/trust_law.md +142 -0
  36. package/gdaf-entry.js +2 -54
  37. package/index.js +32 -0
  38. package/ltp-entry.js +2 -92
  39. package/package.json +5 -3
  40. package/script-helper-entry.js +1 -49
  41. package/security-entry.js +1 -70
  42. package/shamir-entry.js +1 -173
  43. package/smartcontract-entry.js +1 -133
  44. package/tests/test_builtin_verify.js +117 -0
  45. package/tests/test_debug_integration.js +71 -0
  46. package/tests/test_ecdsa_little.js +70 -0
  47. package/tests/test_smartverify_der.js +110 -0
  48. package/utilities/blockchain-state.js +155 -155
  49. package/utilities/blockchain-state.json +103293 -5244
  50. package/utilities/miner-simulator.js +354 -358
  51. package/utilities/mock-utxo-generator.js +54 -54
  52. package/utilities/raw-tx-examples.js +120 -122
  53. package/utilities/success-demo.js +104 -105
  54. package/utilities/transaction-examples.js +188 -188
  55. package/utilities/utxo-manager.js +91 -91
  56. package/utilities/wallet-setup.js +79 -80
  57. package/utilities/working-signature-demo.js +108 -110
  58. package/SECURITY.md +0 -75
  59. package/architecture_demo.js +0 -247
  60. package/build/bsv-covenant.min.js +0 -10
  61. package/build/bsv-script-helper.min.js +0 -10
  62. package/build/bsv-security.min.js +0 -31
  63. package/build/bsv-smartcontract.min.js +0 -39
  64. package/build/bsv.bundle.js +0 -39
  65. package/build/bsv.min.js +0 -39
  66. package/complete_ltp_demo.js +0 -511
  67. package/shamir_demo.js +0 -121
  68. package/simple_demo.js +0 -204
  69. package/validation_test.js +0 -97
  70. /package/docs/{ADVANCED_COVENANT_DEVELOPMENT.md → advanced/ADVANCED_COVENANT_DEVELOPMENT.md} +0 -0
  71. /package/docs/{CUSTOM_SCRIPT_DEVELOPMENT.md → advanced/CUSTOM_SCRIPT_DEVELOPMENT.md} +0 -0
  72. /package/docs/{block.md → api/BLOCKS.md} +0 -0
  73. /package/docs/{ecies.md → api/ECIES.md} +0 -0
  74. /package/docs/{networks.md → api/NETWORKS.md} +0 -0
  75. /package/docs/{script.md → api/SCRIPTS.md} +0 -0
  76. /package/docs/{transaction.md → api/TRANSACTIONS.md} +0 -0
  77. /package/docs/{unspentoutput.md → api/UTXO.md} +0 -0
  78. /package/{test_shamir.js → tests/test_shamir.js} +0 -0
  79. /package/{test_standalone_shamir.html → tests/test_standalone_shamir.html} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,132 +1,260 @@
1
- # Changelog
1
+ # Changelog# Changelog
2
2
 
3
- All notable changes to SmartLedger-BSV will be documented in this file.
4
3
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
4
 
8
- ## [3.3.0] - 2025-10-22
5
+ All notable changes to SmartLedger-BSV will be documented in this file.All notable changes to SmartLedger-BSV will be documented in this file.
9
6
 
10
- ### 🚀 MAJOR RELEASE: Legal Token Protocol (LTP) & Global Digital Attestation Framework (GDAF)
11
7
 
12
- #### Revolutionary Legal Token Protocol Framework
13
- - **Complete Legal Token Protocol (LTP)**: 6-module comprehensive legal framework
14
- - **lib/ltp/anchor.js**: Blockchain anchoring preparation primitives
15
- - **lib/ltp/registry.js**: Token registry management primitives
16
- - **lib/ltp/claim.js**: Legal claim validation and attestation primitives
17
- - **lib/ltp/proof.js**: Cryptographic proof generation primitives
8
+
9
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
10
+
11
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
12
+
13
+
14
+
15
+ ## [3.3.3] - 2025-10-28## [3.3.0] - 2025-10-22
16
+
17
+
18
+
19
+ ### 🎉 Major Improvements### 🚀 MAJOR RELEASE: Legal Token Protocol (LTP) & Global Digital Attestation Framework (GDAF)
20
+
21
+
22
+
23
+ #### 📁 Project Organization & Structure#### Revolutionary Legal Token Protocol Framework
24
+
25
+ - **Complete repository reorganization**: Moved legacy files to `/archive/` for better project structure- **Complete Legal Token Protocol (LTP)**: 6-module comprehensive legal framework
26
+
27
+ - **New `/demos/` directory**: Interactive HTML demonstrations for all SmartLedger-BSV modules - **lib/ltp/anchor.js**: Blockchain anchoring preparation primitives
28
+
29
+ - **Enhanced `/docs/` structure**: Comprehensive documentation with getting started guides, API references, and technical details - **lib/ltp/registry.js**: Token registry management primitives
30
+
31
+ - **Dedicated `/tests/` directory**: All test files properly organized and categorized - **lib/ltp/claim.js**: Legal claim validation and attestation primitives
32
+
33
+ - **New `/tools/` directory**: Development utilities and helper scripts - **lib/ltp/proof.js**: Cryptographic proof generation primitives
34
+
18
35
  - **lib/ltp/right.js**: Legal rights token creation and validation primitives
19
- - **lib/ltp/obligation.js**: Legal obligation token management primitives
20
36
 
21
- #### Primitives-Only Architecture Philosophy
22
- - **No Blockchain Publishing**: Library provides preparation functions only
37
+ #### 🚀 Interactive Demos - **lib/ltp/obligation.js**: Legal obligation token management primitives
38
+
39
+ - **Smart Contract Demo**: Full-featured HTML demo showcasing covenant creation, preimage parsing, script building, and UTXO generation
40
+
41
+ - **Web3Keys Demo**: Interactive key generation and cryptographic operations demonstration#### Primitives-Only Architecture Philosophy
42
+
43
+ - **Local development server**: Easy setup for testing demos locally- **No Blockchain Publishing**: Library provides preparation functions only
44
+
23
45
  - **External System Integration**: Perfect for enterprise and custom implementations
24
- - **Maximum Flexibility**: Choose your own blockchain, storage, and UI frameworks
25
- - **Clean Separation**: Cryptographic correctness separated from application logic
26
46
 
27
- #### Legal Token Framework Components
28
- - **46 LTP Primitive Methods**: Complete coverage across all legal token operations
29
- - 4 Right Token Primitives (prepare, verify, transfer, validate)
47
+ #### 📚 Documentation Enhancements- **Maximum Flexibility**: Choose your own blockchain, storage, and UI frameworks
48
+
49
+ - **Complete API documentation**: Detailed reference for all modules and classes- **Clean Separation**: Cryptographic correctness separated from application logic
50
+
51
+ - **Getting Started guides**: Step-by-step tutorials for new developers
52
+
53
+ - **Advanced development guides**: In-depth coverage of complex topics#### Legal Token Framework Components
54
+
55
+ - **Migration documentation**: Guidelines for upgrading from previous versions- **46 LTP Primitive Methods**: Complete coverage across all legal token operations
56
+
57
+ - **Technical specifications**: Detailed implementation documentation - 4 Right Token Primitives (prepare, verify, transfer, validate)
58
+
30
59
  - 5 Obligation Token Primitives (create, verify, fulfill, breach assessment, monitoring)
31
- - 5 Claim Validation Primitives (validate, attest, dispute, bulk processing, templates)
60
+
61
+ ### 🔧 Technical Improvements - 5 Claim Validation Primitives (validate, attest, dispute, bulk processing, templates)
62
+
32
63
  - 6 Proof Generation Primitives (signature, selective disclosure, ZK, legal validity)
33
- - 8 Registry Management Primitives (registry setup, registration, approval, revocation, queries)
34
- - 4 Blockchain Anchoring Primitives (commitment, batch processing, verification, revocation)
35
64
 
36
- #### W3C-Compliant Legal Standards
37
- - **PropertyTitle**: Complete property ownership claim schema
65
+ #### ✅ Test Suite Enhancements - 8 Registry Management Primitives (registry setup, registration, approval, revocation, queries)
66
+
67
+ - **Fixed opcode mapping tests**: Updated tests to reflect Chronicle string operations (OP_SUBSTR, OP_LEFT, OP_RIGHT) - 4 Blockchain Anchoring Primitives (commitment, batch processing, verification, revocation)
68
+
69
+ - **Corrected opcode count**: Updated from 118 to 121 elements to include new Chronicle opcodes
70
+
71
+ - **Perfect test coverage**: All 534 tests now pass (100% success rate)#### W3C-Compliant Legal Standards
72
+
73
+ - **Updated reverseMap validation**: Fixed OP_NOP7 position validation (was incorrectly expecting OP_NOP10)- **PropertyTitle**: Complete property ownership claim schema
74
+
38
75
  - **VehicleTitle**: Vehicle ownership and transfer documentation
39
- - **PromissoryNote**: Financial obligation and debt instruments
40
- - **IntellectualProperty**: IP rights and licensing framework
41
- - **ProfessionalLicense**: Professional certification and licensing
42
- - **MusicLicense**: Music rights and royalty management
43
-
44
- #### Global Digital Attestation Framework (GDAF)
45
- - **6-Module GDAF Implementation**: Complete W3C Verifiable Credentials compliance
46
- - **lib/gdaf/attestation.js**: Digital attestation creation and verification
47
- - **lib/gdaf/identity.js**: Decentralized identity management
48
- - **lib/gdaf/registry.js**: Attestation registry and discovery
76
+
77
+ #### 🛠️ Build System Updates- **PromissoryNote**: Financial obligation and debt instruments
78
+
79
+ - **Enhanced webpack configurations**: Improved build processes for all modules- **IntellectualProperty**: IP rights and licensing framework
80
+
81
+ - **Updated bundle outputs**: Refreshed all minified bundles with latest optimizations- **ProfessionalLicense**: Professional certification and licensing
82
+
83
+ - **Better development workflow**: Streamlined build and test processes- **MusicLicense**: Music rights and royalty management
84
+
85
+
86
+
87
+ #### 🧹 Code Quality Improvements#### Global Digital Attestation Framework (GDAF)
88
+
89
+ - **Linting fixes**: Resolved JavaScript Standard Style violations across utility files- **6-Module GDAF Implementation**: Complete W3C Verifiable Credentials compliance
90
+
91
+ - **Unused import cleanup**: Removed unused dependencies and imports - **lib/gdaf/attestation.js**: Digital attestation creation and verification
92
+
93
+ - **Syntax compatibility**: Fixed ES2020 optional chaining for broader compatibility - **lib/gdaf/identity.js**: Decentralized identity management
94
+
95
+ - **Code organization**: Better separation of concerns and cleaner file structure - **lib/gdaf/registry.js**: Attestation registry and discovery
96
+
49
97
  - **lib/gdaf/credential.js**: W3C Verifiable Credentials implementation
50
- - **lib/gdaf/proof.js**: Cryptographic proof systems
51
- - **lib/gdaf/verification.js**: Multi-layer verification framework
52
98
 
53
- #### Enhanced Cryptographic Primitives
54
- - **Shamir Secret Sharing**: Complete k-of-n threshold cryptography
99
+ ### 🔒 Chronicle Integration - **lib/gdaf/proof.js**: Cryptographic proof systems
100
+
101
+ - **OP_SUBSTR support**: Full implementation of substring operations - **lib/gdaf/verification.js**: Multi-layer verification framework
102
+
103
+ - **OP_LEFT support**: Left substring extraction functionality
104
+
105
+ - **OP_RIGHT support**: Right substring extraction functionality#### Enhanced Cryptographic Primitives
106
+
107
+ - **Updated opcode mappings**: Proper integration of Chronicle string operations into opcode system- **Shamir Secret Sharing**: Complete k-of-n threshold cryptography
108
+
55
109
  - **lib/crypto/shamir.js**: Production-ready SSS implementation
56
- - **bsv.createShares()**: Split secrets into threshold shares
110
+
111
+ ### 📦 Module Improvements - **bsv.createShares()**: Split secrets into threshold shares
112
+
57
113
  - **bsv.reconstructSecret()**: Reconstruct from threshold shares
58
- - **bsv.verifyShares()**: Validate share integrity
59
114
 
60
- ### 🎯 Complete Legal Token Workflow Example
115
+ #### 💎 Utility Enhancements - **bsv.verifyShares()**: Validate share integrity
116
+
117
+ - **Blockchain state management**: Improved simulation and state tracking
118
+
119
+ - **UTXO management**: Enhanced UTXO generation and management tools### 🎯 Complete Legal Token Workflow Example
120
+
121
+ - **Transaction examples**: Comprehensive transaction building examples
122
+
123
+ - **Miner simulation**: Better blockchain mining simulation for development#### Real BSV Integration Demonstration
124
+
125
+ - **Success demonstration**: Working examples of successful operations- **Real Private Keys**: Actual BSV addresses and WIF keys generated
61
126
 
62
- #### Real BSV Integration Demonstration
63
- - **Real Private Keys**: Actual BSV addresses and WIF keys generated
64
127
  - **Mock UTXO System**: Complete testing framework without blockchain dependency
65
- - **Smart Contract Covenants**: Legal token enforcement through BSV covenants
66
- - **End-to-End Workflow**: From claim creation to token transfer with covenant validation
67
128
 
68
- #### Example Results from `complete_ltp_demo.js`:
69
- - Property Right Token: `RT-1bd80ac44e27c3ec0f9dffdd2efffe07`
129
+ ### 🐛 Bug Fixes- **Smart Contract Covenants**: Legal token enforcement through BSV covenants
130
+
131
+ - **Fixed demo script paths**: Corrected relative paths in HTML demos- **End-to-End Workflow**: From claim creation to token transfer with covenant validation
132
+
133
+ - **Resolved test failures**: All opcode-related test issues resolved
134
+
135
+ - **Build output corrections**: Fixed webpack output paths and configurations#### Example Results from `complete_ltp_demo.js`:
136
+
137
+ - **Import path fixes**: Corrected module import paths across the codebase- Property Right Token: `RT-1bd80ac44e27c3ec0f9dffdd2efffe07`
138
+
70
139
  - Obligation Token: `OB-e87eb0388db36b8b5777118ae45c46d3`
71
- - Covenant Address: `1MhX6MRVE79Qn4CtQ6bkk5JJJeMCTXBwwo`
72
- - Transfer Transaction: `4b1125d5dfc53e0157b843b8d2e964922331dd509ca096f9a470bfda421b43e6`
73
140
 
74
- ### 🏗️ Architecture Excellence
141
+ ### 🔄 Backwards Compatibility- Covenant Address: `1MhX6MRVE79Qn4CtQ6bkk5JJJeMCTXBwwo`
142
+
143
+ - **Maintained API compatibility**: All existing APIs remain functional- Transfer Transaction: `4b1125d5dfc53e0157b843b8d2e964922331dd509ca096f9a470bfda421b43e6`
144
+
145
+ - **Legacy file preservation**: Old files archived rather than deleted
146
+
147
+ - **Migration support**: Clear upgrade paths for existing applications### 🏗️ Architecture Excellence
148
+
149
+ - **Version consistency**: No breaking changes to core functionality
75
150
 
76
151
  #### Interface Transformation
77
- **Before (Application Framework):**
78
- ```javascript
79
- bsv.createRightToken() // Created AND published to blockchain
80
- bsv.validateLegalClaim() // Validated AND stored in database
152
+
153
+ ### 📈 Performance Improvements**Before (Application Framework):**
154
+
155
+ - **Optimized bundles**: Reduced bundle sizes through better webpack configurations```javascript
156
+
157
+ - **Faster tests**: Improved test execution speed through better organizationbsv.createRightToken() // Created AND published to blockchain
158
+
159
+ - **Enhanced development experience**: Faster build times and better error reportingbsv.validateLegalClaim() // Validated AND stored in database
160
+
81
161
  bsv.anchorTokenBatch() // Created batch AND sent transaction
82
- ```
83
162
 
84
- **After (Primitives-Only):**
85
- ```javascript
86
- bsv.prepareRightToken() // Prepares token structure only
163
+ ### 🎯 Developer Experience```
164
+
165
+ - **Interactive learning**: Hands-on demos for understanding SmartLedger-BSV capabilities
166
+
167
+ - **Better documentation**: Clear examples and comprehensive API coverage**After (Primitives-Only):**
168
+
169
+ - **Improved debugging**: Better error messages and debugging tools```javascript
170
+
171
+ - **Development tools**: Enhanced utilities for blockchain developmentbsv.prepareRightToken() // Prepares token structure only
172
+
87
173
  bsv.prepareClaimValidation() // Validates structure only
88
- bsv.prepareBatchCommitment() // Prepares commitment only
89
- ```
90
174
 
91
- ### 🛠️ New Development Tools & Testing
175
+ ### 📋 Quality Assurancebsv.prepareBatchCommitment() // Prepares commitment only
176
+
177
+ - **Complete test coverage**: 534/534 tests passing```
178
+
179
+ - **Linting compliance**: Full JavaScript Standard Style compliance
180
+
181
+ - **Build verification**: All builds complete successfully### 🛠️ New Development Tools & Testing
182
+
183
+ - **Cross-platform compatibility**: Verified functionality across different environments
92
184
 
93
185
  #### Comprehensive Demo Suite
94
- - **complete_ltp_demo.js**: Full end-to-end LTP workflow with real BSV keys
186
+
187
+ ---- **complete_ltp_demo.js**: Full end-to-end LTP workflow with real BSV keys
188
+
95
189
  - **simple_demo.js**: Architectural overview and primitives showcase
96
- - **architecture_demo.js**: Before/after comparison demonstration
190
+
191
+ ## Previous Versions- **architecture_demo.js**: Before/after comparison demonstration
192
+
97
193
  - **gdaf_demo.js**: Complete GDAF framework demonstration
98
- - **shamir_demo.js**: Threshold cryptography examples
194
+
195
+ ### [3.3.2] and earlier- **shamir_demo.js**: Threshold cryptography examples
196
+
197
+ Previous version history is available in the git commit log. This changelog format starts with version 3.3.3.
99
198
 
100
199
  #### New NPM Scripts
101
- - **`npm run test:ltp`**: Complete Legal Token Protocol demonstration
200
+
201
+ ---- **`npm run test:ltp`**: Complete Legal Token Protocol demonstration
202
+
102
203
  - **`npm run test:ltp-primitives`**: Primitives-only architecture showcase
103
- - **`npm run test:architecture`**: Architectural transformation comparison
104
204
 
105
- ### 📦 Enhanced Build System
205
+ ### 🚀 Getting Started- **`npm run test:architecture`**: Architectural transformation comparison
206
+
207
+
208
+
209
+ To get started with SmartLedger-BSV v3.3.3:### 📦 Enhanced Build System
210
+
211
+
212
+
213
+ ```bash#### New Standalone Modules
214
+
215
+ npm install @smartledger/bsv@3.3.3- **bsv-ltp.min.js**: Complete Legal Token Protocol standalone module
216
+
217
+ ```- **bsv-shamir.min.js**: Standalone Shamir Secret Sharing module
106
218
 
107
- #### New Standalone Modules
108
- - **bsv-ltp.min.js**: Complete Legal Token Protocol standalone module
109
- - **bsv-shamir.min.js**: Standalone Shamir Secret Sharing module
110
219
  - **bsv-gdaf.min.js**: Complete GDAF framework module
111
220
 
112
- #### Updated Keywords & Metadata
113
- ```json
114
- "legal-token-protocol", "ltp", "legal-tokens", "primitives-only",
115
- "legal-compliance", "property-rights", "obligations", "attestations",
116
- "gdaf", "global-digital-attestation", "w3c-credentials",
221
+ Check out the interactive demos:
222
+
223
+ ```bash#### Updated Keywords & Metadata
224
+
225
+ cd demos```json
226
+
227
+ python3 -m http.server 8080"legal-token-protocol", "ltp", "legal-tokens", "primitives-only",
228
+
229
+ # Open http://localhost:8080"legal-compliance", "property-rights", "obligations", "attestations",
230
+
231
+ ```"gdaf", "global-digital-attestation", "w3c-credentials",
232
+
117
233
  "verifiable-credentials", "shamir-secret-sharing", "threshold-cryptography"
118
- ```
119
234
 
120
- ### 💫 Enterprise Integration Benefits
235
+ ### 📖 Documentation```
236
+
237
+
238
+
239
+ - **API Reference**: `/docs/api/`### 💫 Enterprise Integration Benefits
240
+
241
+ - **Getting Started**: `/docs/getting-started/`
242
+
243
+ - **Examples**: `/examples/`#### For Developers
244
+
245
+ - **Demos**: `/demos/`- ✅ Choose any blockchain platform (BSV, Bitcoin, Ethereum, etc.)
121
246
 
122
- #### For Developers
123
- - ✅ Choose any blockchain platform (BSV, Bitcoin, Ethereum, etc.)
124
247
  - ✅ Choose any storage solution (SQL, NoSQL, IPFS, etc.)
125
- - ✅ Full architectural control and system integration
248
+
249
+ ### 🔗 Links- ✅ Full architectural control and system integration
250
+
126
251
  - ✅ Easy integration with existing business systems
127
252
 
128
- #### For Enterprises
129
- - ✅ No vendor lock-in to specific platforms
253
+ - **GitHub**: https://github.com/codenlighten/smartledger-bsv
254
+
255
+ - **NPM**: https://npmjs.com/package/@smartledger/bsv#### For Enterprises
256
+
257
+ - **Documentation**: https://github.com/codenlighten/smartledger-bsv/tree/main/docs- ✅ No vendor lock-in to specific platforms
130
258
  - ✅ Compliance with existing IT policies
131
259
  - ✅ Legacy system compatibility
132
260
  - ✅ Audit-friendly separation of concerns