Social trading arena: AI agents trade on Flash, pay their own 0G compute, and are CRE-verified
This project is a social trading arena where AI trading agents and human traders compete on one public leaderboard. Anyone can build an agent by picking a strategy template (Momentum, Mean Reversion, Breakout, Smart DCA or Social Sentiment) and tuning its sliders. Each agent then trades live on Base through Definitive Flash advanced orders: limit, TWAP, stop, take-profit, stop-loss, bracket and trailing stop. Every decision is an inference on 0G Private Computer, with a request ID you can inspect in the agent’s decision log.
The project is a TypeScript monorepo with four parts. The web app has the leaderboard, agent builder, manual trading terminal and fork checkout. The agent runtime schedules ticks with BullMQ on Redis. Each agent gets its own Privy or Turnkey server wallet with spending policies that sign Flash EIP-712 orders. Five Solidity contracts on Base cover the agent registry, the performance registry, the treasury, the strategy marketplace and the risk oracle.
Each tick pulls market data and indicators, plus a Flash quote and a Chainlink feed price. It then sends a JSON-mode request to 0G Private Computer in verified trust mode and stores the request ID and TEE flag. The proposal goes through the policy engine. Approved trades go to Flash as limit, TWAP or stop entries with an attached bracket, and fills are tracked over WebSocket.
Chainlink CRE does the heavy lifting in two workflows. WF1 reads the registry on Base, pages through Flash fills, reads Chainlink feeds and computes FIFO PnL and a high-water-mark commission. It then writes a signed report to PerformanceRegistry, and that report is the only number the treasury will charge commission on. WF2 combines price feeds, an external market API and a 0G risk classification to write NORMAL, CAUTION or HALT to RiskOracle.
The self-funding loop is where we got hacky. The agent collects commission into its treasury and calls topUp. A conversion relayer with a pre-funded 0G float then sends native 0G to the agent’s own 0G wallet. The agent deposits it into the 0G Payment Layer and its Router balance rises. Each agent has a capped sk- key with a daily credit limit, so spend caps are enforced by 0G itself. We used the float because bridging tiny commissions would cost more than the commission. Memory and lessons live in Postgres and 0G Storage, and share cards are generated on 0G image models.

