6. Installation
This guide provides detailed instructions for installing and configuring wFabricSecurity.
7. Requirements
7.1. Python
wFabricSecurity requires Python 3.10 or higher.
# Check your Python version
python --version
# If you need to install Python 3.10+
# Visit: https://www.python.org/downloads/
7.2. Operating System
wFabricSecurity is tested and supported on:
OS |
Status |
|---|---|
Ubuntu 20.04+ |
✅ Fully supported |
Debian 11+ |
✅ Fully supported |
macOS 11+ |
✅ Fully supported |
Windows 10+ |
✅ Fully supported |
Windows Subsystem for Linux |
✅ Fully supported |
7.3. Optional Dependencies
For full functionality, you may also need:
Dependency |
Required For |
|---|---|
Hyperledger Fabric Gateway SDK |
Fabric network integration |
OpenSSL |
Certificate operations |
Git |
Installing from source |
8. Installation via pip
The easiest way to install wFabricSecurity is using pip:
# Standard installation
pip install wFabricSecurity
# With minimal dependencies
pip install wFabricSecurity --no-deps
# Specific version
pip install wFabricSecurity==1.0.0
# Upgrade to latest version
pip install --upgrade wFabricSecurity
8.1. Virtual Environment (Recommended)
It’s recommended to install wFabricSecurity in a virtual environment:
# Create a virtual environment
python -m venv wfabric-env
# Activate it (Linux/macOS)
source wfabric-env/bin/activate
# Activate it (Windows)
wfabric-env\Scripts\activate
# Install wFabricSecurity
pip install wFabricSecurity
9. Installation from Source
To install from source for development or testing:
9.1. Clone the Repository
git clone https://github.com/wisrovi/wFabricSecurity.git
cd wFabricSecurity
9.2. Editable Install
For development, install in editable mode:
pip install -e .
9.3. Development Install
Install with all development dependencies:
pip install -e ".[dev]"
This includes:
Package |
Purpose |
|---|---|
pytest |
Testing framework |
pytest-cov |
Code coverage |
pytest-asyncio |
Async testing |
black |
Code formatting |
ruff |
Linting |
sphinx |
Documentation |
10. Docker Installation
You can also run wFabricSecurity in a Docker container:
FROM python:3.11-slim
WORKDIR /app
# Install wFabricSecurity
RUN pip install wFabricSecurity
# Copy your application
COPY . /app
# Run your application
CMD ["python", "your_app.py"]
Build and run:
# Build the image
docker build -t my-wfabric-app .
# Run the container
docker run -v /path/to/msp:/app/msp my-wfabric-app
11. Verification
After installation, verify everything is working:
# Verify Python import
python -c "from wFabricSecurity import FabricSecurity; print('✓ Import successful')"
# Run version check
python -c "import wFabricSecurity; print(f'Version: {wFabricSecurity.__version__}')"
# Run built-in tests
pytest --co -q
12. Configuration
12.1. MSP Configuration
The Membership Service Provider (MSP) contains your cryptographic credentials:
msp/
├── cacerts/ # CA certificates
├── signcerts/ # Signing certificates
├── keystore/ # Private keys
├── admincerts/ # Admin certificates
└── tlscacerts/ # TLS CA certificates
Typical MSP path:
# Production
msp_path = "/etc/hyperledger/msp"
# Development
msp_path = "./test/msp"
# Docker
msp_path = "/fabric/msp"
12.2. Gateway Configuration
For Fabric integration, you’ll need a gateway connection profile:
# connection-profile.yaml
name: "my-network"
version: "1.0"
client:
organization: "Org1"
connection:
timeout:
peer:
endorser: 300
orderer:
deliver: 300
channels:
mychannel:
peers:
peer0.org1.example.com: {}
13. Troubleshooting
13.1. Import Errors
If you encounter import errors:
# Upgrade pip
pip install --upgrade pip
# Reinstall wFabricSecurity
pip uninstall wFabricSecurity
pip install wFabricSecurity
# Check installed packages
pip list | grep -i fabric
13.2. Cryptography Errors
If cryptography-related errors occur:
# Upgrade cryptography
pip install --upgrade cryptography
# Install build tools (Linux)
sudo apt-get install build-essential python3-dev libssl-dev
# Reinstall
pip uninstall cryptography wFabricSecurity
pip install wFabricSecurity
13.3. Permission Errors
On Linux/macOS, you may need:
# Fix pip permissions
pip install --user wFabricSecurity
# Or use a virtual environment
python -m venv env
source env/bin/activate
pip install wFabricSecurity
14. Uninstallation
To remove wFabricSecurity:
# Uninstall via pip
pip uninstall wFabricSecurity
# Remove virtual environment (if created)
rm -rf wfabric-env
See also
Getting Started - Quick start guide
Tutorials - Step-by-step tutorials
API Reference - API documentation