HieraChain 0.0.1__tar.gz

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 (178) hide show
  1. hierachain-0.0.1/HieraChain.egg-info/PKG-INFO +185 -0
  2. hierachain-0.0.1/HieraChain.egg-info/SOURCES.txt +176 -0
  3. hierachain-0.0.1/HieraChain.egg-info/dependency_links.txt +1 -0
  4. hierachain-0.0.1/HieraChain.egg-info/entry_points.txt +2 -0
  5. hierachain-0.0.1/HieraChain.egg-info/requires.txt +51 -0
  6. hierachain-0.0.1/HieraChain.egg-info/top_level.txt +1 -0
  7. hierachain-0.0.1/LICENSE-APACHE +178 -0
  8. hierachain-0.0.1/LICENSE-MIT +21 -0
  9. hierachain-0.0.1/MANIFEST.in +13 -0
  10. hierachain-0.0.1/PKG-INFO +185 -0
  11. hierachain-0.0.1/README.md +108 -0
  12. hierachain-0.0.1/SECURITY.md +32 -0
  13. hierachain-0.0.1/hierachain/__init__.py +27 -0
  14. hierachain-0.0.1/hierachain/__main__.py +24 -0
  15. hierachain-0.0.1/hierachain/adapters/__init__.py +5 -0
  16. hierachain-0.0.1/hierachain/adapters/database/__init__.py +7 -0
  17. hierachain-0.0.1/hierachain/adapters/database/sqlite_adapter.py +763 -0
  18. hierachain-0.0.1/hierachain/adapters/storage/__init__.py +7 -0
  19. hierachain-0.0.1/hierachain/adapters/storage/file_storage.py +690 -0
  20. hierachain-0.0.1/hierachain/adapters/storage/redis_storage.py +523 -0
  21. hierachain-0.0.1/hierachain/api/__init__.py +27 -0
  22. hierachain-0.0.1/hierachain/api/blockchain_explorer.py +506 -0
  23. hierachain-0.0.1/hierachain/api/graphql/__init__.py +5 -0
  24. hierachain-0.0.1/hierachain/api/graphql/schema.py +562 -0
  25. hierachain-0.0.1/hierachain/api/server.py +433 -0
  26. hierachain-0.0.1/hierachain/api/storage/__init__.py +83 -0
  27. hierachain-0.0.1/hierachain/api/storage/encryption.py +226 -0
  28. hierachain-0.0.1/hierachain/api/storage/endpoint_helpers.py +341 -0
  29. hierachain-0.0.1/hierachain/api/storage/explorer_helpers.py +365 -0
  30. hierachain-0.0.1/hierachain/api/storage/ipfs_client.py +522 -0
  31. hierachain-0.0.1/hierachain/api/storage/utils.py +306 -0
  32. hierachain-0.0.1/hierachain/api/v1/__init__.py +5 -0
  33. hierachain-0.0.1/hierachain/api/v1/endpoints.py +598 -0
  34. hierachain-0.0.1/hierachain/api/v1/schemas.py +282 -0
  35. hierachain-0.0.1/hierachain/api/v2/__init__.py +5 -0
  36. hierachain-0.0.1/hierachain/api/v2/endpoints.py +497 -0
  37. hierachain-0.0.1/hierachain/api/v2/schemas.py +413 -0
  38. hierachain-0.0.1/hierachain/api/v3/__init__.py +5 -0
  39. hierachain-0.0.1/hierachain/api/v3/endpoints.py +106 -0
  40. hierachain-0.0.1/hierachain/api/v3/schemas.py +86 -0
  41. hierachain-0.0.1/hierachain/api/websocket/__init__.py +65 -0
  42. hierachain-0.0.1/hierachain/api/websocket/builders.py +155 -0
  43. hierachain-0.0.1/hierachain/api/websocket/endpoints.py +226 -0
  44. hierachain-0.0.1/hierachain/api/websocket/handlers.py +153 -0
  45. hierachain-0.0.1/hierachain/api/websocket/manager.py +336 -0
  46. hierachain-0.0.1/hierachain/api/websocket/registry.py +134 -0
  47. hierachain-0.0.1/hierachain/api/websocket/subscriptions.py +117 -0
  48. hierachain-0.0.1/hierachain/cli/__init__.py +63 -0
  49. hierachain-0.0.1/hierachain/cli/chain.py +112 -0
  50. hierachain-0.0.1/hierachain/cli/event.py +164 -0
  51. hierachain-0.0.1/hierachain/cli/node.py +67 -0
  52. hierachain-0.0.1/hierachain/cli/store.py +65 -0
  53. hierachain-0.0.1/hierachain/cli/verify.py +202 -0
  54. hierachain-0.0.1/hierachain/cluster/__init__.py +57 -0
  55. hierachain-0.0.1/hierachain/cluster/cluster_manager.py +386 -0
  56. hierachain-0.0.1/hierachain/cluster/cross_level_sync.py +699 -0
  57. hierachain-0.0.1/hierachain/cluster/lockdown_protocol.py +750 -0
  58. hierachain-0.0.1/hierachain/cluster/state_sync_manager.py +387 -0
  59. hierachain-0.0.1/hierachain/config/__init__.py +54 -0
  60. hierachain-0.0.1/hierachain/config/env_manager.py +297 -0
  61. hierachain-0.0.1/hierachain/config/logging.py +51 -0
  62. hierachain-0.0.1/hierachain/config/settings.py +499 -0
  63. hierachain-0.0.1/hierachain/consensus/__init__.py +57 -0
  64. hierachain-0.0.1/hierachain/consensus/base_consensus.py +270 -0
  65. hierachain-0.0.1/hierachain/consensus/bft/__init__.py +47 -0
  66. hierachain-0.0.1/hierachain/consensus/bft/consensus.py +748 -0
  67. hierachain-0.0.1/hierachain/consensus/bft/cryptographic.py +80 -0
  68. hierachain-0.0.1/hierachain/consensus/bft/network.py +113 -0
  69. hierachain-0.0.1/hierachain/consensus/bft/types.py +76 -0
  70. hierachain-0.0.1/hierachain/consensus/bft/view_manager.py +114 -0
  71. hierachain-0.0.1/hierachain/consensus/bft_consensus.py +71 -0
  72. hierachain-0.0.1/hierachain/consensus/ordering/__init__.py +18 -0
  73. hierachain-0.0.1/hierachain/consensus/ordering/block_builder.py +57 -0
  74. hierachain-0.0.1/hierachain/consensus/ordering/block_manager.py +89 -0
  75. hierachain-0.0.1/hierachain/consensus/ordering/certifier.py +195 -0
  76. hierachain-0.0.1/hierachain/consensus/ordering/maintenance.py +52 -0
  77. hierachain-0.0.1/hierachain/consensus/ordering/metrics.py +47 -0
  78. hierachain-0.0.1/hierachain/consensus/ordering/processor.py +265 -0
  79. hierachain-0.0.1/hierachain/consensus/ordering/recovery.py +93 -0
  80. hierachain-0.0.1/hierachain/consensus/ordering/service.py +307 -0
  81. hierachain-0.0.1/hierachain/consensus/ordering/storage.py +105 -0
  82. hierachain-0.0.1/hierachain/consensus/ordering/types.py +65 -0
  83. hierachain-0.0.1/hierachain/consensus/ordering/utils.py +77 -0
  84. hierachain-0.0.1/hierachain/consensus/proof_of_authority.py +299 -0
  85. hierachain-0.0.1/hierachain/consensus/proof_of_federation.py +339 -0
  86. hierachain-0.0.1/hierachain/core/__init__.py +22 -0
  87. hierachain-0.0.1/hierachain/core/block.py +317 -0
  88. hierachain-0.0.1/hierachain/core/blockchain.py +391 -0
  89. hierachain-0.0.1/hierachain/core/caching.py +756 -0
  90. hierachain-0.0.1/hierachain/core/domain_contract.py +736 -0
  91. hierachain-0.0.1/hierachain/core/parallel_engine.py +665 -0
  92. hierachain-0.0.1/hierachain/core/performance.py +114 -0
  93. hierachain-0.0.1/hierachain/core/schemas.py +91 -0
  94. hierachain-0.0.1/hierachain/core/utils.py +495 -0
  95. hierachain-0.0.1/hierachain/domains/__init__.py +5 -0
  96. hierachain-0.0.1/hierachain/domains/generic/__init__.py +5 -0
  97. hierachain-0.0.1/hierachain/domains/generic/chains/__init__.py +8 -0
  98. hierachain-0.0.1/hierachain/domains/generic/chains/base_chain.py +468 -0
  99. hierachain-0.0.1/hierachain/domains/generic/chains/domain_chain.py +775 -0
  100. hierachain-0.0.1/hierachain/domains/generic/events/__init__.py +8 -0
  101. hierachain-0.0.1/hierachain/domains/generic/events/base_event.py +326 -0
  102. hierachain-0.0.1/hierachain/domains/generic/events/domain_event.py +521 -0
  103. hierachain-0.0.1/hierachain/domains/generic/utils/__init__.py +8 -0
  104. hierachain-0.0.1/hierachain/domains/generic/utils/cross_chain_validator.py +808 -0
  105. hierachain-0.0.1/hierachain/domains/generic/utils/entity_tracer.py +711 -0
  106. hierachain-0.0.1/hierachain/error_mitigation/__init__.py +110 -0
  107. hierachain-0.0.1/hierachain/error_mitigation/data_validator.py +382 -0
  108. hierachain-0.0.1/hierachain/error_mitigation/error_classifier.py +698 -0
  109. hierachain-0.0.1/hierachain/error_mitigation/journal.py +425 -0
  110. hierachain-0.0.1/hierachain/error_mitigation/recovery_engine.py +1048 -0
  111. hierachain-0.0.1/hierachain/error_mitigation/rollback_manager.py +880 -0
  112. hierachain-0.0.1/hierachain/error_mitigation/validator.py +771 -0
  113. hierachain-0.0.1/hierachain/hierarchical/__init__.py +47 -0
  114. hierachain-0.0.1/hierachain/hierarchical/channel.py +648 -0
  115. hierachain-0.0.1/hierachain/hierarchical/hierarchy_manager.py +702 -0
  116. hierachain-0.0.1/hierachain/hierarchical/k8s_namespace_manager.py +577 -0
  117. hierachain-0.0.1/hierachain/hierarchical/main_chain.py +605 -0
  118. hierachain-0.0.1/hierachain/hierarchical/multi_org.py +442 -0
  119. hierachain-0.0.1/hierachain/hierarchical/private_data.py +524 -0
  120. hierachain-0.0.1/hierachain/hierarchical/proof_aggregation.py +442 -0
  121. hierachain-0.0.1/hierachain/hierarchical/rebalancer.py +666 -0
  122. hierachain-0.0.1/hierachain/hierarchical/sub_chain.py +830 -0
  123. hierachain-0.0.1/hierachain/hierarchical/transaction_manager.py +186 -0
  124. hierachain-0.0.1/hierachain/integration/__init__.py +32 -0
  125. hierachain-0.0.1/hierachain/integration/arrow_client.py +148 -0
  126. hierachain-0.0.1/hierachain/integration/enterprise.py +259 -0
  127. hierachain-0.0.1/hierachain/integration/erp_adapters/__init__.py +8 -0
  128. hierachain-0.0.1/hierachain/integration/erp_ledger.py +803 -0
  129. hierachain-0.0.1/hierachain/integration/types.py +51 -0
  130. hierachain-0.0.1/hierachain/monitoring/__init__.py +9 -0
  131. hierachain-0.0.1/hierachain/monitoring/alert_system.py +730 -0
  132. hierachain-0.0.1/hierachain/monitoring/performance_metrics.py +389 -0
  133. hierachain-0.0.1/hierachain/monitoring/performance_monitor.py +878 -0
  134. hierachain-0.0.1/hierachain/network/__init__.py +36 -0
  135. hierachain-0.0.1/hierachain/network/message_cryptographic.py +160 -0
  136. hierachain-0.0.1/hierachain/network/network_client.py +261 -0
  137. hierachain-0.0.1/hierachain/network/peer_trust_manager.py +124 -0
  138. hierachain-0.0.1/hierachain/network/secure_connection.py +546 -0
  139. hierachain-0.0.1/hierachain/network/zmq_transport.py +290 -0
  140. hierachain-0.0.1/hierachain/py.typed +2 -0
  141. hierachain-0.0.1/hierachain/risk_management/__init__.py +77 -0
  142. hierachain-0.0.1/hierachain/risk_management/audit_logger.py +655 -0
  143. hierachain-0.0.1/hierachain/risk_management/mitigation_strategies.py +748 -0
  144. hierachain-0.0.1/hierachain/risk_management/risk_analyzer.py +504 -0
  145. hierachain-0.0.1/hierachain/sdk/__init__.py +33 -0
  146. hierachain-0.0.1/hierachain/sdk/client.py +497 -0
  147. hierachain-0.0.1/hierachain/security/__init__.py +200 -0
  148. hierachain-0.0.1/hierachain/security/brute_force_protector.py +242 -0
  149. hierachain-0.0.1/hierachain/security/certificate.py +595 -0
  150. hierachain-0.0.1/hierachain/security/identity.py +230 -0
  151. hierachain-0.0.1/hierachain/security/integrity.py +235 -0
  152. hierachain-0.0.1/hierachain/security/key_backup_manager.py +597 -0
  153. hierachain-0.0.1/hierachain/security/key_manager.py +350 -0
  154. hierachain-0.0.1/hierachain/security/key_provider.py +239 -0
  155. hierachain-0.0.1/hierachain/security/master_key_provider.py +354 -0
  156. hierachain-0.0.1/hierachain/security/msp.py +557 -0
  157. hierachain-0.0.1/hierachain/security/policy_engine.py +772 -0
  158. hierachain-0.0.1/hierachain/security/resource_guard.py +112 -0
  159. hierachain-0.0.1/hierachain/security/sanitization.py +363 -0
  160. hierachain-0.0.1/hierachain/security/secure_logging.py +278 -0
  161. hierachain-0.0.1/hierachain/security/security_utils.py +163 -0
  162. hierachain-0.0.1/hierachain/security/verify/__init__.py +67 -0
  163. hierachain-0.0.1/hierachain/security/verify/api_key_verifier.py +464 -0
  164. hierachain-0.0.1/hierachain/security/verify/block_verifier.py +483 -0
  165. hierachain-0.0.1/hierachain/security/verify/signature_verifier.py +225 -0
  166. hierachain-0.0.1/hierachain/security/verify/zk_verifier.py +368 -0
  167. hierachain-0.0.1/hierachain/security/zk_prover.py +490 -0
  168. hierachain-0.0.1/hierachain/storage/__init__.py +8 -0
  169. hierachain-0.0.1/hierachain/storage/memory_storage.py +93 -0
  170. hierachain-0.0.1/hierachain/storage/models.py +101 -0
  171. hierachain-0.0.1/hierachain/storage/sql_backend.py +274 -0
  172. hierachain-0.0.1/hierachain/storage/world_state.py +93 -0
  173. hierachain-0.0.1/hierachain/units/__init__.py +19 -0
  174. hierachain-0.0.1/hierachain/units/version.py +237 -0
  175. hierachain-0.0.1/pyproject.toml +228 -0
  176. hierachain-0.0.1/requirements.txt +27 -0
  177. hierachain-0.0.1/requirements_dev.txt +28 -0
  178. hierachain-0.0.1/setup.cfg +4 -0
@@ -0,0 +1,185 @@
1
+ Metadata-Version: 2.4
2
+ Name: HieraChain
3
+ Version: 0.0.1
4
+ Summary: HieraChain - The Hierarchical Blockchain Enterprise Ledger
5
+ Author-email: Nguyễn Lê Văn Dũng <dungnguyen2661@gmail.com>
6
+ License: Apache-2.0 OR MIT
7
+ Project-URL: Homepage, https://github.com/VanDung-dev/HieraChain
8
+ Project-URL: Bug Reports, https://github.com/VanDung-dev/HieraChain/issues
9
+ Project-URL: Source, https://github.com/VanDung-dev/HieraChain
10
+ Project-URL: License-Apache, https://github.com/VanDung-dev/HieraChain/blob/main/LICENSE-APACHE
11
+ Project-URL: License-MIT, https://github.com/VanDung-dev/HieraChain/blob/main/LICENSE-MIT
12
+ Project-URL: Security Policy, https://github.com/VanDung-dev/HieraChain/blob/main/SECURITY.md
13
+ Classifier: Development Status :: 2 - Pre-Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Topic :: Office/Business :: Financial
17
+ Classifier: Topic :: Security :: Cryptography
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE-APACHE
26
+ License-File: LICENSE-MIT
27
+ Requires-Dist: cryptography>=46.0.5
28
+ Requires-Dist: pydantic>=2.12.5
29
+ Requires-Dist: python-dotenv>=1.2.2
30
+ Requires-Dist: fastapi>=0.128.8
31
+ Requires-Dist: uvicorn>=0.38.0
32
+ Requires-Dist: pyyaml>=6.0.3
33
+ Requires-Dist: redis>=7.1.1
34
+ Requires-Dist: sqlalchemy>=2.0.46
35
+ Requires-Dist: alembic>=1.17.2
36
+ Requires-Dist: python-multipart>=0.0.22
37
+ Requires-Dist: passlib>=1.7.4
38
+ Requires-Dist: python-dateutil>=2.9.0.post0
39
+ Requires-Dist: httpx>=0.28.1
40
+ Requires-Dist: click>=8.3.1
41
+ Requires-Dist: psutil>=7.1.3
42
+ Requires-Dist: requests>=2.32.5
43
+ Requires-Dist: pyarrow>=23.0.1
44
+ Requires-Dist: pyzmq>=27.1.0
45
+ Requires-Dist: pynacl>=1.6.2
46
+ Requires-Dist: starlette>=0.50.0
47
+ Requires-Dist: kubernetes>=35.0.0
48
+ Requires-Dist: aiohttp==3.13.3
49
+ Requires-Dist: graphene>=3.4.3
50
+ Provides-Extra: ipfs
51
+ Requires-Dist: ipfshttpclient>=0.7.0; extra == "ipfs"
52
+ Provides-Extra: dev
53
+ Requires-Dist: tox>=4.34.1; extra == "dev"
54
+ Requires-Dist: virtualenv-pyenv>=0.6.0; extra == "dev"
55
+ Requires-Dist: black>=26.3.1; extra == "dev"
56
+ Requires-Dist: flake8>=7.3.0; extra == "dev"
57
+ Requires-Dist: mypy>=1.19.1; extra == "dev"
58
+ Requires-Dist: setuptools>=82.0.0; extra == "dev"
59
+ Requires-Dist: wheel>=0.46.3; extra == "dev"
60
+ Requires-Dist: coverage>=7.13.4; extra == "dev"
61
+ Requires-Dist: build>=1.3.0; extra == "dev"
62
+ Requires-Dist: twine>=6.2.0; extra == "dev"
63
+ Requires-Dist: bandit>=1.9.2; extra == "dev"
64
+ Requires-Dist: hypothesis>=6.151.6; extra == "dev"
65
+ Requires-Dist: pytest>=9.0.2; extra == "dev"
66
+ Requires-Dist: pytest-asyncio>=1.3.0; extra == "dev"
67
+ Requires-Dist: pytest-benchmark>=5.2.3; extra == "dev"
68
+ Requires-Dist: pytest-html>=4.2.0; extra == "dev"
69
+ Requires-Dist: pytest-rerunfailures>=16.1; extra == "dev"
70
+ Requires-Dist: pip-audit>=2.10.0; extra == "dev"
71
+ Requires-Dist: pygal>=3.1.0; extra == "dev"
72
+ Requires-Dist: mkdocs>=1.6.1; extra == "dev"
73
+ Requires-Dist: zensical==0.0.23; extra == "dev"
74
+ Requires-Dist: mkdocs-git-revision-date-localized-plugin>=1.5.1; extra == "dev"
75
+ Requires-Dist: polib>=1.2.0; extra == "dev"
76
+ Dynamic: license-file
77
+
78
+ # HieraChain - The Hierarchical Blockchain Enterprise Ledger
79
+
80
+ ![Python Versions](https://img.shields.io/badge/python-3.10%20|%203.11%20|%203.12%20|%203.13-blue)
81
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE-APACHE)
82
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT)
83
+ ![Version](https://img.shields.io/badge/version-0.0.1-green)
84
+
85
+ **English** | [Tiếng Việt](README_vi.md)
86
+
87
+ ## Overview
88
+
89
+ HieraChain is an enterprise ledger built on hierarchical blockchain technology, designed specifically for business applications without any cryptocurrency concepts. Rather than being a general-purpose blockchain platform focused on digital currencies, HieraChain provides a secure, hierarchical ledger structure for managing business operations and processes.
90
+
91
+ This ledger implements a multi-layer hierarchical architecture where Main Chains supervise Sub-Chains, enabling scalable and secure business process management. All operations within the system are referred to as "events" rather than "transactions," emphasizing its focus on business applications.
92
+
93
+ ## Project Ecosystem
94
+
95
+ HieraChain is part of a larger ecosystem of blockchain tools:
96
+
97
+ | Project | Language | Description |
98
+ |---------|----------|-------------|
99
+ | **[HieraChain](https://github.com/VanDung-dev/HieraChain)** | Python | Main hierarchical blockchain ledger (this repository) |
100
+ | [HieraChain-Consensus](https://github.com/VanDung-dev/HieraChain-Consensus) | Rust | **Official Core Consensus** - optimized implementation with Python/C bindings |
101
+
102
+ > **Note**: While this repository includes a pure Python consensus implementation, the [HieraChain-Consensus](https://github.com/VanDung-dev/HieraChain-Consensus) library is recommended for production deployments requiring high performance.
103
+
104
+ ## Key Features
105
+
106
+ - **Hierarchical Structure**: Multi-layer architecture with Main Chains (supervisors) and Sub-Chains (domain experts).
107
+ - **Consensus Mechanisms**: Supports Proof of Authority (PoA), Proof of Federation (PoF), and Byzantine Fault Tolerant (BFT) consensus.
108
+ - **Enterprise Security**: Ed25519 signatures, AES-256-GCM encryption, Membership Service Provider (MSP), and robust API Key authentication.
109
+ - **High Performance**: Columnar storage with Apache Arrow, hybrid caching, and parallel event processing.
110
+ - **Reliability & Recovery**: Durable transaction journaling, automated failure recovery, and state rollback capabilities.
111
+
112
+ ## Documentation
113
+
114
+ Comprehensive documentation is available at our official website **[docs.hierachain.org](https://docs.hierachain.org/)**:
115
+
116
+ - [Getting Started](https://docs.hierachain.org/getting-started/install/) - Installation and basic setup
117
+ - [Architecture](https://docs.hierachain.org/architecture/overview/) - System design and hierarchical model
118
+ - [Core Modules](https://docs.hierachain.org/modules/core/) - Detailed breakdown of system components
119
+ - [Guides & How-To](https://docs.hierachain.org/how-to/integrate-web2/) - Step-by-step implementation guides
120
+ - [API Reference](https://docs.hierachain.org/reference/code-map/) - REST API and configuration details
121
+
122
+ ## Quick Start
123
+
124
+ ### Installation
125
+
126
+ **Via PIP (recommended)**
127
+
128
+ ```bash
129
+ pip install HieraChain
130
+ ```
131
+
132
+ **From source (for development)**
133
+
134
+ ```bash
135
+ git clone https://github.com/VanDung-dev/HieraChain.git
136
+ cd HieraChain
137
+ python -m venv venv
138
+ source venv/bin/activate # Linux/macOS (or venv\Scripts\activate on Windows)
139
+
140
+ # Install dependencies and project in dev mode
141
+ pip install -r requirements.txt
142
+ pip install -e .
143
+ ```
144
+
145
+ ### Basic Usage
146
+
147
+ ```python
148
+ from hierachain.hierarchical import HierarchyManager
149
+
150
+ manager = HierarchyManager()
151
+ manager.create_sub_chain("supply_chain")
152
+
153
+ # Add an event
154
+ manager.add_event("supply_chain", {
155
+ "entity_id": "PROD-001",
156
+ "event": "production_complete",
157
+ "timestamp": 1703088000.0,
158
+ "details": {"quantity": 100}
159
+ })
160
+
161
+ # Submit proof to main chain
162
+ manager.submit_proof("supply_chain")
163
+ ```
164
+
165
+ API Server:
166
+
167
+ ```bash
168
+ python -m hierachain
169
+ ```
170
+
171
+ API available at `http://localhost:2661/docs`
172
+
173
+ ## Technical Specifications
174
+
175
+ | Metric | Value |
176
+ |--------|-------|
177
+ | Test Cases | >600 |
178
+ | Python Support | 3.10, 3.11, 3.12, 3.13 |
179
+ | Consensus Types | PoA, PoF, BFT |
180
+ | Signature Algorithm | Ed25519 |
181
+ | Encryption | AES-256-GCM |
182
+
183
+ ## License
184
+
185
+ This project is dual licensed under either the [Apache-2.0 License](LICENSE-APACHE) or the [MIT License](LICENSE-MIT). You may choose either license.
@@ -0,0 +1,176 @@
1
+ LICENSE-APACHE
2
+ LICENSE-MIT
3
+ MANIFEST.in
4
+ README.md
5
+ SECURITY.md
6
+ pyproject.toml
7
+ requirements.txt
8
+ requirements_dev.txt
9
+ HieraChain.egg-info/PKG-INFO
10
+ HieraChain.egg-info/SOURCES.txt
11
+ HieraChain.egg-info/dependency_links.txt
12
+ HieraChain.egg-info/entry_points.txt
13
+ HieraChain.egg-info/requires.txt
14
+ HieraChain.egg-info/top_level.txt
15
+ hierachain/__init__.py
16
+ hierachain/__main__.py
17
+ hierachain/py.typed
18
+ hierachain/adapters/__init__.py
19
+ hierachain/adapters/database/__init__.py
20
+ hierachain/adapters/database/sqlite_adapter.py
21
+ hierachain/adapters/storage/__init__.py
22
+ hierachain/adapters/storage/file_storage.py
23
+ hierachain/adapters/storage/redis_storage.py
24
+ hierachain/api/__init__.py
25
+ hierachain/api/blockchain_explorer.py
26
+ hierachain/api/server.py
27
+ hierachain/api/graphql/__init__.py
28
+ hierachain/api/graphql/schema.py
29
+ hierachain/api/storage/__init__.py
30
+ hierachain/api/storage/encryption.py
31
+ hierachain/api/storage/endpoint_helpers.py
32
+ hierachain/api/storage/explorer_helpers.py
33
+ hierachain/api/storage/ipfs_client.py
34
+ hierachain/api/storage/utils.py
35
+ hierachain/api/v1/__init__.py
36
+ hierachain/api/v1/endpoints.py
37
+ hierachain/api/v1/schemas.py
38
+ hierachain/api/v2/__init__.py
39
+ hierachain/api/v2/endpoints.py
40
+ hierachain/api/v2/schemas.py
41
+ hierachain/api/v3/__init__.py
42
+ hierachain/api/v3/endpoints.py
43
+ hierachain/api/v3/schemas.py
44
+ hierachain/api/websocket/__init__.py
45
+ hierachain/api/websocket/builders.py
46
+ hierachain/api/websocket/endpoints.py
47
+ hierachain/api/websocket/handlers.py
48
+ hierachain/api/websocket/manager.py
49
+ hierachain/api/websocket/registry.py
50
+ hierachain/api/websocket/subscriptions.py
51
+ hierachain/cli/__init__.py
52
+ hierachain/cli/chain.py
53
+ hierachain/cli/event.py
54
+ hierachain/cli/node.py
55
+ hierachain/cli/store.py
56
+ hierachain/cli/verify.py
57
+ hierachain/cluster/__init__.py
58
+ hierachain/cluster/cluster_manager.py
59
+ hierachain/cluster/cross_level_sync.py
60
+ hierachain/cluster/lockdown_protocol.py
61
+ hierachain/cluster/state_sync_manager.py
62
+ hierachain/config/__init__.py
63
+ hierachain/config/env_manager.py
64
+ hierachain/config/logging.py
65
+ hierachain/config/settings.py
66
+ hierachain/consensus/__init__.py
67
+ hierachain/consensus/base_consensus.py
68
+ hierachain/consensus/bft_consensus.py
69
+ hierachain/consensus/proof_of_authority.py
70
+ hierachain/consensus/proof_of_federation.py
71
+ hierachain/consensus/bft/__init__.py
72
+ hierachain/consensus/bft/consensus.py
73
+ hierachain/consensus/bft/cryptographic.py
74
+ hierachain/consensus/bft/network.py
75
+ hierachain/consensus/bft/types.py
76
+ hierachain/consensus/bft/view_manager.py
77
+ hierachain/consensus/ordering/__init__.py
78
+ hierachain/consensus/ordering/block_builder.py
79
+ hierachain/consensus/ordering/block_manager.py
80
+ hierachain/consensus/ordering/certifier.py
81
+ hierachain/consensus/ordering/maintenance.py
82
+ hierachain/consensus/ordering/metrics.py
83
+ hierachain/consensus/ordering/processor.py
84
+ hierachain/consensus/ordering/recovery.py
85
+ hierachain/consensus/ordering/service.py
86
+ hierachain/consensus/ordering/storage.py
87
+ hierachain/consensus/ordering/types.py
88
+ hierachain/consensus/ordering/utils.py
89
+ hierachain/core/__init__.py
90
+ hierachain/core/block.py
91
+ hierachain/core/blockchain.py
92
+ hierachain/core/caching.py
93
+ hierachain/core/domain_contract.py
94
+ hierachain/core/parallel_engine.py
95
+ hierachain/core/performance.py
96
+ hierachain/core/schemas.py
97
+ hierachain/core/utils.py
98
+ hierachain/domains/__init__.py
99
+ hierachain/domains/generic/__init__.py
100
+ hierachain/domains/generic/chains/__init__.py
101
+ hierachain/domains/generic/chains/base_chain.py
102
+ hierachain/domains/generic/chains/domain_chain.py
103
+ hierachain/domains/generic/events/__init__.py
104
+ hierachain/domains/generic/events/base_event.py
105
+ hierachain/domains/generic/events/domain_event.py
106
+ hierachain/domains/generic/utils/__init__.py
107
+ hierachain/domains/generic/utils/cross_chain_validator.py
108
+ hierachain/domains/generic/utils/entity_tracer.py
109
+ hierachain/error_mitigation/__init__.py
110
+ hierachain/error_mitigation/data_validator.py
111
+ hierachain/error_mitigation/error_classifier.py
112
+ hierachain/error_mitigation/journal.py
113
+ hierachain/error_mitigation/recovery_engine.py
114
+ hierachain/error_mitigation/rollback_manager.py
115
+ hierachain/error_mitigation/validator.py
116
+ hierachain/hierarchical/__init__.py
117
+ hierachain/hierarchical/channel.py
118
+ hierachain/hierarchical/hierarchy_manager.py
119
+ hierachain/hierarchical/k8s_namespace_manager.py
120
+ hierachain/hierarchical/main_chain.py
121
+ hierachain/hierarchical/multi_org.py
122
+ hierachain/hierarchical/private_data.py
123
+ hierachain/hierarchical/proof_aggregation.py
124
+ hierachain/hierarchical/rebalancer.py
125
+ hierachain/hierarchical/sub_chain.py
126
+ hierachain/hierarchical/transaction_manager.py
127
+ hierachain/integration/__init__.py
128
+ hierachain/integration/arrow_client.py
129
+ hierachain/integration/enterprise.py
130
+ hierachain/integration/erp_ledger.py
131
+ hierachain/integration/types.py
132
+ hierachain/integration/erp_adapters/__init__.py
133
+ hierachain/monitoring/__init__.py
134
+ hierachain/monitoring/alert_system.py
135
+ hierachain/monitoring/performance_metrics.py
136
+ hierachain/monitoring/performance_monitor.py
137
+ hierachain/network/__init__.py
138
+ hierachain/network/message_cryptographic.py
139
+ hierachain/network/network_client.py
140
+ hierachain/network/peer_trust_manager.py
141
+ hierachain/network/secure_connection.py
142
+ hierachain/network/zmq_transport.py
143
+ hierachain/risk_management/__init__.py
144
+ hierachain/risk_management/audit_logger.py
145
+ hierachain/risk_management/mitigation_strategies.py
146
+ hierachain/risk_management/risk_analyzer.py
147
+ hierachain/sdk/__init__.py
148
+ hierachain/sdk/client.py
149
+ hierachain/security/__init__.py
150
+ hierachain/security/brute_force_protector.py
151
+ hierachain/security/certificate.py
152
+ hierachain/security/identity.py
153
+ hierachain/security/integrity.py
154
+ hierachain/security/key_backup_manager.py
155
+ hierachain/security/key_manager.py
156
+ hierachain/security/key_provider.py
157
+ hierachain/security/master_key_provider.py
158
+ hierachain/security/msp.py
159
+ hierachain/security/policy_engine.py
160
+ hierachain/security/resource_guard.py
161
+ hierachain/security/sanitization.py
162
+ hierachain/security/secure_logging.py
163
+ hierachain/security/security_utils.py
164
+ hierachain/security/zk_prover.py
165
+ hierachain/security/verify/__init__.py
166
+ hierachain/security/verify/api_key_verifier.py
167
+ hierachain/security/verify/block_verifier.py
168
+ hierachain/security/verify/signature_verifier.py
169
+ hierachain/security/verify/zk_verifier.py
170
+ hierachain/storage/__init__.py
171
+ hierachain/storage/memory_storage.py
172
+ hierachain/storage/models.py
173
+ hierachain/storage/sql_backend.py
174
+ hierachain/storage/world_state.py
175
+ hierachain/units/__init__.py
176
+ hierachain/units/version.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hrc = hierachain.cli.__init__:hrc
@@ -0,0 +1,51 @@
1
+ cryptography>=46.0.5
2
+ pydantic>=2.12.5
3
+ python-dotenv>=1.2.2
4
+ fastapi>=0.128.8
5
+ uvicorn>=0.38.0
6
+ pyyaml>=6.0.3
7
+ redis>=7.1.1
8
+ sqlalchemy>=2.0.46
9
+ alembic>=1.17.2
10
+ python-multipart>=0.0.22
11
+ passlib>=1.7.4
12
+ python-dateutil>=2.9.0.post0
13
+ httpx>=0.28.1
14
+ click>=8.3.1
15
+ psutil>=7.1.3
16
+ requests>=2.32.5
17
+ pyarrow>=23.0.1
18
+ pyzmq>=27.1.0
19
+ pynacl>=1.6.2
20
+ starlette>=0.50.0
21
+ kubernetes>=35.0.0
22
+ aiohttp==3.13.3
23
+ graphene>=3.4.3
24
+
25
+ [dev]
26
+ tox>=4.34.1
27
+ virtualenv-pyenv>=0.6.0
28
+ black>=26.3.1
29
+ flake8>=7.3.0
30
+ mypy>=1.19.1
31
+ setuptools>=82.0.0
32
+ wheel>=0.46.3
33
+ coverage>=7.13.4
34
+ build>=1.3.0
35
+ twine>=6.2.0
36
+ bandit>=1.9.2
37
+ hypothesis>=6.151.6
38
+ pytest>=9.0.2
39
+ pytest-asyncio>=1.3.0
40
+ pytest-benchmark>=5.2.3
41
+ pytest-html>=4.2.0
42
+ pytest-rerunfailures>=16.1
43
+ pip-audit>=2.10.0
44
+ pygal>=3.1.0
45
+ mkdocs>=1.6.1
46
+ zensical==0.0.23
47
+ mkdocs-git-revision-date-localized-plugin>=1.5.1
48
+ polib>=1.2.0
49
+
50
+ [ipfs]
51
+ ipfshttpclient>=0.7.0
@@ -0,0 +1 @@
1
+ hierachain
@@ -0,0 +1,178 @@
1
+ Copyright (c) 2025 Nguyễn Lê Văn Dũng
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2025 Nguyễn Lê Văn Dũng
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ include README.md
2
+ include LICENSE-APACHE
3
+ include LICENSE-MIT
4
+ include SECURITY.md
5
+ include requirements.txt
6
+ include requirements_dev.txt
7
+
8
+ recursive-include hierachain *.py
9
+ recursive-exclude tests *
10
+ recursive-exclude testing *
11
+ recursive-exclude demo *
12
+ recursive-exclude docs *
13
+ recursive-exclude .github *