Skip to main content

Quickstart

This guide walks you through creating and signing CoW Protocol orders using TypeScript.

Prerequisites

  • @cowprotocol/contracts installed
  • ethers@^5.4.0 installed
  • A wallet or signer

Setup

Step 1: Define Your Order

Orders specify trading parameters: the tokens being exchanged, amounts, validity period, and balance types.

Order Kinds

  • SELL - Exchange an exact amount of sell tokens for a minimum amount of buy tokens
  • BUY - Purchase an exact amount of buy tokens spending at most a specified amount of sell tokens

Step 2: Create Domain Separator

A domain separator ensures orders remain valid only for specific blockchain networks and settlement contracts.
Use the correct settlement contract address for your target network. An incorrect address will invalidate signatures.

Step 3: Sign the Order

CoW Protocol supports multiple signing schemes:
  • EIP712 - Recommended for best user experience
  • ETHSIGN - For compatibility with wallets that don’t support EIP-712
  • EIP1271 - For smart contract wallets (e.g., Gnosis Safe)
  • PRESIGN - For on-chain order placement

Step 4: Compute Order UID

Complete Example

Next Steps

Orders

Learn about order types and lifecycle

Signing

Explore advanced signing schemes
Last modified on March 4, 2026