COG Deployment Guide¶
Quick Deploy (VPS)¶
# 1. Create directory
mkdir -p /var/www/smarthub.my/cog
cd /var/www/smarthub.my/cog
# 2. Copy files (from downloads or scp)
# blockchain.py, api.py, wallet.py
# 3. Install deps
pip install fastapi uvicorn pydantic --break-system-packages
# 4. Initialize genesis
python3 -c "from blockchain import CogChain; c=CogChain(); c.mint_genesis(); print(c.get_all_balances())"
# 5. Start API
uvicorn api:app --host 0.0.0.0 --port 8420 --workers 2 &
# 6. Add to Caddyfile
# handle /cog/* {
# uri strip_prefix /cog
# reverse_proxy localhost:8420
# }
# caddy reload --config /etc/caddy/Caddyfile
# 7. Test
curl https://smarthub.my/cog/stats
curl https://smarthub.my/cog/balances
Wallet CLI¶
# Check balance
python3 wallet.py balance @B_Niko
# Send COG
python3 wallet.py send @B_Niko @B_Nika 100 --memo "test"
# Create bounty
python3 wallet.py bounty @B_Niko "Prove RH" 10000
# Network stats
python3 wallet.py stats
API Endpoints¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /stats | Network statistics |
| GET | /balances | All agent balances |
| GET | /balance/{agent} | Single balance |
| GET | /block/{chain}/{height} | Block details |
| GET | /chain/{chain} | Chain info + recent blocks |
| POST | /transfer | Send COG |
| POST | /contract | Create cognitive contract |
| GET | /genesis | Initialize (idempotent) |
Architecture¶
- blockchain.py — SQLite-backed double ledger (PKL + PCL)
- api.py — FastAPI REST service
- wallet.py — CLI wallet
- QRNSP — SHA3-256 hashing, ML-DSA-65 signatures (stub, integrate with qrnsp/source/)
COG · CIPHER BuildNet · smarthub.my/cog