Overview
Autopilot operates on a time-based schedule (typically every 12-15 seconds, moving towards per-block auctions). For each auction cycle:- Auction Creation: Filters and collects solvable orders from orderbook
- Distribution: Sends auction data to all registered solvers via their
/solveendpoints - Ranking: Collects solutions, scores them, and determines winner(s)
- Execution: Instructs winning solver(s) to settle on-chain via
/settleendpoint - Monitoring: Tracks settlement and applies circuit breaker rules
Architecture
Autopilot acts as the central coordinator:Key Endpoints
Get Current Auction
GET /api/v1/auction
This endpoint is currently permissioned. Contact the CoW Protocol team in Discord to request access for your solver.
Response
Unique identifier for the auction (incrementing)
Block number for which the auction is valid. Orders and prices are guaranteed valid at this block.
Array of solvable orders included in the auction
Reference prices for all traded tokens (mapping of token address to price in native token)
List of addresses whose JIT order surplus counts towards objective value
Order Structure
Price Object
Theprices field maps token addresses to their reference prices denominated in native token (e.g., ETH on mainnet).
- Format:
{ "0x...tokenAddress": "1000000000000000000" } - Interpretation: Price of
1e18(10^18) token atoms in native token atoms - Usage: Used for computing surplus and converting fees to native token
200: Auction data returned401: Unauthorized (missing or invalid API key)
Get Native Price (Internal)
GET /native_price/{token}
This is an internal API used for communication between CoW Protocol services. It’s typically not exposed publicly.
Path Parameters
Token address to get price for
Query Parameters
Optional timeout in milliseconds (min: 250ms, capped to configured maximum)
Response
Price of the token in native token (e.g., 0.0005 = 1 token worth 0.0005 ETH)
200: Price retrieved successfully400: Bad request (e.g., unsupported token)404: No liquidity available for token429: Rate limited by upstream estimator500: Internal server error
Solver Integration
Solvers integrate with Autopilot by implementing specific endpoints that Autopilot calls during the auction cycle.Required Solver Endpoints
Solvers must implement these endpoints for Autopilot to interact with them:1. POST /solve
Receives auction data and returns solutions. Request (from Autopilot):2. POST /reveal
Reveals calldata for a specific solution (used in shadow competition for verification). Request (from Autopilot):3. POST /settle
Instructs solver to submit the winning solution on-chain. Request (from Autopilot):200 OK (solver begins settlement submission)
4. POST /notify
Receives notifications about solution outcomes. Request (from Autopilot):200 OK
Auction Parameters
Order Filtering
Autopilot filters orders before including them in auctions:- Validity: Only includes orders with
validTo > current_block_time - Balance: Checks user has sufficient balance and allowance
- Liquidity: Ensures tokens have available liquidity
- Fee Policies: Attaches appropriate fee policies based on order class
- Deny List: Excludes orders from deny-listed addresses
Token Pricing
Autopilot maintains a cache of token prices:- Native Token Reference: All prices denominated in native token (ETH, xDAI, etc.)
- Update Frequency: Prices refreshed periodically from liquidity sources
- Trusted Tokens: Marks certain tokens as trusted for buffer trading (CIP-2)
Fee Policies
Autopilot attaches fee policies to orders based on their class:Solution Scoring
Autopilot ranks solutions using the scoring formula defined in CIP-20: Score = User Surplus + Protocol Fees - Gas Cost (in native token) Where:- User Surplus: Difference between execution price and limit price for all orders
- Protocol Fees: Sum of all protocol fees collected from executed orders
- Gas Cost: Estimated gas usage × gas price × native token price
Reference Score (CIP-67)
Starting with CIP-67, Autopilot also computes reference scores to support the fair combinatorial auction mechanism.Circuit Breaker
Autopilot monitors settlements and enforces compliance:Monitoring
- Pre-Settlement: Validates solutions match scoring calculations
- Post-Settlement: Compares on-chain execution to promised solution
- Deviation Detection: Identifies discrepancies in amounts, prices, or fees
Enforcement Actions
- Warning: Minor deviations logged
- Temporary Jail: Solver excluded from next N auctions
- Ban: Severe or repeated violations result in permanent exclusion
Notification
Solvers receive notifications via/notify endpoint:
"banned": Solver has been permanently banned- Other violation types may be added
Solver Types
Colocated Solvers
External teams run their own driver + solver infrastructure:- Control: Full control over solver logic and execution
- Responsibility: Responsible for
/solve,/reveal,/settle, and/notifyendpoints - Settlement: Submit transactions directly to chain
- Examples: External solver partners with proprietary algorithms
Non-Colocated Solvers
CoW Protocol runs the driver, configured with external solver API:- API Only: Solver provides only route-finding logic
- Driver Handles: Settlement encoding, simulation, submission
- Configuration: Defined in driver config with API endpoint
- Examples: 1inch, 0x, Balancer integrations
Auction Lifecycle
- T=0: Auction starts, Autopilot filters orders and computes prices
- T+0.5s: Auction broadcast to all solvers via
/solve - T+0.5s - T+10s: Solvers compute solutions and respond
- T+10s: Deadline passes, Autopilot ranks solutions
- T+10.5s: Winner(s) receive
/settlerequest - T+11s - T+30s: Winner submits settlement transaction (2-3 block window)
- T+30s+: Circuit breaker validates on-chain execution
- T+45s: Next auction cycle begins
Timing is approximate and may vary by network and configuration.
Best Practices for Solvers
- Respond Quickly: Return solutions well before deadline to account for network latency
- Accurate Gas Estimates: Provide realistic gas estimates for accurate scoring
- Respect Constraints: Honor order limits, balances, and partial fill flags
- Apply Fee Policies: Correctly compute and apply protocol fees
- Handle Notifications: Implement
/notifyendpoint and respond to ban notifications - Monitor Performance: Track your solutions’ win rate and reasons for losses
- Simulate Settlements: Verify solutions work on-chain before responding
- Use Reference Prices: Leverage provided token prices for consistent scoring
Data Types
See the Orderbook API documentation for common data types likeAddress, TokenAmount, UID, etc.
Additional Autopilot Types
DateTime ISO 8601 UTC timestamp. Example:"2020-12-03T18:35:18.814523Z"
BigUint
Arbitrary precision unsigned integer in decimal notation.
Example: "1234567890"