Installation
Prerequisites
Before installing OConsent, ensure you have the following:
Python 3.8 or later
Node.js 14 or later (for smart contract development)
An Ethereum node or provider (like Infura)
IPFS node (optional, for decentralized storage)
Basic Installation
Install using pip:
$ pip install oconsent
For development installation:
$ git clone https://github.com/oconsent/oconsent.git
$ cd oconsent
$ pip install -e .
Smart Contract Setup
To set up the smart contracts:
$ cd contracts
$ npm install
$ cp .env.template .env
# Edit .env with your configuration
$ npx hardhat compile
IPFS Testing Setup
To run IPFS integration tests, you’ll need additional setup:
1. Install and Run IPFS
First, install IPFS daemon:
Download from IPFS Installation Guide
Or use package manager:
# On Ubuntu
$ sudo apt install kubo
# On MacOS with Homebrew
$ brew install ipfs
Initialize and start IPFS:
$ ipfs init
$ ipfs daemon
2. Configure Environment
Set up environment variables either by exporting directly:
# Required
$ export IPFS_NODE=/ip4/127.0.0.1/tcp/5001
$ export IPFS_GATEWAY=https://ipfs.io
# Optional - for pinning service testing
$ export IPFS_PINNING_SERVICE=https://api.pinata.cloud
$ export IPFS_PINNING_KEY=your_pinning_service_key
Or create a .env file in the project root:
IPFS_NODE=/ip4/127.0.0.1/tcp/5001
IPFS_GATEWAY=https://ipfs.io
IPFS_PINNING_SERVICE=https://api.pinata.cloud
IPFS_PINNING_KEY=your_pinning_service_key
Troubleshooting
Common Installation Issues
Python Dependencies
If you encounter dependency conflicts:
$ pip install -e . --no-deps $ pip install -r requirements.txt
Node.js Issues
For smart contract compilation errors:
$ rm -rf node_modules $ npm cache clean --force $ npm install
IPFS Connection
If IPFS daemon won’t start:
$ ipfs init --empty-repo $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' $ ipfs daemon --offline # Test offline first
Network Issues
For connection timeouts:
# Test local endpoints $ curl http://localhost:8545 # Ethereum $ curl http://localhost:5001 # IPFS # Check firewall $ sudo ufw status $ sudo ufw allow 4001 # IPFS swarm $ sudo ufw allow 5001 # IPFS API
Environment Setup
For environment issues:
Python Environment:
$ python -m venv venv $ source venv/bin/activate # Unix $ .\venv\Scripts\activate # Windows
Node Version:
$ nvm install 14 $ nvm use 14
Path Issues:
Add to ~/.bashrc or ~/.zshrc:
export PATH=$PATH:$HOME/.local/bin export PATH=$PATH:$HOME/go/bin # For IPFS
System Requirements
Memory: 4GB minimum (8GB recommended)
Storage: 1GB for installation, 10GB+ for blockchain data
Ports: 8545 (Ethereum), 5001 (IPFS API), 4001 (IPFS swarm)
For detailed testing instructions, see Testing Guide.