Deployment Guide

Step-by-step instructions for deploying Oracle AI.

Local Development

Prerequisites

  • Node.js 18+
  • npm 9+
  • Git

Step 1: Clone and Install

git clone https://github.com/your-org/oracleai.git
cd oracleai
npm install

Step 2: Start Local Blockchain

cd contracts
npx hardhat node

This starts a local node at http://127.0.0.1:8545.

Step 3: Deploy Contracts

In a new terminal:

cd contracts
npx hardhat run scripts/deploy.ts --network localhost

Save the output addresses!

Step 4: Configure Frontend

cd frontend
cp .env.example .env.local

Update contract addresses in src/config/contracts.ts.

Step 5: Start Frontend

npm run dev

Open http://localhost:3000

Step 6: Configure MetaMask

  1. Add network:

  2. Import test account (first Hardhat account)


Testnet Deployment (Sepolia)

Step 1: Get Testnet ETH

Visit sepoliafaucet.com

Step 2: Configure Hardhat

// hardhat.config.ts
networks: {
  sepolia: {
    url: process.env.SEPOLIA_RPC_URL,
    accounts: [process.env.DEPLOYER_PRIVATE_KEY]
  }
}

Step 3: Deploy

npx hardhat run scripts/deploy.ts --network sepolia

Step 4: Verify Contracts

npx hardhat verify --network sepolia <CONTRACT_ADDRESS>

Production Deployment

Pre-Deployment Checklist

  • Smart contract audit completed
  • All tests passing
  • Multisig wallet set up
  • Monitoring configured
  • Documentation complete
  • ETH for liquidity prepared
  • ORACLE allocation for liquidity decided

Contract Deployment

  1. Use hardware wallet
  2. Deploy during low gas periods
  3. Verify all contracts on Etherscan
  4. Transfer ownership to multisig

Uniswap V3 Liquidity Setup

After deploying contracts, set up DEX trading:

# 1. Add liquidity to Uniswap V3
npm run liquidity:mainnet -- --oracle 100000000 --eth 10

# 2. Enable trading (after liquidity is added)
npm run trading:enable:mainnet

Liquidity Options:

FlagDescriptionDefault
--oracleORACLE tokens to add100,000,000
--ethETH to pair with10
--feeFee tier (500, 3000, 10000)3000 (0.3%)

Important: Trading is disabled by default. Only enable after liquidity is added.

Frontend Deployment

cd frontend
npm run build
vercel --prod

Backend Deployment

cd backend
npm run build
pm2 start dist/index.js

Resolver Deployment

pm2 start dist/run-resolver.js --name "resolver"

Environment Variables

Frontend (.env.local)

NEXT_PUBLIC_WC_PROJECT_ID=xxx
NEXT_PUBLIC_CHAIN_ID=1

Backend (.env)

PORT=3001
RPC_URL=https://mainnet.infura.io/v3/xxx
MARKET_FACTORY_ADDRESS=0x...
RESOLVER_REGISTRY_ADDRESS=0x...
ORACLE_TOKEN_ADDRESS=0x...
RESOLUTION_ENGINE_ADDRESS=0x...

Resolver (.env)

RESOLVER_PRIVATE_KEY=0x...
AI_API_KEY=sk-...
AI_PROVIDER=openai
STAKE_PERCENTAGE=10
POLL_INTERVAL=60

Was this page helpful?