Flying now on markets — AI-assisted prediction markets for flight and airport outcomes, settled on 0G Galileo Testnet (Chain ID 16602) with data from FlightRadar24 and inference from 0G Compute.
This repository is a pnpm monorepo: Next.js frontend, Express/TypeScript API, and Foundry smart contracts.
| Area | What ships today |
|---|---|
| Markets | Airport (Yes/No delay-style) and flight status (OnTime / Delayed / Rescheduled / Cancelled), seeded demo markets + create market from flight search |
| AI | 0G Compute–backed analysis, proof hash surfaced in UI; creation tx link where available |
| Chain | PredictionMarket.sol — multi-outcome pools, placeBet, withdrawBet before end, resolveMarket (resolver), claimPayout |
| Data | FR24 flight summary, live-style status (UTC day window), delay stats; Resolve (test) uses yesterday’s data for manual resolution |
| UX | Wallet connect, Polymarket-style share/payout hints, pool totals from chain, bet tx links, resolution countdown (UTC), live status Refresh |
Settlement token on testnet is A0GI.
Finoma runs on 0G Galileo. You use your own browser wallet (e.g. MetaMask, Rabby, or any wallet that supports injected EVM connections) to sign bets, withdrawals, and claims. The app does not custody funds.
Install an EVM wallet browser extension if you do not already have one. Finoma’s frontend uses the standard injected provider (same flow as “Connect wallet” on other dApps).
If the site asks you to switch networks, approve the switch when prompted.
To add the network manually (e.g. MetaMask: Settings → Networks → Add network → Add a network manually), use:
| Field | Value |
|---|---|
| Network name | 0G Galileo Testnet (or any label you prefer) |
| RPC URL | https://evmrpc-testnet.0g.ai |
| Chain ID | 16602 (MetaMask: enter decimal 16602) |
| Currency symbol | A0GI |
| Block explorer URL (optional) | https://chainscan-galileo.0g.ai |
Save the network and select it before using Finoma.
On Galileo, A0GI is the native token: you need it for transaction gas and for staking in markets (bets are sent as native value).
- Open the 0G testnet faucet: https://faucet.0g.ai
- Connect the same wallet address you will use in Finoma (or paste your address if the faucet asks for it).
- Request test tokens per the faucet rules (limits and cooldowns are set by 0G).
- Wait for the transfer to confirm, then check your balance in the wallet while Galileo is selected.
If the faucet or policy changes, check 0G documentation for the current testnet funding method.
- Open the hosted Finoma URL (or your local
http://localhost:3000if you run the stack yourself). - Click Connect / connect wallet.
- Approve the connection in your extension.
- If prompted, switch to chain ID 16602 (Galileo).
You should see your shortened address when connected. Use Refresh or reload if the balance UI looks stale after funding.
| Action | What you need |
|---|---|
| Place a bet | A0GI balance ≥ bet amount + gas |
| Withdraw a bet (before market ends) | Small amount of A0GI for gas |
| Claim after a resolved market you won | Gas only (payout is from the contract) |
Gas costs are paid in A0GI on Galileo, not in a separate test “USDC” unless the deployment explicitly adds one (this stack uses native A0GI for pools).
- Wrong network — Wallet must show Chain ID 16602 while using Finoma.
- Insufficient funds — Top up via the faucet; keep a little extra for gas.
- Transaction reverted — Market may have ended, outcome invalid, or contract address mismatch: a self-hosted frontend must use the same
NEXT_PUBLIC_PREDICTION_MARKET_ADDRESSas the deployment you interact with. - Explorer — Inspect txs and contracts at https://chainscan-galileo.0g.ai.
Tracked source and config (build artifacts and local secrets are not committed — see .gitignore):
finoma/
├── frontend/ # Next.js 14 app (Finoma UI)
├── backend/ # Express API — markets, FR24, 0G Compute, viem chain calls
├── contracts/ # Foundry — PredictionMarket.sol, INFTAgentRegistry.sol
├── package.json # Workspace scripts (pnpm)
├── pnpm-workspace.yaml
├── railway.toml # Example Railway build/start (compiles backend, runs compiled entrypoint)
└── README.md
Authoritative env shape: backend variables are validated in backend/src/config/env.ts. Frontend public variables are read in frontend/src/lib/config.ts.
- Node.js ≥ 20
- pnpm ≥ 9 (
packageManageris pinned in rootpackage.json) - Foundry — to build/test/deploy
contracts/ - API keys: FR24 (Explorer plan), 0G Compute, and a Galileo-funded wallet for the backend signer
-
Clone and install
pnpm install
-
Configure environment (via shell export or your editor/hosting “Variables” UI — do not commit secrets):
- Backend: set the variables listed below; the server loads from the current working directory and adjacent paths (see
backend/src/index.ts). - Frontend: set
NEXT_PUBLIC_*values the same way for dev (Next.js reads them from the environment).
- Backend: set the variables listed below; the server loads from the current working directory and adjacent paths (see
-
Compile backend
pnpm run build:backend
-
Run
pnpm run dev:backend # API: port from `BACKEND_PORT` or `PORT`, default 3001 pnpm run dev:frontend # http://localhost:3000
Or
pnpm run devto start both (background backend). -
Contracts (optional local iteration)
cd contracts && forge build && forge test
Deployed contract addresses must match the values you configure for the backend and frontend.
Health check: GET /api/health
Backend — full validation and defaults: backend/src/config/env.ts.
| Variable | Role |
|---|---|
FR24_API_KEY, FR24_BASE_URL, FR24_RATE_LIMIT_RPM |
FlightRadar24 |
ZEROG_API_KEY, ZEROG_MODEL_ID |
0G Compute |
ZEROG_CHAIN_RPC_URL, ZEROG_CHAIN_ID, ZEROG_CHAIN_PRIVATE_KEY |
Galileo signer |
ZEROG_PREDICTION_MARKET_ADDRESS, ZEROG_INFT_REGISTRY_ADDRESS |
Contracts |
BACKEND_PORT / PORT |
Server port (many hosts set PORT) |
NEXT_PUBLIC_APP_URL |
Allowed browser origin(s) for CORS; comma-separated for multiple frontend URLs |
Frontend — consumed in frontend/src/lib/config.ts:
| Variable | Role |
|---|---|
NEXT_PUBLIC_ZEROG_RPC_URL, NEXT_PUBLIC_CHAIN_ID |
Wallet RPC |
NEXT_PUBLIC_PREDICTION_MARKET_ADDRESS, NEXT_PUBLIC_INFT_REGISTRY_ADDRESS |
Contracts |
NEXT_PUBLIC_API_BASE_URL |
Backend origin (no trailing slash) |
-
Backend (e.g. Railway)
- Use repository root as the service root so
railway.tomlapplies: install pnpm deps, run the backend build script, then start the compiled server (seerailway.tomlfor the exact command). - Configure the same backend variables in the host’s environment UI. Set
NEXT_PUBLIC_APP_URLto your real frontend origin(s).
- Use repository root as the service root so
-
Frontend (e.g. Vercel)
- Set project root to
frontend(or equivalent). - Set all
NEXT_PUBLIC_*variables; pointNEXT_PUBLIC_API_BASE_URLat your public API URL.
- Set project root to
| Item | Value |
|---|---|
| Network | 0G Galileo Testnet |
| Chain ID | 16602 |
| RPC | https://evmrpc-testnet.0g.ai |
| Explorer | https://chainscan-galileo.0g.ai |
| Command | Description |
|---|---|
pnpm run dev:frontend |
Next.js dev server |
pnpm run dev:backend |
API with tsx watch |
pnpm run build |
Backend TypeScript compile + frontend production build |
pnpm run build:backend |
Backend compile only (output under backend/, gitignored) |
pnpm run start |
Production API via backend package from monorepo root |
pnpm run lint |
Frontend + backend lint |
pnpm run test |
Backend Jest |
- Do not commit secrets, API keys, or private keys. Keep them in your host’s secret store or local tooling only.
- Rotate any credential that may have been exposed.
- The backend signer is privileged as contract owner/resolver on typical testnet deployments — protect
ZEROG_CHAIN_PRIVATE_KEY.
Private project unless otherwise noted. Adjust this section when you publish an explicit license.
