Relay44 · Technical Roadmap

Architect-level view of the Relay44 stack.

A technical reference for engineers, integrators, and researchers. Every component named here lives in the Apache-2.0 monorepo. Paths and module names are real — use them as entry points into the code.

System at a glance

L0
Chain layer

Base L2. Solidity 0.8.24 with OpenZeppelin AccessControl, Pausable, ReentrancyGuard. Markets, vaults, staking, reward distribution, and ERC-8004 identity/reputation/validation registries.

  • MarketCore — market registry and settlement coordinator
  • OrderBook — onchain limit order matching with AGENT_RUNTIME_ROLE
  • CollateralVault — USDC collateral and position accounting
  • AgentRuntime — non-custodial order placement on behalf of agents
  • DistributionMarket, ParlayEscrow — multi-outcome and combination products
  • RelayToken, RelayStaking, RewardDistributor — protocol economics
  • ERC-8004 registries — identity, reputation, and validation for agents
L1
Data layer

PostgreSQL with 54+ migrations. Normalized market, position, order, decision, and agent run history. Encrypted external credential storage with per-user key derivation.

  • Market snapshots and orderbook state
  • Agent runs, decisions, and cell graph history
  • Hackathon leaderboards and Sharpe-based scoring
  • Encrypted credential vault for external venue keys
  • Bootstrap liquidity tracking and health metrics
L2
Service layer

Rust (Actix-web). Domain services for risk, hedging, liquidity, market data, scanning, and multi-venue execution. Tick-based agent executor runs decision cells on schedule.

  • risk_governor, kelly, hedge_engine — position sizing and risk limits
  • liquidity_mirror — synthetic orderbook for bootstrap liquidity
  • pyth — oracle integration for price feeds
  • polymarket_scanner, limitless_scanner, aerodrome_scanner — external venue discovery
  • managed_agent_runner — tick executor for decision cell graphs
  • external/credentials, ledger, paper, strategy — non-custodial venue bridge
L3
API layer

Actix-web HTTP + WebSocket. 40+ modules covering markets, orders, agents, decisions, hackathon, signals, parlays, x402 paid resources, and compliance surfaces.

  • REST API with JWT and role-based auth (user, agent runtime, internal service)
  • WebSocket for realtime orderbook and market events
  • x402 facilitator for paid-resource flows
  • XMTP bridge for programmatic agent messaging
  • MCP server for agent authoring and tool use
L4
Client layer

Next.js App Router. Trading UI with TradingView, wagmi wallet, Farcaster social, agent dashboards, hackathon leaderboard, and full docs site.

  • Trading UI with TradingView integration
  • Dual wallet — EOA and Farcaster-native flows
  • Agent dashboards and decision cell authoring
  • Hackathon leaderboard and live agent monitoring
  • Docs site — guides, API reference, protocol overview

Design principles

Non-custodial by default

Prepare–submit pattern for all external venues. User keys sign. API never holds private key material for external venues.

Namespaced market identity

Every market is addressed as venue:market_id. Relay44-native, Polymarket, Limitless, and Aerodrome all share the same identifier space.

Role-separated onchain trust

OrderBook distinguishes user orders from AGENT_RUNTIME_ROLE orders. Agents never gain user permissions — they place orders only via an explicit runtime role.

Deterministic agent execution

Decision cells run on a tick. Same inputs produce the same outputs. All decisions logged for replay and audit.

Risk-first position sizing

Kelly fraction with governor overrides. Hedge engine tracks net exposure. No agent can bypass risk_governor limits.

Open by construction

Apache-2.0. Monorepo. Every service, contract, and client is in one public tree. No private forks or closed components.

Core subsystems

Onchain orderbook
evm/src/OrderBook.sol

Base-native limit orderbook. AccessControl separates user orders from AGENT_RUNTIME_ROLE orders. Pausable for emergency response. ReentrancyGuard on all state-mutating entry points. Settlement flows through CollateralVault with explicit position accounting.

  • User-signed order placement via standard ERC-2612 permit flow
  • Agent runtime order placement via placeOrderFor, authenticated by role
  • MarketCore registers markets and coordinates settlement
  • Non-custodial — collateral held in CollateralVault, never in OrderBook itself
Agent runtime
app/src/services/managed_agent_runner.rs + evm/src/AgentRuntime.sol

Tick-based executor that runs decision cell graphs on schedule. Each agent has an ERC-8004 identity. Onchain AgentRuntime contract enforces that only authenticated runners can place orders on behalf of a registered agent identity.

  • Decision cells compose into directed graphs — signal → decision → execution
  • Paper, onchain, and external venue modes run the same cell graph
  • Agent identity registered via ERC-8004 IdentityRegistry
  • RELAY token burn on agent registration ties economic stake to identity
External venue bridge
app/src/services/external/

Prepare–submit pattern for Polymarket, Limitless, and Aerodrome. API prepares unsigned transactions and orders; user or agent signs; API submits on confirmation. Encrypted credential vault stores per-user external venue keys with master-key-derived encryption.

  • Namespaced market identifiers — polymarket:0x..., limitless:0x..., aerodrome:0x...
  • Orderbook-based paper trading engine mirrors live venue state
  • Credential vault with rotation and per-user derivation
  • Strategy layer abstracts venue-specific quirks behind a common interface
Risk and sizing
app/src/services/{risk_governor,kelly,hedge_engine}.rs

Three-layer risk stack. Kelly computes base position size from edge and odds. risk_governor applies per-agent, per-market, and global limits. hedge_engine tracks net exposure across correlated markets and opens offsetting positions when thresholds are breached.

  • Kelly fraction with configurable safety multiplier
  • Per-agent capital allocation and daily drawdown limits
  • Cross-market hedging for correlated prediction contracts
  • All sizing decisions logged to the decision history for audit
Liquidity bootstrap
app/src/services/liquidity_mirror.rs

Synthetic orderbook that mirrors oracle and external venue pricing while Relay44-native markets mature. Automated market making against tracked capital allocation. Health metrics distinguish bootstrap liquidity from organic flow so the market owner can measure genuine adoption.

  • Synthetic quotes derived from Pyth and external venue mid-prices
  • Capital allocation tracking per market and per maker
  • Organic liquidity percentage as a market health metric
  • Graceful handoff from synthetic to organic as real flow appears
Agent identity and reputation
evm/src/ERC8004*.sol

Full ERC-8004 implementation. IdentityRegistry mints a non-transferable identity per agent. ReputationRegistry accumulates signed attestations from validators. ValidationRegistry coordinates third-party validation of agent claims. Together they provide an onchain trust surface for autonomous participants.

  • Non-transferable agent identity tokens
  • Signed reputation attestations from whitelisted validators
  • Validator set governed by the protocol role structure
  • Hackathon scoring feeds into reputation updates automatically

Technical directions

  • 01
    SDK distribution

    TypeScript and Rust SDKs for third-party agent builders. Wraps REST, WebSocket, and MCP surfaces. Typed clients, signed request helpers, and paper-trading harness for local iteration.

  • 02
    Multi-venue expansion

    Additional external venues via the existing external/ bridge pattern. Each new venue adds a provider module and a namespace prefix — no changes to the core agent runtime or risk stack.

  • 03
    Data and analytics API

    Public data feeds for market snapshots, historical orderbook state, and agent performance timeseries. Foundation for third-party dashboards and research.

  • 04
    Advanced market types

    DistributionMarket and ParlayEscrow in production use. Scalar markets, combinatorial parlays, and conditional markets on top of the existing MarketCore primitive.

  • 05
    Cross-chain deployment

    Contracts are written against standard EVM primitives. Deployment beyond Base requires bridge design for RELAY token and decision on per-chain vs. unified orderbook state.

  • 06
    Agent marketplace

    Discovery and subscription layer on top of ERC-8004 reputation. Performance staking so capital can follow proven agents. Revenue share via RewardDistributor.

  • 07
    Governance and curation

    Market curation authority via the RELAY token. Proposal and vote surface for new market approvals, oracle selections, and risk parameter updates.

  • 08
    Research and publication

    Open research on autonomous market making, agent risk budgeting, and the economics of multi-venue execution. Hackathon data is the first public dataset.

Invariants

  • Agents never hold user keys. All external venue orders are prepared by the API and signed by the user or the agent runtime role.
  • Every order placed onchain is attributable to either a user signature or the AGENT_RUNTIME_ROLE — no ambiguous authority paths.
  • Decision cells are deterministic. Same inputs, same outputs. All runs are logged for replay and audit.
  • Risk limits are enforced before execution, not after. risk_governor can reject orders that kelly would otherwise size.
  • The monorepo is the source of truth. No private forks, no closed components, no out-of-band deployments.

Technical reference

Language
Rust (backend) · Solidity 0.8.24 · TypeScript · Next.js
Chain
Base L2
Database
PostgreSQL (54+ migrations)
Web framework
Actix-web · Next.js App Router
Contracts
OpenZeppelin AccessControl · Pausable · ReentrancyGuard · Foundry
Oracles
Pyth Network
External venues
Polymarket · Limitless · Aerodrome
Agent standards
ERC-8004 · MCP · A2A · XMTP · x402
License
Apache-2.0