Complete installation guide for BlockScore across different platforms and deployment scenarios.
- System Requirements
- Installation Methods
- Platform-Specific Instructions
- Post-Installation Steps
- Verification
- CPU: 2 cores
- RAM: 4 GB
- Storage: 10 GB free space
- OS: Ubuntu 20.04+, macOS 11+, Windows 10+ (with WSL2)
- CPU: 4+ cores
- RAM: 8 GB+
- Storage: 20 GB+ SSD
- Network: Stable internet for blockchain connectivity
| Software | Min Version | Purpose | Installation Check |
|---|---|---|---|
| Python | 3.8+ | Backend & AI models | python3 --version |
| Node.js | 16+ | Backend & Frontend | node --version |
| npm | 8+ | Package management | npm --version |
| MongoDB | 4.4+ | Database (optional) | mongod --version |
| Git | 2.25+ | Version control | git --version |
| Redis | 6.0+ | Caching (optional) | redis-cli --version |
The fastest way to get started. Suitable for development and testing.
# Clone repository
git clone https://github.com/quantsingularity/BlockScore.git
cd BlockScore
# Make setup script executable
chmod +x scripts/setup_blockscore_env.sh
# Run setup
./scripts/setup_blockscore_env.shWhat the script does:
- Creates Python virtual environments
- Installs Python dependencies (backend & AI)
- Installs Node.js dependencies (backend & frontend)
- Sets up project structure
Time required: 5-10 minutes (depending on internet speed)
For advanced users who want full control over the installation process.
git clone https://github.com/quantsingularity/BlockScore.git
cd BlockScorecd code/backend
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy environment template
cp .env.example .env
# Edit .env with your configuration
nano .envcd ../ai_models/training_scripts
# Create virtual environment
python3 -m venv venv_ai
source venv_ai/bin/activate
# Install dependencies
pip install -r requirements.txt
# Return to project root
cd ../../..cd web-frontend
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Edit .env if needed
nano .envcd ../code/blockchain
# Install dependencies (includes Hardhat)
npm install
# Compile contracts (fully offline, via the local solc npm package)
npm run compileDocker-based installation for containerized deployment.
# Build and run with Docker Compose
docker-compose up -d
# Verify services
docker-compose ps| Component | Installation Command | Notes |
|---|---|---|
| Python 3.8+ | sudo apt update && sudo apt install python3 python3-pip python3-venv |
Already installed on Ubuntu 20.04+ |
| Node.js 16+ | curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && sudo apt install -y nodejs |
Installs Node.js 18 LTS |
| MongoDB | sudo apt install mongodb or MongoDB Docs |
Optional for development |
| Redis | sudo apt install redis-server |
Optional but recommended |
| Build tools | sudo apt install build-essential |
Required for native modules |
Complete Ubuntu Setup:
# Update system
sudo apt update && sudo apt upgrade -y
# Install dependencies
sudo apt install -y python3 python3-pip python3-venv nodejs npm mongodb redis-server build-essential git
# Start services
sudo systemctl start mongodb
sudo systemctl start redis-server
# Verify installations
python3 --version && node --version && mongod --version| Component | Installation Command | Notes |
|---|---|---|
| Homebrew | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
Package manager |
| Python 3.8+ | brew install python@3.11 |
Latest Python 3 |
| Node.js 16+ | brew install node@18 |
Node.js 18 LTS |
| MongoDB | brew tap mongodb/brew && brew install mongodb-community |
Optional |
| Redis | brew install redis |
Optional |
Complete macOS Setup:
# Install Homebrew (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
brew install python@3.11 node@18 mongodb-community redis git
# Start services
brew services start mongodb-community
brew services start redis
# Verify installations
python3 --version && node --version && mongod --versionOption A: WSL2 (Recommended)
- Enable WSL2:
# Run in PowerShell as Administrator
wsl --install
wsl --set-default-version 2- Install Ubuntu from Microsoft Store
- Follow Ubuntu instructions above inside WSL2
Option B: Native Windows
| Component | Installation Method | Notes |
|---|---|---|
| Python 3.8+ | Download from python.org | Check "Add to PATH" |
| Node.js 16+ | Download from nodejs.org | LTS version recommended |
| MongoDB | Download from mongodb.com | Windows installer |
| Git | Download from git-scm.com | Git Bash included |
Edit code/backend/.env:
# Database Configuration
DATABASE_URL=sqlite:///blockscore.db
# For PostgreSQL: postgresql://user:password@localhost:5432/blockscore
# Security Keys (CHANGE THESE!)
SECRET_KEY=generate-a-random-secret-key-here
JWT_SECRET_KEY=generate-another-random-key-here
# JWT Token Expiration (seconds)
JWT_ACCESS_TOKEN_EXPIRES=900 # 15 minutes
JWT_REFRESH_TOKEN_EXPIRES=604800 # 7 days
# Redis (optional)
REDIS_URL=redis://localhost:6379/0
# Blockchain Configuration
BLOCKCHAIN_PROVIDER_URL=http://localhost:8545
CONTRACT_ADDRESS=0x0000000000000000000000000000000000000000
PRIVATE_KEY=your-private-key-here
# Rate Limiting
RATE_LIMIT_DEFAULT=100 per hour
RATE_LIMIT_LOGIN=5 per minute
# Logging
LOG_LEVEL=INFOcd code/backend
source venv/bin/activate
# Database will auto-initialize on first run
python app.pycd code/blockchain
# Start a local blockchain node (Hardhat's built-in node)
npx hardhat node
# In another terminal, compile and deploy
npm run compile
npm run deploy:local# Generate secure random keys
python3 -c "import secrets; print('SECRET_KEY=' + secrets.token_hex(32))"
python3 -c "import secrets; print('JWT_SECRET_KEY=' + secrets.token_hex(32))"# Start backend
cd code/backend
source venv/bin/activate
python app.py &
# Test health endpoint
curl http://localhost:5000/api/healthExpected output:
{
"success": true,
"status": "healthy",
"version": "1.0.0",
"services": {
"database": "up",
"redis": "up" or "not_configured",
"blockchain": "up" or "down",
"ai_model": "up"
}
}# Backend tests
cd code/backend
source venv/bin/activate
pytest
# Smart contract tests
cd code/blockchain
npm test
# Frontend tests
cd web-frontend
npm test| Service | Test Command | Expected Result |
|---|---|---|
| Backend API | curl http://localhost:5000/api/health |
HTTP 200, "healthy" status |
| Frontend | Open http://localhost:3000 |
Dashboard loads |
| MongoDB | mongo --eval "db.version()" |
Version number |
| Redis | redis-cli ping |
"PONG" |
| Blockchain | curl -X POST http://localhost:8545 |
JSON-RPC response |
Problem: python3: command not found
Solution:
# Ubuntu/Debian
sudo apt install python3 python3-pip
# macOS
brew install python@3.11
# Verify
python3 --versionProblem: node: command not found
Solution:
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
# macOS
brew install node@18
# Verify
node --version && npm --versionProblem: EACCES: permission denied
Solution:
# Fix npm permissions (Linux/macOS)
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
# Or use nvm (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bashProblem: venv module not found
Solution:
# Ubuntu/Debian
sudo apt install python3-venv
# Verify
python3 -m venv --helpProblem: Can't connect to MongoDB
Solution:
# Check if MongoDB is running
sudo systemctl status mongodb # Linux
brew services list | grep mongo # macOS
# Start MongoDB
sudo systemctl start mongodb # Linux
brew services start mongodb-community # macOS
# Use SQLite for development (no MongoDB required)
# In .env: DATABASE_URL=sqlite:///blockscore.db✅ Installation complete! Continue with:
- Quick Start Guide - Get up and running
- Configuration Guide - Advanced configuration
- Usage Guide - Learn how to use BlockScore