Skip to main content
Blockfront

Crypto markets, protocols and policy

Check a contract wallet’s swap order signature

A contract wallet’s swap signature is checked against the exact order digest through ERC-1271; verify the wallet, chain, order fields and returned magic value.

Blockfront Editorial

3 min read

Check a contract wallet’s swap order signature

To check a contract wallet’s swap order signature, ask the wallet to validate the exact order digest and confirm it returns ERC-1271’s magic value, 0x1626ba7e. Unlike an externally owned account, a contract wallet may use custom rules to decide whether a signature is valid.

What does a contract wallet sign?

For CoW Protocol orders, the order digest is a hash of the order fields and an EIP-712 domain separator. The domain includes the chain ID and the settlement contract, so the same order data on another network can produce a different digest.

The signature bytes are wallet-specific. As a fuller overview of the swap flow explains, cowswap orders rely on a signature tied to their parameters. For this check, use the submitted order’s actual values, including the sell and buy tokens, amounts, receiver, expiry, and app data.

How do you verify an ERC-1271 signature?

Call the wallet contract’s isValidSignature(bytes32,bytes) function with the order digest and signature. Run the call on the order’s chain, using the wallet address as the contract being queried; a valid response is the four-byte magic value 0x1626ba7e.

A read-only call does not submit a transaction or spend gas. It checks the wallet’s current validation logic and state. A result that differs from the magic value means the wallet did not validate that digest and signature in the state used for the call.

Which details should you compare?

Before treating the result as a match, compare the order shown by the signing flow with the order sent for verification. A valid signature over a different digest does not authorize the order you intend to submit.

  • Confirm the chain ID and settlement contract used to build the domain.
  • Recompute the digest from the precise order fields, including expiry and app data.
  • Check that the order owner and from address identify the contract wallet.
  • Pass the exact signature bytes and digest to that wallet’s ERC-1271 method.

Can a valid signature later fail?

Yes. ERC-1271 validation can depend on the wallet’s current owners, modules, or other contract state, so a signature that passes now may fail later if that state changes. For CoW Protocol, the signature is checked as part of order validation and again during settlement; a local check is useful evidence, not a guarantee of later execution.

The practical test is specific: rebuild the digest from the intended order and network, then call ERC-1271 on the owner wallet and check for the magic value.