FX Risk Agent
AI-powered FX risk monitoring agent for cross-border payments. Every AI decision is permanently stored on 0G Storage and recorded on 0G Chain — creating a verifiable audit trail.
視頻



技術堆疊
描述
Problem
Cross-border payment companies process billions in daily FX transactions. When exchange rates move sharply during settlement windows (T+0 to T+2), manual monitoring misses critical
moments — leaving no verifiable evidence for post-incident audits.
The gap: "AI makes decisions" and "AI decisions are auditable" are worlds apart. Most AI systems today produce outputs with no cryptographic trail.
Solution
FX Risk Agent is an autonomous AI agent that creates an immutable, verifiable audit trail of every decision on the 0G Network — not just "what the AI said," but "what the AI knew,
judged, and recommended at each moment."
How it works:
AI analyzes real-time FX data for 4 currency pairs (USD/CNY, EUR/USD, GBP/USD, USD/JPY)
Every decision — full reasoning + model metadata — permanently stored on 0G Storage
Risk alerts recorded on-chain via FXRiskOracleV2 with access control (only Agent INFT owner can submit)
Every session updates Agent INFT (ERC-7857 inspired) state → on-chain inferenceCount grows
Anyone can verify: on-chain rootHash → download full decision log from 0G Storage
Full 0G Network Integration (4/4 components)
Component | Status | Usage |
0G Storage | ✅ Live | Permanent, tamper-proof archive of AI decision logs (JSON) |
0G Chain | ✅ Live | FXRiskOracleV2 records alerts with agentTokenId + aiBackend fields |
0G Compute | ✅ Live | Dual AI backend via @0glabs/0g-serving-broker (verifiable inference) |
Agent ID (INFT) | ✅ Live | ERC-7857 inspired NFT tokenizes agent identity, tracks inferences on-chain |
Architecture Highlights
Dual AI Backend: Doubao Seed 2.0 Pro (primary) + 0G Compute (Qwen 2.5 7B via TEE-capable broker)
Access Control: mintAgent onlyOwner + submitAlert requires INFT ownership → prevents forged "official" AI alerts
Reentrancy Protection: ReentrancyGuard on state-mutating functions
Hybrid Storage: Summary on-chain (gas-efficient) + full decision log off-chain on 0G Storage (verifiable via rootHash)
Tech Stack
AI: Doubao Seed 2.0 Pro + 0G Compute (Qwen 2.5 7B)
Smart Contracts: Solidity 0.8.24, OpenZeppelin 5.6.1, Foundry
Backend: TypeScript, Node.js, ethers.js v6
0G SDKs: @0gfoundation/0g-ts-sdk, @0glabs/0g-serving-broker
Network: 0G Galileo Testnet (Chain ID: 16602)
Live Contracts (Galileo Testnet)
FXRiskOracleV2: 0x2abde2687923ffb9a5be4c6df3aac68a4f0a93ca
FXRiskAgentINFT: 0xAA540f42f0d20588f183E3B92B3b617991fa22D1 (Token #0 minted)
FXRiskOracle V1: 0x12030bc39dd18E2e8e4F10e685b7B7E639F0925A (historical audit)
Live Demo
📊 Dashboard: https://smallironman666.github.io/fx-risk-agent/
📹 Demo Video: https://youtu.be/j2eaoJN18a8
Engineering Quality
✅ 28 Foundry tests passing (access control, reentrancy, DoS protection)
✅ 7 Architecture Decision Records (ADRs) documenting design rationale
About
Built by @0xSmallironman — 5 years cross-border payment infrastructure experience (FIX 4.4, SWIFT MT103, ISO 20022). "From SWIFT to Smart Contracts."
黑客松進展
Full 0G Integration Live + Production-Grade Security (2026-04-14)
Since the Checkpoint submission, FX Risk Agent has completed all 4 0G infrastructure components and hardened the contract layer with production-grade security patterns.
🎯 4/4 0G Components — All Live on Galileo
Component | Status | Usage |
0G Storage | ✅ Live | Every decision log (reasoning, confidence, model metadata) uploaded with verifiable rootHash |
0G Chain | ✅ Live | FXRiskOracleV2 records alerts with |
0G Compute | ✅ Live | Dual-backend inference via |
Agent ID (INFT) | ✅ Live | ERC-7857 inspired NFT tokenizes agent identity, on-chain |
🛡️ Security Architecture
Access Control:
FXRiskAgentINFTuses OpenZeppelinOwnable— only the official deployer can mint Agent identities, preventing forgery of "official" AI alertsAuthenticated Alerts:
submitAlertrequiresINFT.ownerOf(tokenId) == msg.sender— every on-chain alert is cryptographically bound to a legitimate AgentReentrancy Protection:
ReentrancyGuardon all state-mutating functionsDoS Protection: Query pagination capped at
MAX_QUERY_COUNT = 100Input Validation: Strict integer/range checks on all agent identifiers
📦 Live Contracts (Galileo Testnet)
FXRiskOracleV2:
0x2abde2687923ffb9a5be4c6df3aac68a4f0a93caFXRiskAgentINFT:
0xAA540f42f0d20588f183E3B92B3b617991fa22D1(Token #0 minted)FXRiskOracle V1 (historical):
0x12030bc39dd18E2e8e4F10e685b7B7E639F0925A
End-to-end validation: one full agent session completed across all 4 components — V2 alert recorded, INFT state updated, storage rootHash verifiable on-chain.
📊 Engineering Metrics
28 Foundry tests covering access control, ownership transitions, DoS boundaries, and multi-backend scenarios
14 TypeScript integration tests for off-chain components
7 Architecture Decision Records documenting key design choices (dual-backend strategy, V1/V2 coexistence, TEE trade-offs, etc.)
Solidity 0.8.24 + OpenZeppelin 5.6.1, built with Foundry
🌐 Global Accessibility
Dashboard migrated to GitHub Pages with auto-deploy workflow — globally accessible without regional DNS/CDN restrictions.
Live Dashboard: https://smallironman666.github.io/fx-risk-agent/
🔗 Key Links
📊 Dashboard: https://smallironman666.github.io/fx-risk-agent/
📹 Demo Video: https://youtu.be/j2eaoJN18a8
🔍 V2 Explorer: https://chainscan-galileo.0g.ai/address/0x2abde2687923ffb9a5be4c6df3aac68a4f0a93ca
🎯 Next Milestones (Before Final 5/16)
Implement
tokenURIfor INFT visibility in wallets and explorersRecord fresh demo showcasing the full verifiable decision flow
籌資狀態
Not yet funded. Building as an independent project for the 0G APAC Hackathon.