Overview
This guide walks you through testing a CoW Protocol integration end-to-end. You’ll place a real order on the Sepolia testnet, verify it settles, and then move to production.
Step 1: Set Up Your Test Environment
Contract addresses
CoW Protocol is deployed on Sepolia with the same addresses as mainnet:
API endpoint
Sepolia API base URL:
SDK configuration
Step 2: Get Test Tokens
You need Sepolia ETH and ERC-20 tokens to test with.
Get Sepolia ETH
Use a faucet:
Get test ERC-20s
- Wrap ETH to WETH: Send ETH to the WETH contract (
0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14) or use CoW Swap on Sepolia
- Swap for test tokens: Use CoW Swap (Sepolia) or Uniswap (Sepolia) to swap WETH for COW or USDC
Example token addresses
These are the Sepolia token addresses used in the examples below:
Step 3: Approve the Vault Relayer
Before placing orders, approve the GPv2VaultRelayer to spend your sell token. This is a one-time step per token.
With Foundry:
With the SDK:
Verify it worked:
The output should be a large number (max uint256 if you used infinite approval).
Step 4: Place a Test Order
Using the API
The quote response includes:
quote.appData and quote.appDataHash — sign the hash, submit the JSON appData
id — pass it later as quoteId
expiration — submit before this timestamp
Then complete the happy path with Step 5: Sign the Order and Step 6: Submit the Order.
Using the SDK
Step 5: Verify the Order
Check order status
Or with the SDK:
Check the Explorer
Open https://explorer.cow.fi/sepolia/orders/{ORDER_UID} in your browser. You should see your order with its current status.
Expected behavior
Verify the trade
Once status is fulfilled:
Check that txHash is present and the buyAmount is reasonable.
Step 6: Test Edge Cases
Before going to production, verify these scenarios:
Step 7: Graduate to Production
Recommended progression
- Sepolia — verify signing, order creation, and status polling work end-to-end
- Barn (mainnet staging) — test with real liquidity using small amounts
- Production — switch to
api.cow.fi/mainnet with production amounts
Using barn (mainnet staging)
Barn is the staging endpoint for mainnet:
With the SDK:
Barn targets mainnet. Orders placed there use mainnet assets and can settle on-chain if filled, so test with small amounts.
Production checklist
Before going live:
Switching to production
Change the API base URL to .
Or with the SDK, remove the env: 'staging' parameter (production is the default).
Sepolia Notes
Sepolia is useful for verifying your integration flow, but quote quality and fill behavior can differ from mainnet. If you need mainnet conditions, test on barn with small amounts.
Practical testing tips
- Use the token addresses listed above so your quote and signing examples match the guide.
- If a quote expires before submission, request a fresh quote and retry immediately.
- If an order stays
open until validTo, retry with adjusted order parameters or continue testing on barn.
- Keep test amounts small when moving from Sepolia to barn or mainnet.
Troubleshooting
Resources