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.
Files changed (118) hide show
  1. package/CHANGELOG.md +220 -79
  2. package/README.md +283 -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-mnemonic.min.js +4 -4
  7. package/bsv-script-helper.min.js +2 -2
  8. package/bsv-security.min.js +3 -24
  9. package/bsv-shamir.min.js +2 -2
  10. package/bsv-smartcontract.min.js +10 -8
  11. package/bsv.bundle.js +9 -9
  12. package/bsv.min.js +10 -8
  13. package/build/webpack.bundle.config.js +2 -2
  14. package/build/webpack.config.js +2 -2
  15. package/build/webpack.covenant.config.js +2 -2
  16. package/build/webpack.gdaf.config.js +6 -43
  17. package/build/webpack.script-helper.config.js +2 -2
  18. package/build/webpack.security.config.js +2 -2
  19. package/build/webpack.smartcontract.config.js +2 -2
  20. package/bundle-entry.js +1 -341
  21. package/covenant-entry.js +1 -44
  22. package/demos/README.md +188 -0
  23. package/{architecture_demo.js → demos/architecture_demo.js} +2 -2
  24. package/demos/bsv_wallet_demo.js +242 -0
  25. package/{complete_ltp_demo.js → demos/complete_ltp_demo.js} +1 -1
  26. package/demos/debug_tools_demo.js +87 -0
  27. package/demos/demo_features.js +123 -0
  28. package/demos/easy_interface_demo.js +109 -0
  29. package/demos/ecies_demo.js +182 -0
  30. package/demos/gdaf_core_test.js +131 -0
  31. package/demos/gdaf_demo.js +237 -0
  32. package/demos/ltp_demo.js +361 -0
  33. package/demos/ltp_primitives_demo.js +403 -0
  34. package/demos/message_demo.js +209 -0
  35. package/demos/preimage_separation_demo.js +383 -0
  36. package/demos/script_helper_demo.js +289 -0
  37. package/demos/security_demo.js +287 -0
  38. package/{shamir_demo.js → demos/shamir_demo.js} +1 -1
  39. package/{simple_demo.js → demos/simple_demo.js} +1 -1
  40. package/demos/simple_p2pkh_demo.js +169 -0
  41. package/demos/simple_utxo_preimage_demo.js +196 -0
  42. package/demos/smart_contract_demo.html +1347 -0
  43. package/demos/smart_contract_demo.js +910 -0
  44. package/demos/utxo_generator_demo.js +244 -0
  45. package/demos/validation_pipeline_demo.js +155 -0
  46. package/demos/web3keys.html +740 -0
  47. package/docs/BUNDLE_UPDATE_SUMMARY.md +40 -0
  48. package/docs/DOCUMENTATION_REVIEW_REPORT.md +295 -0
  49. package/docs/FIX_CREATEHMAC_ISSUE.md +91 -0
  50. package/docs/MODULE_REFERENCE_COMPLETE.md +330 -0
  51. package/docs/README.md +107 -79
  52. package/docs/SMARTLEDGER_BSV_USAGE_ANSWERS.md +477 -0
  53. package/docs/SMARTLEDGER_BSV_USAGE_EXAMPLES.js +372 -0
  54. package/docs/SMARTLEDGER_BSV_USAGE_GUIDE.md +555 -0
  55. package/docs/SMART_CONTRACT_DEVELOPMENT_GUIDE.md +1459 -0
  56. package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +411 -0
  57. package/docs/advanced/SMART_CONTRACT_GUIDE.md +1255 -0
  58. package/docs/advanced/UTXO_MANAGER_GUIDE.md +851 -0
  59. package/docs/api/LTP.md +334 -0
  60. package/docs/getting-started/INSTALLATION.md +410 -0
  61. package/docs/getting-started/QUICK_START.md +180 -0
  62. package/docs/migration/FROM_BSV_1_5_6.md +260 -0
  63. package/docs/technical/GDAF_DEVELOPER_INTERFACE.md +187 -0
  64. package/docs/technical/GDAF_IMPLEMENTATION_COMPLETE.md +190 -0
  65. package/docs/technical/SHAMIR_INTEGRATION_SUMMARY.md +165 -0
  66. package/docs/technical/roadmap.md +1250 -0
  67. package/docs/technical/trust_law.md +142 -0
  68. package/examples/complete_workflow_demo.js +783 -0
  69. package/examples/definitive_working_demo.js +261 -0
  70. package/examples/final_working_contracts.js +338 -0
  71. package/examples/smart_contract_templates.js +718 -0
  72. package/examples/working_smart_contracts.js +348 -0
  73. package/gdaf-entry.js +2 -54
  74. package/index.js +32 -0
  75. package/lib/mnemonic/pbkdf2.browser.js +69 -0
  76. package/lib/mnemonic/pbkdf2.js +2 -68
  77. package/lib/mnemonic/pbkdf2.node.js +68 -0
  78. package/ltp-entry.js +2 -92
  79. package/package.json +21 -8
  80. package/script-helper-entry.js +1 -49
  81. package/security-entry.js +1 -70
  82. package/shamir-entry.js +1 -173
  83. package/smartcontract-entry.js +1 -133
  84. package/tests/browser-compatibility/README.md +35 -0
  85. package/tests/browser-compatibility/test-cdn-vs-local.html +186 -0
  86. package/tests/browser-compatibility/test-pbkdf2.html +51 -0
  87. package/tests/test_builtin_verify.js +117 -0
  88. package/tests/test_debug_integration.js +71 -0
  89. package/tests/test_ecdsa_little.js +70 -0
  90. package/tests/test_smartverify_der.js +110 -0
  91. package/utilities/blockchain-state.js +155 -155
  92. package/utilities/blockchain-state.json +103293 -5244
  93. package/utilities/miner-simulator.js +354 -358
  94. package/utilities/mock-utxo-generator.js +54 -54
  95. package/utilities/raw-tx-examples.js +120 -122
  96. package/utilities/success-demo.js +104 -105
  97. package/utilities/transaction-examples.js +188 -188
  98. package/utilities/utxo-manager.js +91 -91
  99. package/utilities/wallet-setup.js +79 -80
  100. package/utilities/working-signature-demo.js +108 -110
  101. package/SECURITY.md +0 -75
  102. package/build/bsv-covenant.min.js +0 -10
  103. package/build/bsv-script-helper.min.js +0 -10
  104. package/build/bsv-security.min.js +0 -31
  105. package/build/bsv-smartcontract.min.js +0 -39
  106. package/build/bsv.bundle.js +0 -39
  107. package/build/bsv.min.js +0 -39
  108. package/validation_test.js +0 -97
  109. /package/docs/{ADVANCED_COVENANT_DEVELOPMENT.md → advanced/ADVANCED_COVENANT_DEVELOPMENT.md} +0 -0
  110. /package/docs/{CUSTOM_SCRIPT_DEVELOPMENT.md → advanced/CUSTOM_SCRIPT_DEVELOPMENT.md} +0 -0
  111. /package/docs/{block.md → api/BLOCKS.md} +0 -0
  112. /package/docs/{ecies.md → api/ECIES.md} +0 -0
  113. /package/docs/{networks.md → api/NETWORKS.md} +0 -0
  114. /package/docs/{script.md → api/SCRIPTS.md} +0 -0
  115. /package/docs/{transaction.md → api/TRANSACTIONS.md} +0 -0
  116. /package/docs/{unspentoutput.md → api/UTXO.md} +0 -0
  117. /package/{test_shamir.js → tests/test_shamir.js} +0 -0
  118. /package/{test_standalone_shamir.html → tests/test_standalone_shamir.html} +0 -0
@@ -0,0 +1,142 @@
1
+ Excellent. Below is the **Trust Protocol Mapping Document (Draft v1.0)** — a comprehensive bridge between *traditional common-law trust principles* (as represented in Weiss’s Concise Trustee Handbook and similar express-trust doctrines) and *SmartLedger’s modern digital legal architecture* (SmartLedger-BSV + LTP + GDAF + NotaryHash).
2
+
3
+ ---
4
+
5
+ # 🧾 **Trust Protocol Mapping Document (v1.0)**
6
+
7
+ ### *Bridging Express Trust Law and the Legal Token Protocol (LTP)*
8
+
9
+ ---
10
+
11
+ ## ⚖️ 1. Core Legal–Digital Mapping
12
+
13
+ | **Traditional Trust Element** | **Description (Common Law)** | **Digital Representation (SmartLedger Framework)** | **Implemented In** |
14
+ | ----------------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------- | ---------------------------------- |
15
+ | **Settlor (Grantor)** | Creator of the trust; provides property or rights to be held in trust. | DID representing issuing authority (may be individual, corporation, DAO). | `identity/` → `createDID()` |
16
+ | **Trustee(s)** | Hold and manage property for benefit of beneficiary; owe fiduciary duty. | DID(s) with VC attestation of role and fiduciary obligations. | `identity/`, `legal/ltp/`, `gdaf/` |
17
+ | **Beneficiary(ies)** | The party entitled to benefit from the trust corpus. | Subject DID(s) listed in claim or rights object. | `legal/ltp/` |
18
+ | **Corpus (Res)** | Property, asset, or rights being held. | Tokenized “claim” object within Legal Token Protocol. | `ltp/` |
19
+ | **Trust Instrument** | Written or oral declaration establishing trust terms. | JSON-LD trust schema anchored via NotaryHash; cryptographically signed. | `anchor/`, `gdaf/` |
20
+ | **Purpose Clause** | Lawful reason for trust (charitable, private, etc.). | `purpose` field in token schema (ISO 3166 jurisdictional & legal tags). | `ltp/schema` |
21
+ | **Jurisdiction (Situs)** | Governing law and forum. | `jurisdiction` field in credential metadata (ISO country + legal system). | `compliance/` |
22
+ | **Trust Certificate** | Document showing beneficial ownership or capital interest. | Token credential (VC or NFT-style right token) anchored on-chain. | `ltp/`, `gdaf/` |
23
+ | **Minutes / Accounting** | Trustee logs of actions, decisions, disbursements. | Verifiable “ActionLogCredential” anchored on-chain (audit trail). | `anchor/`, `gdaf/` |
24
+ | **Trustee Resolution** | Decision or vote by trustees. | Multi-sig or VC “ResolutionCredential” anchored + signed by quorum. | `ltp/`, `identity/` |
25
+ | **Revocation / Termination** | Ending or amending trust instrument. | `revokeRightToken(tokenId)` + updated anchor proof in revocation registry. | `ltp/` |
26
+ | **Liability & Indemnity** | Limits trustee liability or defines indemnification. | Schema fields `trusteeIndemnity`, `liabilityLimit`, hashed in corpus. | `ltp/schema` |
27
+ | **Audit & Oversight** | External or internal verification of compliance. | Chain-based audit credential + GDAF selective proof verification. | `gdaf/`, `anchor/` |
28
+
29
+ ---
30
+
31
+ ## 🧱 2. Protocol Flow Example: Creation → Management → Termination
32
+
33
+ 1. **Declaration Phase**
34
+
35
+ ```js
36
+ const settlorDid = SmartLedgerBSV.GDAF.createDID(pubKey);
37
+ const trusteeDid = SmartLedgerBSV.GDAF.createDID(trusteeKey);
38
+ const trustSchema = SmartLedgerBSV.LTP.createRightToken(
39
+ 'PrivateExpressTrust',
40
+ trusteeDid,
41
+ { corpus: 'DigitalAssetXYZ', purpose: 'Beneficiary Support', jurisdiction: 'US-VA' },
42
+ settlorKey
43
+ );
44
+ const txid = SmartLedgerBSV.Anchor.commitHash(trustSchema.rootHash, { purpose: 'trust-declaration' });
45
+ ```
46
+
47
+ 2. **Operation Phase**
48
+
49
+ * Trustees issue VC “TrusteeActionCredential” for each action (investment, distribution, amendment).
50
+ * Anchors created via NotaryHash.
51
+ * Beneficiaries view proofs using ZK disclosure of entitlement without revealing full corpus.
52
+
53
+ 3. **Termination Phase**
54
+
55
+ ```js
56
+ SmartLedgerBSV.LTP.revokeRightToken(trustSchema.id);
57
+ SmartLedgerBSV.Anchor.commitHash(revocationHash, { purpose: 'trust-termination' });
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 🧩 3. Compliance & Legal Framework Overlay
63
+
64
+ | **Principle** | **SmartLedger Implementation** | **Effect** |
65
+ | ------------------ | ---------------------------------------------------------------- | -------------------------------------------- |
66
+ | *Lawful purpose* | Schema validation forbids unlawful or undefined `purpose` field. | Ensures digital trusts are legally valid. |
67
+ | *Fiduciary duty* | VC attestation + signature requirement for trustee actions. | Enforceable accountability. |
68
+ | *Privacy duty* | HMAC/commitment model, zero-knowledge field proofs. | GDPR & fiduciary confidentiality compliance. |
69
+ | *Accounting duty* | Immutable audit logs via anchor proofs. | Transparent stewardship. |
70
+ | *Right to redress* | Dispute resolution VC + signature chain. | Legal recourse framework. |
71
+
72
+ ---
73
+
74
+ ## 🔐 4. Schema Alignment
75
+
76
+ ### TrustCredential (example)
77
+
78
+ ```json
79
+ {
80
+ "@context": ["https://www.w3.org/2018/credentials/v1", "https://smartledger.org/ltp/trust/v1"],
81
+ "type": ["VerifiableCredential", "TrustCredential"],
82
+ "issuer": "did:smartledger:abcd1234",
83
+ "issuanceDate": "2025-10-22T00:00:00Z",
84
+ "credentialSubject": {
85
+ "trustName": "Ward Family Private Express Trust",
86
+ "settlor": "did:smartledger:settlor123",
87
+ "trustee": ["did:smartledger:trustee456"],
88
+ "beneficiary": ["did:smartledger:beneficiary789"],
89
+ "corpus": { "assetType": "DigitalProperty", "assetId": "hash:abcd" },
90
+ "purpose": "Estate Preservation",
91
+ "jurisdiction": "US-VA"
92
+ },
93
+ "proof": {
94
+ "type": "SmartLedgerSignature2025",
95
+ "created": "2025-10-22T00:00:00Z",
96
+ "proofPurpose": "assertionMethod",
97
+ "verificationMethod": "did:smartledger:abcd1234#keys-1",
98
+ "jws": "eyJhbGciOiJFUzI1NiIsInR5cCI6..."
99
+ }
100
+ }
101
+ ```
102
+
103
+ ---
104
+
105
+ ## 🧩 5. Inter-Protocol Integration
106
+
107
+ | **Component** | **Purpose** | **Trust-Mapping Equivalent** |
108
+ | -------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------- |
109
+ | **SmartLedger-BSV Crypto Layer** | Provides signature, Shamir recovery, canonical hashing. | Legal “seal” of trustee instrument. |
110
+ | **GDAF (Identity)** | Defines DID, VC issuance, selective proof. | Identifies Settlor/Trustee/Beneficiary with attested authority. |
111
+ | **LTP (Legal Tokens)** | Encodes property, licenses, rights. | Defines trust corpus & certificates. |
112
+ | **NotaryHash** | Anchors proofs on-chain. | Ledgered minutes, immutable recordkeeping. |
113
+ | **Compliance Module** | Applies GDPR/eIDAS/KYC filters. | Ensures lawful privacy & admissibility. |
114
+
115
+ ---
116
+
117
+ ## 🌐 6. Future Extensions
118
+
119
+ | **Goal** | **Description** |
120
+ | ------------------------------------------- | -------------------------------------------------------------------- |
121
+ | **Multi-jurisdiction Templates** | Schema variants for US Common Law, UK Equity, EU Civil Trusts. |
122
+ | **Trustee Dashboard SDK** | UI toolkit to manage credentials, actions, audit logs. |
123
+ | **AI Compliance Auditor** | GDAF-linked AI validator for fiduciary & jurisdictional consistency. |
124
+ | **Integration with National ID frameworks** | Optional verification with eIDAS/eID. |
125
+
126
+ ---
127
+
128
+ ## 🧭 7. Conclusion
129
+
130
+ By aligning SmartLedger’s LTP & GDAF architecture with express trust law, the system transforms **trusts, contracts, and fiduciary duties** into **digitally verifiable legal primitives**.
131
+
132
+ Every trustee signature, declaration, and action can now be:
133
+ ✅ Proven on-chain
134
+ ✅ Audited under jurisdiction
135
+ ✅ Recovered by lawful heirs
136
+ ✅ Compliant with privacy & fiduciary standards
137
+
138
+ This makes SmartLedger’s infrastructure the **world’s first “Trust-as-Code” framework** — where **Law, Ledger, and Logic** converge.
139
+
140
+ ---
141
+
142
+ Would you like me to extend this into a **formal Trust Protocol Specification (TPS 1.0)** — with detailed JSON schemas, method signatures, and governance model (Trust Registrar, Revocation Registry, Jurisdiction Tags, etc.) so your LTP developers can begin implementation directly?