RWA-Powered Autonomous Commerce Engine with AI Agent based on Arc testnet
RACE means RWA-Powered Autonomous Commerce Engine. A fully autonomous AI agent network that transforms Real World Assets (RWA) into on-chain productive capital, driving automated DeFi commerce activities. People barely interact with this system except for connecting the wallet and depositing for RWA collateral.
RACE - RWA-Powered Autonomous Commerce Engine
I went full-stack DeFi here. The frontend is Next.js 14 with RainbowKit for that smooth wallet connection experience - because nobody likes clunky Web3 UX. I used Wagmi and Viem for all the blockchain interactions, which honestly made contract calls way cleaner than dealing with raw ethers.js.
The smart contracts are deployed on Arc testnet - I built a whole suite: an AI agent contract that makes autonomous trading decisions, a SimpleDEX for token swaps, an RWA vault for real-world asset tokenization, and a risk manager to keep things from going sideways. All written in Solidity with Hardhat for deployment.
Here's where it gets interesting: I needed real-time price data to make intelligent trading decisions, so I spun up a Python Flask backend that hits the CoinGecko API. This thing caches prices to avoid rate limits and serves OHLC data for those charts. The frontend polls this API every few seconds to update the dashboard.
The particularly hacky part. I'm simulating an autonomous agent that watches BTC/ETH prices in real-time and adjusts its AMM pool positions based on market movements. It's like a robo-trader that actually thinks about risk management. I had to get creative with BigInt handling for blockchain math and built a custom decision engine that weighs multiple factors before executing trades.
For deployment, I split it up: Vercel hosts the frontend (because their Next.js integration is chef's kiss), and Render runs the Python backend. Had some fun dependency conflicts with the Python packages, so I created a minimal requirements file just for the API server - sometimes less is more.
The whole thing talks to smart contracts on-chain while pulling off-chain price data, creating this hybrid system where AI-driven decisions get executed trustlessly on the blockchain. Pretty wild seeing it all come together.

