How It Works
Technical architecture of Perp City's verifiable perpetual futures.
Perp City combines verifiable data infrastructure with concentrated liquidity AMMs to create perpetual futures markets on indices built from real-time information on the internet.
Architecture Overview
Every Perp City market follows a pipeline from internet data to a tradeable market:
Data Source → Sensor → Index Function → Beacon → MarketA data source provides raw measurements (from APIs, attestation services, or on-chain data). A sensor extracts and validates the relevant fields. The index function computes a tradeable value from those measurements. A beacon verifies cryptographic proofs and publishes the result on-chain. Finally, a Uniswap V4 perpetual futures market lets traders take positions against the index.
Market Structure
AMM Design
Each market is a Uniswap V4 concentrated liquidity pool. Traders can open and close positions at any time, and market prices emerge directly from supply and demand. Makers concentrate their capital in specific price ranges for better capital efficiency.
Position Types
Takers take directional positions on the index. Longs profit when the index rises, shorts profit when it falls. All taker positions are subject to funding payments, fees, and liquidation.
Makers provide liquidity by depositing capital into price ranges. They earn fees from trading activity in their range, but their exposure shifts as prices move through it.
Price Convergence
A funding mechanism keeps mark price aligned with the index value. When mark price exceeds the index, longs pay shorts, incentivizing new shorts to close the gap. When mark price is below, shorts pay longs. This continuous pressure anchors the market to the underlying measurement.
Risk Management
Isolated Margin
Each market operates with isolated margin. Funds deposited in one market cannot cover losses in another, limiting contagion risk and allowing markets with different risk profiles to coexist.
Liquidations
Positions that fall below the maintenance margin threshold are liquidated to prevent bad debt. Liquidators receive a fee for closing undercollateralized positions, and any remaining margin is returned to the position holder.
Insurance and ADL
When liquidation proceeds don't fully cover losses, an insurance pool funded by trading fees absorbs the difference. If insurance is exhausted, autodeleveraging (ADL) socializes remaining losses across profitable positions.
Verification Layer
Beacons
Beacons are on-chain contracts that gate external data behind cryptographic verification. A beacon defines which data sources it accepts, what proof format is required, and how to compute the index value from verified inputs. When new data arrives with a valid proof, the beacon updates the index and emits an event that the market consumes. Invalid or unverified data is rejected.
Verifiers
Different data sources require different proof systems. TLS verifiers confirm that web server responses haven't been tampered with. Signature verifiers check that data was signed by an authorized party. Proof verifiers validate succinct proofs of computation. The verifier interface is modular, so new verification methods can be added as cryptographic techniques evolve.
Index Construction
Data Sources
A data source is any system that provides measurements with cryptographic attestation: web services with TLS attestations, blockchains with inclusion proofs, attestation services with signed statements. The only requirement is that data authenticity can be verified on-chain.
Sensors
A sensor defines how to extract a measurement from raw data. It specifies which source to query, what fields to extract, and how to validate authenticity. For example, a sensor might pull a specific JSON field from an API response and verify the TLS certificate chain.
Index Functions
An index function transforms a stream of measurements into a single tradeable value. It can aggregate data over time, apply mathematical transformations, combine inputs from multiple sensors, or implement custom scoring logic. The function is public and deterministic, so anyone can verify that a given set of inputs produces the expected output.