This guide provides comprehensive installation instructions for ChainFinity across different platforms and deployment scenarios.
Before installing ChainFinity, ensure your system meets these requirements:
| Component | Minimum Version | Recommended Version | Notes |
|---|---|---|---|
| Node.js | 16.x | 18.x or higher | Required for blockchain and frontend components |
| Python | 3.9 | 3.11 or higher | Required for backend and AI models |
| PostgreSQL | 13 | 15 or higher | Primary database |
| Redis | 6.x | 7 or higher | Caching and session storage |
| Docker | 20.x | Latest | For containerized deployment |
| Docker Compose | 2.x | Latest | Multi-container orchestration |
| Git | 2.x | Latest | Version control |
| Environment | CPU | RAM | Storage | Network |
|---|---|---|---|---|
| Development | 4 cores | 8 GB | 50 GB SSD | Broadband |
| Staging | 8 cores | 16 GB | 100 GB SSD | High-speed |
| Production | 16+ cores | 32+ GB | 500 GB SSD | Enterprise |
The fastest way to get ChainFinity running locally.
# Clone the repository
git clone https://github.com/abrar2030/ChainFinity.git
cd ChainFinity
# Run automated setup
./scripts/env_setup.sh
# Start all services
./scripts/run_chainfinity.shThe setup script will:
- Install all dependencies (Node.js, Python packages)
- Set up databases (PostgreSQL, Redis)
- Configure environment variables
- Initialize the blockchain network
- Start all services
For developers who want full control over the installation process.
git clone https://github.com/abrar2030/ChainFinity.git
cd ChainFinitycd code/blockchain
npm installBlockchain Dependencies:
- Hardhat 3.0+ — Ethereum development environment
- OpenZeppelin Contracts 5.4+ — Secure smart contract library
- Chainlink CCIP — Cross-chain interoperability
cd ../backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtBackend Dependencies:
- FastAPI 0.104.1 — High-performance web framework
- SQLAlchemy 2.0.23 — Database ORM
- Web3.py 6.11.1 — Blockchain interaction
- TensorFlow 2.x (optional) — AI models
# Web Frontend
cd ../web-frontend
npm install
# Mobile Frontend (optional)
cd ../mobile-frontend
pnpm install# Start PostgreSQL and Redis with Docker
docker-compose -f code/backend/docker-compose.yml up -d postgres redis
# Run database migrations
cd code/backend
alembic upgrade head# Backend configuration
cd code/backend
cp .env.example .env
nano .env # Edit with your settings
# Blockchain configuration
cd ../blockchain
cp .env.example .env
nano .env # Add your RPC URLs and API keys
# Frontend configuration
cd ../web-frontend
cp .env.example .env
nano .env # Configure API endpointsCritical Environment Variables:
DATABASE_URL— PostgreSQL connection stringREDIS_URL— Redis connection stringSECRET_KEY— JWT signing key (generate withopenssl rand -hex 32)ETH_RPC_URL— Ethereum node RPC endpointETHERSCAN_API_KEY— Block explorer API key
# Terminal 1: Start blockchain node
cd code/blockchain
npx hardhat node
# Terminal 2: Start backend API
cd code/backend
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
# Terminal 3: Start frontend
cd code/web-frontend
npm startFor production-like environments with containerization.
# Clone repository
git clone https://github.com/abrar2030/ChainFinity.git
cd ChainFinity
# Configure environment
cp code/backend/.env.example code/backend/.env
# Edit .env with production settings
# Build and start all services
docker-compose -f code/backend/docker-compose.yml up -d
# View logs
docker-compose -f code/backend/docker-compose.yml logs -f
# Check service health
docker-compose -f code/backend/docker-compose.yml psDocker Services:
api— FastAPI backend (port 8000)postgres— PostgreSQL database (port 5432)redis— Redis cache (port 6379)nginx— Reverse proxy (port 80/443)
For production-scale deployments with orchestration.
# Install kubectl and helm (if not already installed)
# See https://kubernetes.io/docs/tasks/tools/
# Navigate to infrastructure
cd infrastructure/kubernetes
# Create namespace
kubectl create namespace chainfinity
# Deploy PostgreSQL
kubectl apply -f postgres/
# Deploy Redis
kubectl apply -f redis/
# Deploy backend API
kubectl apply -f deployment.yaml
# Verify deployment
kubectl get pods -n chainfinity
kubectl get services -n chainfinity# Update package lists
sudo apt update
# Install Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
# Install Python
sudo apt install -y python3.11 python3.11-venv python3-pip
# Install PostgreSQL
sudo apt install -y postgresql postgresql-contrib
# Install Redis
sudo apt install -y redis-server
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Proceed with installation steps above# Install Homebrew (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
brew install node python@3.11 postgresql@15 redis docker
# Start services
brew services start postgresql@15
brew services start redis
# Proceed with installation steps above# Install with Chocolatey (recommended)
# First install Chocolatey: https://chocolatey.org/install
choco install nodejs python postgresql redis docker-desktop -y
# Or use Windows Subsystem for Linux (WSL2) and follow Ubuntu instructions# Check backend health
curl http://localhost:8000/health
# Check API documentation
open http://localhost:8000/docs
# Check frontend
open http://localhost:3000
# Check database connection
psql -h localhost -U postgres -d chainfinity -c "SELECT version();"
# Check Redis
redis-cli pingcd code/blockchain
# Compile contracts
npx hardhat compile
# Deploy to local network
npx hardhat run scripts/deploy.js --network localhost
# Deploy to testnet (e.g., Sepolia)
npx hardhat run scripts/deploy.js --network sepoliacd code/ai_models
# Install ML dependencies
pip install tensorflow scikit-learn pandas numpy
# Train correlation model
python train_correlation_model.py
# Preprocess historical data
python data_preprocessing.py| Issue | Solution |
|---|---|
| Port already in use | Change port in .env or kill process: lsof -ti:8000 | xargs kill -9 |
| Database connection failed | Verify PostgreSQL is running: pg_isready -h localhost |
| Redis connection failed | Check Redis status: redis-cli ping |
| npm install fails | Clear cache: npm cache clean --force && rm -rf node_modules && npm install |
| Python package conflicts | Use fresh venv: deactivate && rm -rf venv && python -m venv venv |
| Docker permission denied | Add user to docker group: sudo usermod -aG docker $USER (then log out/in) |
After successful installation:
- Configure your setup — Review Configuration Guide
- Explore the API — Check API Reference
- Run examples — Try example workflows
- Deploy contracts — See blockchain deployment guide
- Set up monitoring — Configure monitoring with
./scripts/monitor_chainfinity.sh
To completely remove ChainFinity:
# Stop all services
docker-compose -f code/backend/docker-compose.yml down -v
# Remove installation
cd ..
rm -rf ChainFinity
# Remove databases (optional)
dropdb chainfinity
# Remove Redis data if needed