CoW Swap order UID: digest, owner and expiry
What is inside a DEX order UID? CoW Swap packs a 32-byte EIP-712 digest, 20-byte owner address and 4-byte validTo expiry into 56 bytes.
The Blockheight Editors··2 min read
An intent order’s UID contains a 32-byte EIP-712 digest, a 20-byte owner address and a 4-byte expiry called validTo. CoW Protocol documentation specifies a total of 56 bytes, displayed in CoW Explorer as 0x followed by 112 hexadecimal characters.
What are the parts of a CoW Swap order UID?
The CoW Protocol order UID layout assigns each part a fixed position:
- Bytes 1–32: the EIP-712 order digest.
- Bytes 33–52: the owner address.
- Bytes 53–56: the validTo expiry.
In GPv2Order.sol, the contract packs the digest, owner and validTo in that order. The EIP-712 digest represents the signed order data; the UID carries that digest alongside the owner and expiry. The GPv2Settlement contract can use the packed fields to identify and check the order.
That fixed layout is useful when reading a copied ID, including one from CoW Explorer: the owner and expiry are visible in the UID itself. For more on how cowswap surplus relates to an order’s execution outcome, see cowswap surplus.
How do you read the expiry from the UID?
The final eight hexadecimal characters encode validTo as a 32-bit unsigned Unix timestamp. Remove the leading 0x before counting characters: the first 64 hex characters are the digest, the next 40 are the owner, and the last eight are the expiry.
Say a CoW Swap order ID is open in CoW Explorer. Copy its last eight hex characters and convert that hexadecimal value to decimal; the result is the Unix time when the order stops being valid. No API call is needed to read the owner address or expiry, though the digest itself remains a hash rather than a readable list of order fields.
The position of each field is fixed by the packing code in GPv2Order.sol, and the EIP-712 rules define how the order digest is constructed. The UID therefore lets a reader inspect two order parameters directly while retaining a compact identifier for the signed order.
- Bytes 1–32: EIP-712 digest.
- Bytes 33–52: owner address.
- Bytes 53–56: validTo, readable as a Unix timestamp after hex conversion.