Skip to content

Latest commit

 

History

History
180 lines (137 loc) · 4.07 KB

File metadata and controls

180 lines (137 loc) · 4.07 KB

Deployment Guide

Prerequisites

  • Rust 1.93+ with wasm32v1-none target
  • Node.js 24+
  • pnpm (for ACBU frontend/backend)
  • npm (for ZK frontend)
  • Stellar CLI 21.2+
  • Noir 1.0.0-beta.22 (nargo)
  • Barretenberg (bb) or @aztec/bb.js
# Install wasm32v1-none target
rustup target add wasm32v1-none

# Install nargo
curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
noirup

# Install Stellar CLI
cargo install stellar-cli

1. Compile Noir Circuit

cd circuits/zk_comply_circuit

# Run tests
nargo test
# Expected: 2 tests passed

# Generate witness
nargo execute
# Output: target/zk_comply.gz, target/zk_comply.json

2. Build Soroban Contracts

# Verifier contract
cd contracts/zk_verifier
cargo build --target wasm32v1-none --release
# Output: target/wasm32v1-none/release/zk_comply_verifier.wasm

# Gate contract
cd ../zk_gate
cargo build --target wasm32v1-none --release
# Output: target/wasm32v1-none/release/zk_comply_gate.wasm

3. Deploy to Stellar Testnet

# Generate testnet key
stellar keys generate --global --network testnet deployer
stellar keys fund deployer --network testnet

# Set env vars
$env:STELLAR_RPC_URL="https://soroban-testnet.stellar.org"
$env:STELLAR_NETWORK_PASSPHRASE="Test SDF Network ; September 2015"

# Install WASM
stellar contract install \
  --network testnet \
  --source deployer \
  --wasm target/wasm32v1-none/release/zk_comply_verifier.wasm
# Returns: <wasm_hash>

# Deploy instance (requires VK from circuit compilation)
stellar contract deploy \
  --network testnet \
  --source deployer \
  --wasm-hash <wasm_hash> \
  -- \
  --vk_bytes <path_to_vk_file>

4. Run ACBU Backend

cd acbu-backend

# Install dependencies
pnpm install

# Set up environment
cp .env.example .env
# Required: DATABASE_URL, STELLAR_SECRET_KEY

# Start with nodemon
pnpm dev
# Backend: http://localhost:5000

5. Run Frontends

# ACBU Frontend (Next.js)
cd acbu-frontend
pnpm install
pnpm dev
# ACBU App: http://localhost:3000

# ZK-Comply Frontend (Vite)
cd acbu-zk/frontend/zk-comply-frontend
npm install
# Set environment
echo "VITE_ACBU_API_URL=http://localhost:5000/api/v1" > .env
npm run dev
# ZK-Comply: http://localhost:5173

6. Auto-Approval Script

For infrastructure bootstrapping, run the auto-approval script:

cd acbu-backend
npx ts-node --transpile-only scripts/auto-approve-kyc.ts

This auto-approves all pending KYC applications and registers validators.


Quick Test Flow

# 1. Sign up
curl -X POST http://localhost:5000/api/v1/auth/signup \
  -H "Content-Type: application/json" \
  -d '{"username":"test","passcode":"test123","email":"test@test.com"}'

# 2. Sign in (get API key)
curl -X POST http://localhost:5000/api/v1/auth/signin \
  -H "Content-Type: application/json" \
  -d '{"identifier":"test","passcode":"test123"}'
# Response: {"api_key": "acbu_...", "user_id": "..."}

# 3. Submit KYC
TOKEN="acbu_..."
curl -X POST http://localhost:5000/api/v1/kyc/applications \
  -H "Authorization: Bearer $TOKEN" \
  -H "x-api-key: $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"country_code":"NG"}'

# 4. Attach documents (after upload)
APP_ID="..."
curl -X PATCH "http://localhost:5000/api/v1/kyc/applications/$APP_ID/documents" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"documents":[{"kind":"id_front","storage_ref":"demo/front","mime_type":"image/jpeg"},{"kind":"id_back","storage_ref":"demo/back","mime_type":"image/jpeg"},{"kind":"selfie","storage_ref":"demo/selfie","mime_type":"image/jpeg"}]}'

# 5. Validate (use another verified account as validator)
VALIDATOR_TOKEN="acbu_..."
curl -X POST "http://localhost:5000/api/v1/kyc/validator/tasks/$APP_ID" \
  -H "Authorization: Bearer $VALIDATOR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"result":"approved","notes":"Verified"}'

# 6. Check status
curl http://localhost:5000/api/v1/users/me \
  -H "Authorization: Bearer $TOKEN"
# Response: {"kyc_status": "verified", "country_code": "NG"}