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
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
# Legal Token Protocol (LTP)
|
|
2
|
+
|
|
3
|
+
## What is LTP?
|
|
4
|
+
|
|
5
|
+
The Legal Token Protocol (LTP) is SmartLedger-BSV's comprehensive framework for creating **legally interpretable digital tokens** that represent real-world rights, obligations, and legal relationships with cryptographic proof and blockchain anchoring.
|
|
6
|
+
|
|
7
|
+
### Core Purpose
|
|
8
|
+
|
|
9
|
+
LTP bridges the gap between **traditional legal concepts** and **blockchain technology** by:
|
|
10
|
+
- **Digitizing Legal Rights**: Converting property titles, licenses, permits into cryptographically signed tokens
|
|
11
|
+
- **Managing Legal Obligations**: Creating enforceable digital obligations with payment schedules and compliance tracking
|
|
12
|
+
- **Ensuring Legal Compliance**: Providing jurisdiction-specific validation and regulatory compliance primitives
|
|
13
|
+
- **Maintaining Audit Trails**: Creating immutable records of legal token lifecycle events
|
|
14
|
+
|
|
15
|
+
### What Makes LTP Different
|
|
16
|
+
|
|
17
|
+
Unlike simple utility tokens or NFTs, LTP tokens are designed to be **legally meaningful**:
|
|
18
|
+
- **W3C Standards Compliant**: Built on Verifiable Credentials standard for interoperability
|
|
19
|
+
- **Jurisdiction-Aware**: Supports different legal frameworks (US, EU, etc.)
|
|
20
|
+
- **Privacy-Preserving**: Selective disclosure allows sharing only necessary information
|
|
21
|
+
- **Legally Binding**: Designed to work within existing legal frameworks and courts
|
|
22
|
+
|
|
23
|
+
## 🚀 Quick Start
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
const bsv = require('@smartledger/bsv');
|
|
27
|
+
|
|
28
|
+
// Create a property right token
|
|
29
|
+
const ownerKey = new bsv.PrivateKey();
|
|
30
|
+
const propertyData = {
|
|
31
|
+
type: 'PropertyTitle',
|
|
32
|
+
owner: 'did:smartledger:' + ownerKey.toPublicKey().toString(),
|
|
33
|
+
jurisdiction: 'US-CA',
|
|
34
|
+
property: {
|
|
35
|
+
address: '123 Main St, San Francisco, CA 94105',
|
|
36
|
+
parcelId: 'APN-12345678',
|
|
37
|
+
area: { value: 1000, unit: 'sqft' }
|
|
38
|
+
},
|
|
39
|
+
value: { amount: 850000, currency: 'USD' }
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const propertyToken = bsv.createRightToken(propertyData, ownerKey, {
|
|
43
|
+
addProof: true,
|
|
44
|
+
anchor: false,
|
|
45
|
+
register: false
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
console.log('Token created:', propertyToken.success);
|
|
49
|
+
console.log('Token ID:', propertyToken.token.id);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 📚 Complete API Reference
|
|
53
|
+
|
|
54
|
+
### Direct Token Functions
|
|
55
|
+
|
|
56
|
+
#### `bsv.createRightToken(data, privateKey, options)`
|
|
57
|
+
Creates a legal right token (property, vehicle, intellectual property, etc.)
|
|
58
|
+
|
|
59
|
+
**Parameters:**
|
|
60
|
+
- `data` - Token data object with type, owner, jurisdiction, and specific claim data
|
|
61
|
+
- `privateKey` - PrivateKey instance for signing
|
|
62
|
+
- `options` - Configuration options (addProof, anchor, register)
|
|
63
|
+
|
|
64
|
+
**Returns:** `{ success: boolean, token: Object, type: string }`
|
|
65
|
+
|
|
66
|
+
#### `bsv.verifyLegalToken(token, publicKey)`
|
|
67
|
+
Verifies a legal token's cryptographic signature and validity
|
|
68
|
+
|
|
69
|
+
**Parameters:**
|
|
70
|
+
- `token` - Token object to verify
|
|
71
|
+
- `publicKey` - Public key string for verification
|
|
72
|
+
|
|
73
|
+
**Returns:** `{ valid: boolean, publicKey: string, tokenHash: string }`
|
|
74
|
+
|
|
75
|
+
#### `bsv.validateLegalClaim(claimData, schemaType)`
|
|
76
|
+
Validates claim data against legal schemas
|
|
77
|
+
|
|
78
|
+
**Parameters:**
|
|
79
|
+
- `claimData` - Claim object to validate
|
|
80
|
+
- `schemaType` - Schema type ('PropertyTitle', 'VehicleTitle', etc.)
|
|
81
|
+
|
|
82
|
+
**Returns:** `{ valid: boolean, schema: string, requiredFields?: Array }`
|
|
83
|
+
|
|
84
|
+
#### `bsv.createSelectiveDisclosure(token, revealedFields, nonce)`
|
|
85
|
+
Creates selective disclosure proof for privacy protection
|
|
86
|
+
|
|
87
|
+
**Parameters:**
|
|
88
|
+
- `token` - Token to create disclosure proof for
|
|
89
|
+
- `revealedFields` - Array of field paths to reveal
|
|
90
|
+
- `nonce` - Unique nonce string
|
|
91
|
+
|
|
92
|
+
**Returns:** `{ success: boolean, proof: Object, disclosures: Array }`
|
|
93
|
+
|
|
94
|
+
#### `bsv.createLegalRegistry(config)`
|
|
95
|
+
Creates legal token registry configuration
|
|
96
|
+
|
|
97
|
+
**Parameters:**
|
|
98
|
+
- `config` - Registry configuration object
|
|
99
|
+
|
|
100
|
+
**Returns:** Registry configuration object
|
|
101
|
+
|
|
102
|
+
#### `bsv.createLegalValidityProof(token, jurisdiction, nonce)`
|
|
103
|
+
Creates legal validity proof for compliance
|
|
104
|
+
|
|
105
|
+
**Parameters:**
|
|
106
|
+
- `token` - Token to validate
|
|
107
|
+
- `jurisdiction` - Jurisdiction rules object
|
|
108
|
+
- `nonce` - Unique nonce string
|
|
109
|
+
|
|
110
|
+
**Returns:** `{ success: boolean, proof: Object, valid: boolean }`
|
|
111
|
+
|
|
112
|
+
### LTP Class Interface
|
|
113
|
+
|
|
114
|
+
```javascript
|
|
115
|
+
const ltp = new bsv.LTP();
|
|
116
|
+
|
|
117
|
+
// Transfer a right token
|
|
118
|
+
const transfer = ltp.transferRight(token, newOwnerDID, ownerKey, {
|
|
119
|
+
reason: 'Sale',
|
|
120
|
+
consideration: { amount: 875000, currency: 'USD' }
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Create obligation from right
|
|
124
|
+
const obligation = ltp.createObligation(rightToken, obligationData, privateKey);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Primitives-Only Architecture
|
|
128
|
+
|
|
129
|
+
For maximum flexibility, use the preparation functions that return data for external systems to handle:
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
// Prepare right token (no blockchain interaction)
|
|
133
|
+
const rightPrep = bsv.prepareRightToken(
|
|
134
|
+
'PropertyTitle',
|
|
135
|
+
issuerDID,
|
|
136
|
+
subjectDID,
|
|
137
|
+
claimData,
|
|
138
|
+
issuerPrivateKey,
|
|
139
|
+
options
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// Prepare obligation token
|
|
143
|
+
const obligationPrep = bsv.prepareObligationToken(
|
|
144
|
+
'PaymentObligation',
|
|
145
|
+
issuerDID,
|
|
146
|
+
obligorDID,
|
|
147
|
+
obligationData,
|
|
148
|
+
issuerPrivateKey,
|
|
149
|
+
options
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
// Prepare selective disclosure proof
|
|
153
|
+
const disclosurePrep = bsv.prepareSelectiveDisclosure(
|
|
154
|
+
token,
|
|
155
|
+
revealedFields,
|
|
156
|
+
nonce
|
|
157
|
+
);
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## 🏗️ Architecture & Module Integration
|
|
161
|
+
|
|
162
|
+
### How LTP Integrates with SmartLedger-BSV
|
|
163
|
+
|
|
164
|
+
LTP is built on top of SmartLedger-BSV's modular architecture and integrates seamlessly with other modules:
|
|
165
|
+
|
|
166
|
+
#### **Foundation Layer (Required)**
|
|
167
|
+
- **Core BSV (`bsv.min.js`)**: Provides Bitcoin SV primitives (keys, transactions, addresses)
|
|
168
|
+
- **Cryptographic Functions**: Uses hardened elliptic curve implementations for all signatures
|
|
169
|
+
|
|
170
|
+
#### **Identity Layer (Recommended)**
|
|
171
|
+
- **GDAF Module (`bsv-gdaf.min.js`)**: Provides DID creation and Verifiable Credential standards
|
|
172
|
+
- **Integration**: LTP tokens reference DIDs for issuers, subjects, and obligors
|
|
173
|
+
|
|
174
|
+
#### **Smart Contract Layer (Optional)**
|
|
175
|
+
- **Smart Contract Module (`bsv-smartcontract.min.js`)**: Provides covenant enforcement
|
|
176
|
+
- **Integration**: LTP tokens can be protected by smart contract covenants for automatic enforcement
|
|
177
|
+
|
|
178
|
+
#### **Security Layer (Optional)**
|
|
179
|
+
- **Shamir Module (`bsv-shamir.min.js`)**: Provides threshold cryptography
|
|
180
|
+
- **Integration**: Can split LTP token signing keys across multiple parties
|
|
181
|
+
|
|
182
|
+
#### **Privacy Layer (Built-in)**
|
|
183
|
+
- **Selective Disclosure**: Native privacy-preserving proofs within LTP
|
|
184
|
+
- **ECIES Encryption**: Uses core BSV ECIES for encrypted data fields
|
|
185
|
+
|
|
186
|
+
### Primitives-Only Design Philosophy
|
|
187
|
+
|
|
188
|
+
LTP follows SmartLedger-BSV's **primitives-only architecture**:
|
|
189
|
+
|
|
190
|
+
**What LTP Provides (Preparation Functions):**
|
|
191
|
+
- ✅ **Legal Structure Validation**: Ensures tokens follow legal standards
|
|
192
|
+
- ✅ **Cryptographic Proof Generation**: Creates verifiable signatures and proofs
|
|
193
|
+
- ✅ **Compliance Checking**: Validates against jurisdiction-specific rules
|
|
194
|
+
- ✅ **Token Lifecycle Management**: Handles creation, transfer, and revocation
|
|
195
|
+
- ✅ **Registry Data Formatting**: Prepares data for external registry systems
|
|
196
|
+
- ✅ **Blockchain Commitment Preparation**: Creates anchoring data without publishing
|
|
197
|
+
|
|
198
|
+
**What External Systems Handle:**
|
|
199
|
+
- 🔗 **Blockchain Publishing**: Your application publishes to BSV blockchain
|
|
200
|
+
- 🔗 **Registry Storage**: Your database/registry stores token data
|
|
201
|
+
- 🔗 **Network Communication**: Your API handles network requests
|
|
202
|
+
- 🔗 **User Interfaces**: Your frontend displays and manages tokens
|
|
203
|
+
- 🔗 **Business Logic**: Your application handles domain-specific workflows
|
|
204
|
+
|
|
205
|
+
### Benefits of This Architecture
|
|
206
|
+
- **Maximum Flexibility**: Use any blockchain, database, or UI framework
|
|
207
|
+
- **No Vendor Lock-in**: Not tied to specific platforms or services
|
|
208
|
+
- **Enterprise Ready**: Clean separation allows enterprise integration
|
|
209
|
+
- **Legal Compliance**: Focus on legal correctness without implementation constraints
|
|
210
|
+
|
|
211
|
+
## 📋 What LTP Can Tokenize
|
|
212
|
+
|
|
213
|
+
### Real-World Legal Rights (Right Tokens)
|
|
214
|
+
- **🏠 PropertyTitle** - Real estate ownership, deeds, titles
|
|
215
|
+
- **🚗 VehicleTitle** - Car, boat, aircraft ownership documents
|
|
216
|
+
- **💡 IntellectualProperty** - Patents, trademarks, copyrights
|
|
217
|
+
- **🎵 MusicLicense** - Music publishing, performance rights
|
|
218
|
+
- **💻 SoftwareLicense** - Software usage, distribution rights
|
|
219
|
+
- **💰 FinancialInstrument** - Bonds, stocks, derivatives
|
|
220
|
+
- **📄 PromissoryNote** - IOUs, payment promises
|
|
221
|
+
- **🏅 ProfessionalLicense** - Professional certifications, permits
|
|
222
|
+
- **🎫 AccessRight** - Membership rights, access permissions
|
|
223
|
+
- **🗳️ VotingRight** - Shareholder voting, governance rights
|
|
224
|
+
|
|
225
|
+
### Real-World Legal Obligations (Obligation Tokens)
|
|
226
|
+
- **💵 PaymentObligation** - Loan payments, rent, mortgages
|
|
227
|
+
- **📦 DeliveryObligation** - Shipping, delivery requirements
|
|
228
|
+
- **🔧 MaintenanceObligation** - Maintenance contracts, warranties
|
|
229
|
+
- **📊 ComplianceObligation** - Regulatory reporting, compliance
|
|
230
|
+
- **📋 ReportingObligation** - Financial reporting, disclosures
|
|
231
|
+
- **🤐 ConfidentialityObligation** - NDAs, confidentiality agreements
|
|
232
|
+
- **🚫 NonCompeteObligation** - Non-compete agreements
|
|
233
|
+
- **🛡️ WarrantyObligation** - Product warranties, guarantees
|
|
234
|
+
|
|
235
|
+
### Module Relationships
|
|
236
|
+
|
|
237
|
+
Each token type leverages different SmartLedger-BSV capabilities:
|
|
238
|
+
|
|
239
|
+
```javascript
|
|
240
|
+
// Property title using multiple modules
|
|
241
|
+
const propertyToken = bsv.createRightToken({
|
|
242
|
+
type: 'PropertyTitle', // LTP: Legal structure
|
|
243
|
+
owner: ownerDID, // GDAF: Digital identity
|
|
244
|
+
jurisdiction: 'US-CA', // LTP: Legal compliance
|
|
245
|
+
// Signed with hardened crypto // Core: Enhanced security
|
|
246
|
+
// Can be covenant-protected // SmartContract: Enforcement
|
|
247
|
+
// Keys can use Shamir sharing // Shamir: Distributed control
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## � LTP Internal Architecture
|
|
252
|
+
|
|
253
|
+
LTP is composed of 6 specialized modules working together:
|
|
254
|
+
|
|
255
|
+
### Core Modules (`lib/ltp/`)
|
|
256
|
+
|
|
257
|
+
1. **`right.js`** - Legal rights token creation and validation
|
|
258
|
+
- Creates property titles, licenses, permits
|
|
259
|
+
- Handles token transfers and ownership changes
|
|
260
|
+
- Validates right types and legal structures
|
|
261
|
+
|
|
262
|
+
2. **`obligation.js`** - Legal obligation token management
|
|
263
|
+
- Creates payment, delivery, compliance obligations
|
|
264
|
+
- Tracks obligation lifecycle and fulfillment
|
|
265
|
+
- Manages breach detection and remediation
|
|
266
|
+
|
|
267
|
+
3. **`claim.js`** - Legal claim validation and attestation
|
|
268
|
+
- Validates claims against legal schemas
|
|
269
|
+
- Provides attestation and notarization primitives
|
|
270
|
+
- Handles bulk claim processing
|
|
271
|
+
|
|
272
|
+
4. **`proof.js`** - Cryptographic proof generation
|
|
273
|
+
- Creates signature proofs for authenticity
|
|
274
|
+
- Generates selective disclosure proofs for privacy
|
|
275
|
+
- Produces legal validity proofs for compliance
|
|
276
|
+
- Handles zero-knowledge proofs for sensitive data
|
|
277
|
+
|
|
278
|
+
5. **`registry.js`** - Token registry management
|
|
279
|
+
- Prepares registry configurations and policies
|
|
280
|
+
- Handles token registration and approval workflows
|
|
281
|
+
- Manages revocation and status tracking
|
|
282
|
+
- Provides search and audit capabilities
|
|
283
|
+
|
|
284
|
+
6. **`anchor.js`** - Blockchain anchoring preparation
|
|
285
|
+
- Prepares commitment hashes for blockchain storage
|
|
286
|
+
- Handles batch anchoring for efficiency
|
|
287
|
+
- Creates merkle proofs for token verification
|
|
288
|
+
- Formats revocation data for on-chain publishing
|
|
289
|
+
|
|
290
|
+
### How These Work Together
|
|
291
|
+
|
|
292
|
+
```javascript
|
|
293
|
+
// Complete workflow using all 6 modules
|
|
294
|
+
const claim = bsv.LTP.Claim.validate(propertyData, 'PropertyTitle'); // 1. Validate
|
|
295
|
+
const rightToken = bsv.LTP.Right.create(claim, ownerKey); // 2. Create right
|
|
296
|
+
const obligation = bsv.LTP.Obligation.create(rightToken, taxData); // 3. Create obligation
|
|
297
|
+
const proof = bsv.LTP.Proof.createSignature(rightToken, issuerKey); // 4. Generate proof
|
|
298
|
+
const registry = bsv.LTP.Registry.register(rightToken); // 5. Prepare registry
|
|
299
|
+
const anchor = bsv.LTP.Anchor.prepareCommitment(rightToken); // 6. Prepare anchoring
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## 🔐 Security & Trust Features
|
|
303
|
+
|
|
304
|
+
- **🔒 Cryptographic Signatures** - All tokens signed with enhanced elliptic curves
|
|
305
|
+
- **🎭 Selective Disclosure** - Privacy-preserving proof generation with zero-knowledge
|
|
306
|
+
- **⚖️ Legal Validity Proofs** - Jurisdiction-specific compliance verification
|
|
307
|
+
- **⛓️ Blockchain Anchoring** - Immutable commitment proofs on BSV blockchain
|
|
308
|
+
- **📚 Registry Management** - Complete token lifecycle tracking and audit trails
|
|
309
|
+
- **🛡️ Smart Contract Protection** - Optional covenant enforcement for automatic compliance
|
|
310
|
+
- **🔑 Multi-Signature Support** - Shamir secret sharing for distributed key management
|
|
311
|
+
|
|
312
|
+
## 🎯 Real-World Applications
|
|
313
|
+
|
|
314
|
+
LTP integrates with other SmartLedger-BSV modules for complete enterprise solutions:
|
|
315
|
+
|
|
316
|
+
### 🏡 Real Estate & Property Management
|
|
317
|
+
```javascript
|
|
318
|
+
// Complete property title system with GDAF identity verification
|
|
319
|
+
const identity = bsv.GDAF.createIdentity(ownerData); // Identity layer
|
|
320
|
+
const titleClaim = bsv.LTP.Claim.validate(propertyData, 'RealEstate'); // Legal validation
|
|
321
|
+
const propertyTitle = bsv.LTP.Right.create(titleClaim, ownerKey); // Create title token
|
|
322
|
+
const transferCovenant = bsv.SmartContract.createCovenant(titleRules); // Smart enforcement
|
|
323
|
+
const sharedKey = bsv.Shamir.split(ownerKey, 3, 5); // Distributed security
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### 💼 Corporate Governance & Compliance
|
|
327
|
+
```javascript
|
|
328
|
+
// Business license with automatic compliance monitoring
|
|
329
|
+
const businessLicense = bsv.LTP.Right.create(licenseData, corporateKey);
|
|
330
|
+
const complianceObligation = bsv.LTP.Obligation.create(license, regulations);
|
|
331
|
+
const auditCovenant = bsv.SmartContract.createAuditContract(complianceRules);
|
|
332
|
+
const executiveKeys = bsv.Shamir.split(corporateKey, 3, 7);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### 🏦 Financial Services & Banking
|
|
336
|
+
```javascript
|
|
337
|
+
// Loan agreement with payment automation
|
|
338
|
+
const loanObligation = bsv.LTP.Obligation.create(loanTerms, borrowerKey);
|
|
339
|
+
const paymentCovenant = bsv.SmartContract.createPaymentSchedule(terms);
|
|
340
|
+
const creditProof = bsv.LTP.Proof.createSignature(creditData, bankKey);
|
|
341
|
+
const escrowKeys = bsv.Shamir.split(escrowKey, 2, 3);
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### 🎓 Education & Professional Certification
|
|
345
|
+
```javascript
|
|
346
|
+
// Academic credential with verification
|
|
347
|
+
const degreeData = bsv.GDAF.createCredential(graduateData);
|
|
348
|
+
const degreeClaim = bsv.LTP.Claim.validate(degreeData, 'AcademicDegree');
|
|
349
|
+
const diploma = bsv.LTP.Right.create(degreeClaim, universityKey);
|
|
350
|
+
const verificationProof = bsv.LTP.Proof.createValidity(diploma, accreditorKey);
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### 🚛 Supply Chain & Logistics
|
|
354
|
+
```javascript
|
|
355
|
+
// Delivery tracking with quality assurance
|
|
356
|
+
const deliveryObligation = bsv.LTP.Obligation.create(shipmentData, supplierKey);
|
|
357
|
+
const qualityContract = bsv.SmartContract.createQualityGates(standards);
|
|
358
|
+
const trackingProof = bsv.LTP.Proof.createSignature(locationData, carrierKey);
|
|
359
|
+
const insuranceKeys = bsv.Shamir.split(insuranceKey, 2, 4);
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### 🏛️ Government & Public Services
|
|
363
|
+
```javascript
|
|
364
|
+
// Government permit with regulatory compliance
|
|
365
|
+
const permitData = bsv.GDAF.createGovernmentID(citizenData);
|
|
366
|
+
const permitClaim = bsv.LTP.Claim.validate(permitData, 'BuildingPermit');
|
|
367
|
+
const buildingPermit = bsv.LTP.Right.create(permitClaim, governmentKey);
|
|
368
|
+
const complianceContract = bsv.SmartContract.createRegulatoryContract(codes);
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## 📋 Token Type Categories
|
|
372
|
+
|
|
373
|
+
### Right Tokens 🏆
|
|
374
|
+
- **Property Titles** - Real estate, vehicles, patents, trademarks
|
|
375
|
+
- **Business Licenses** - Professional, operational, regulatory permits
|
|
376
|
+
- **Access Rights** - Security, membership, usage privileges
|
|
377
|
+
- **Intellectual Property** - Copyrights, licensing agreements, royalties
|
|
378
|
+
|
|
379
|
+
### Obligation Tokens 📝
|
|
380
|
+
- **Payment Obligations** - Invoices, loans, payment schedules, bonds
|
|
381
|
+
- **Delivery Obligations** - Supply contracts, service agreements, milestones
|
|
382
|
+
- **Compliance Obligations** - Regulatory, audit, reporting requirements
|
|
383
|
+
- **Performance Obligations** - SLAs, quality standards, warranty terms
|
|
384
|
+
|
|
385
|
+
### Legal Claims 🎖️
|
|
386
|
+
- **Identity Claims** - Certifications, credentials, qualifications, clearances
|
|
387
|
+
- **Property Claims** - Ownership, liens, encumbrances, easements
|
|
388
|
+
- **Performance Claims** - Warranties, guarantees, quality assurance
|
|
389
|
+
- **Compliance Claims** - Regulatory adherence, audit results, certifications
|
|
390
|
+
|
|
391
|
+
## 📖 Examples
|
|
392
|
+
|
|
393
|
+
See the working demonstration files:
|
|
394
|
+
- `demos/ltp_demo.js` - Complete LTP workflow
|
|
395
|
+
- `demos/ltp_primitives_demo.js` - Primitives-only architecture
|
|
396
|
+
- `demos/complete_ltp_demo.js` - End-to-end with real BSV keys
|
|
397
|
+
|
|
398
|
+
## 🌐 W3C Compliance
|
|
399
|
+
|
|
400
|
+
All LTP tokens follow W3C Verifiable Credential standards with SmartLedger extensions for legal compliance and Bitcoin SV blockchain integration.
|
|
401
|
+
|
|
402
|
+
## ⚖️ Legal Framework
|
|
403
|
+
|
|
404
|
+
The Legal Token Protocol is designed to work within existing legal frameworks and provides primitives for:
|
|
405
|
+
- Legal claim attestation and validation
|
|
406
|
+
- Jurisdictional compliance checking
|
|
407
|
+
- Regulatory proof generation
|
|
408
|
+
- Audit trail preparation
|
|
409
|
+
- Right and obligation lifecycle management
|
|
410
|
+
|
|
411
|
+
For trust law integration, see [Trust Protocol Mapping](../technical/trust_law.md).
|