Installing HieraChain
This document guides you through various ways to install and set up HieraChain.
Installation via PIP (Recommended)
This is the fastest and simplest way to start using HieraChain as a library or running the server.
# Note: The project is currently in development phase, source installation is recommended.
pip install .
After installation, you can verify with:
Using uv (Recommended for High Performance)
uv is a modern Python package manager written in Rust, 10-100x faster than pip.
Installing uv:
Setting up project with uv:
# Create virtual environment and sync base dependencies
uv sync
# Install with specific tool groups (extras):
uv sync --extra dev --extra doc
# Or install ALL extras available in the project:
uv sync --all-extras
# If you only want production environment (skip dev dependencies):
uv sync --no-dev
# Activate virtual environment
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\Activate.ps1 # Windows
Installation from Source (For Developers)
If you want to contribute to the project or customize the source code, follow these steps:
-
Clone repository and create virtual environment
Create & activate venv
-
Install dependencies and set up development mode
-
Verify installation
If the server starts successfully, you can open the interactive documentation at: http://localhost:2661/docs.
Running Tests
Warning
Do not run all tests simultaneously to avoid resource conflicts. Recommended to run per file or per unit/integration directory.
# Run unit tests
python -m pytest tests/unit -v
# Run integration tests
python -m pytest tests/integration -v
# Run scenarios tests
python -m pytest tests/scenarios -v
Running the Server
To start the HieraChain API server:
Library Usage
After installation, you can import components from the package in your Python code:
Running Demos
Demo files are in the demo/ directory. Before running, ensure you have installed the package and dependencies.
-
Main Demo - Illustrates core features: hierarchical chains, MSP, channels, private data:
-
Key Backup & Recovery Demo - Illustrates key backup/recovery functionality:
-
ZeroMQ BFT Consensus Demo - Illustrates Byzantine Fault Tolerance consensus over ZeroMQ:
Note
To clean up old data before re-running demos:
Documentation
The project uses Zensical to build documentation.
Requirements
Ensure Zensical is installed (docs dependencies):
Running Documentation Server (Local)
To view documentation with live-reload:
Access http://127.0.0.1:8000.
Building Static Site
To build static HTML (to site/ directory):
Uninstall / Clean Environment
Troubleshooting
hrccommand not found: check that venv is activated andpip install -e .succeeded.- Dependency compilation errors: ensure appropriate build tools exist (e.g., on Windows install Build Tools for Visual Studio if needed).
- API port 2661 busy: adjust configuration in
hierachain/config/settings.pyor terminate the process occupying the port.