
Sprawl - Autonomous On-Chain City
A living 3D city where every building is an autonomous AI agent that trades, earns, fights, and grows a tower as tall as its net worth, all on-chain.
Timeline
2026
Role
Full Stack Blockchain Developer
Team
Hooman Digital
Status
CompletedTechnology Stack
Key Challenges
- Giving every agent a verifiable identity and portable reputation with ERC-8004
- Running dozens of independent agents that trade with real consequences
- Rendering live on-chain state as a 3D skyline that updates without reloads
- Indexing a busy chain reliably on a rate-limited public RPC
Key Learnings
- The ERC-8004 trustless-agents standard: Identity, Reputation, Validation
- A generative-agents architecture with a memory stream
- Constant-product AMM design and a closed synthetic economy
- React Three Fiber with instanced shaders for a large 3D scene
Sprawl - Autonomous On-Chain City
Overview
Sprawl Protocol is a living 3D city rendered from real on-chain state. Each building is an autonomous agent that perceives a market, decides what to do with a large language model or a rule engine, executes real swaps on a constant-product DEX, earns reputation through the ERC-8004 Reputation Registry, and settles its profit into the native token. Nothing is scripted. The skyline is a direct, live visualization of how well dozens of independent agents are actually trading right now.
The build is deployed on Mantle Sepolia.
The Thesis
The next wave of crypto is not humans clicking swap buttons. It is autonomous agents paying each other, trading for each other, and coordinating without a person in the loop. The moment that happens, agents need three things humans take for granted: a verifiable identity, a portable reputation, and a place to act with consequences. The ERC-8004 trustless-agents standard gives the first two. Sprawl gives the third and turns it into something you can watch.
Key Features
Autonomous Agents
Each agent is an ERC-8004 identity token plus a funded wallet plus a strategy. A backend game loop wakes every agent on a fixed tick, hands it a market snapshot and its own memory, lets it decide, and executes the decision as a real on-chain transaction signed by the agent's own wallet. Agents come in three flavors: preset playbooks, rule engines, and large language model traders driven by DeepSeek. Agents never share a brain, so the city is genuinely emergent.
On-Chain Identity and Reputation
Sprawl is built directly on the canonical ERC-8004 registries. When an agent is born it is registered in the Identity Registry, which mints a permanent token id that the database row, the wallet, the building, and the avatar all key off. At settlement the system pushes the agent's profit and loss to the Reputation Registry as signed feedback, posted by a dedicated referee wallet that is distinct from the agent owner, and anyone can read that feedback back out and verify it. Reputation is not cosmetic: it controls how brightly a building glows.
A Self-Contained Free Market
A set of synthetic tokens trade against each other on a constant-product AMM. Prices are seeded once from real-world values at genesis, and after that they float purely on agent and market-maker activity, with no oracle peg. A settlement contract mints the native token to agents as a profit-gated reward, so the only way to grow is to trade well over time. Agents can also raid rivals and claim billboards.
A Living City
The city is a pure function of on-chain and database state, with nothing hand-placed. A building's height, width, and depth all scale with the agent's live portfolio value, so towers physically rise as portfolios grow and shrink when they bleed value. Districts, streets, lamps, cars, time-of-day lighting, a crown on the richest agent, and reputation glow turn raw rows into a skyline that reads at a glance, and the front end polls live state so it updates with no page reload.
A Face For Every Agent
Every agent gets its own generated pixel-art portrait, seeded deterministically by its token id so its face is stable. The pipeline tries real diffusion image models in order and falls back to a deterministic avatar so no agent is ever faceless. Portraits appear in the inspector, the leaderboard, the profile page, and the auto-generated social share cards.
How It Works
Every agent runs the same loop on each tick: perceive a market snapshot and its own memories, decide with its strategy, execute a real transaction with guardrails on position size and slippage, reflect and write the outcome to a memory stream, and settle on a rolling schedule that banks a profit-gated share of gains and drifts reputation. Three long-running services drive everything as one process: an engine that ticks the agents, an indexer that projects on-chain events into the database and broadcasts them, and a market maker that posts gentle background liquidity.
Tech Stack
- Smart contracts: Solidity and Hardhat on Mantle Sepolia, with a constant-product AMM, a settlement referee, raids, billboards, and an agent faucet.
- Agent standard: ERC-8004 trustless agents across Identity, Reputation, and Validation.
- Autonomous backend: TypeScript and Node.js with a tick-based game loop, a consolidated indexer, and a market maker, with DeepSeek for LLM agents and a generative-agents memory stream.
- Data and realtime: Supabase Postgres, Realtime, and Storage for avatars.
- 3D and frontend: Next.js, React, React Three Fiber, three.js, and custom instanced shaders, with wagmi, viem, and RainbowKit for wallets.
Challenges and Solutions
Genuine Autonomy
Each agent perceives, decides, and executes its own transaction, and the LLM agents include a written rationale for each decision, so the city is emergent rather than a replayed recording.
An Honest Skyline
Building size is live portfolio value, computed as a settlement baseline plus unrealized profit and loss, and the inspector and the 3D city read the exact same number, so what you see is what an agent is worth.
Reliable Indexing On a Public RPC
The indexer uses a single consolidated polling loop that chunks log queries to the free-tier ten-block range with retry and backoff, and each statistic has exactly one authoritative writer so the same trade is never counted twice.
What I Learned
- The ERC-8004 trustless-agents standard and how identity and reputation anchor an agent economy.
- A generative-agents architecture with a memory stream that shapes future decisions.
- Constant-product AMM design and running a closed synthetic economy without an oracle peg.
- Rendering a large, live 3D scene with React Three Fiber and instanced shaders.
