Cross Chain CoWs: CoW^3

Cross Chain CoWs - CoW^3

Introduction

This post opens the initial discussion for an ambitious project to make CowSwap cross-chain. On-chain trading is rapidly becoming multi-chain. Currently, tokens are traded on many different networks in silos. CowSwap has up till now made the multi-chain efforts isolated as well, where the Ethereum and Gnosis Chain deployments are not connecting liquidity. As people are constantly bridging between various networks, there is an opportunity to find and service many more CoWs.


ChatGPT prompt: create a picture with the caption: Cross chain cows

Cross Chain Cow examples

Perfect 1-1 CoW without swaps

The simplest example of a cross-chain coincidence of wants is the following:
User A: Has 100 Dai on Ethereum Mainnet, and wants to use that on Gnosis chain
User B: Has 100 Dai on Gnosis Chain, and wants to use that on Ethereum Mainnet

Imgur

Currently this means both users need to bridge from their respective networks to the other. When both of these users use Cross Chain CowSwap, these would both just be routed to transfer their Dai on their chain to the other user.

As can be seen in the above example, this would save 2 transactions, meaning ±50% of the gas cost. CoW DAO could decide to take a part of the savings in comparison to the bridging as revenue.

Perfect triangle without swaps

A slightly more advanced version of this is where there are three users, that can be combined into a coincidence of wants too:

User A: Has 100 Dai on Ethereum Mainnet, and wants to use that on Gnosis chain
User B: Has 100 Dai on Gnosis Chain, and wants to use that on Optimism
User C: Has 100 Dai on Optimism, and wants to use that on Ethereum Mainnet

Imgur

This would again save 50% in transactions (6 → 3), so potentially up to 50% gas savings too!

Perfect 1-1 with swaps

Cross Chain Cows can also work to take advantage of users that would like to swap & bridge at the same time.
For example:

User A: Has 100 Dai on Ethereum Mainnet, and wants to get 0.05 ETH on Gnosis chain
User B: Has 0.5 ETH on Gnosis Chain, and wants to get 100 Dai on Ethereum Mainnet

The swapping transactions can be seen as additional order flow into the Cowswap deployments on those respective chains.

What if no perfect CoW can be found?

Just like regular CoWSwap, if no perfect CoW can be found, then that order will be done through a regular bridge, and users will just not get the additional benefit of the CoW, but they will still get same price execution as they would have if they would have used a bridge directly.

Cross-Chain Security Options

This all may sound great, but it has to be secure in order to be usable. If the Cross chain cow protocol has made a transaction on Mainnet to move funds from User A to User B, then the opposite transaction MUST be included in the other chain, and be final.

Luckily, many projects have already made solutions for this. Here are a couple of options (this would need a lot more research before implementation):

1: Insure in-transit tokens, with liquidity provision

Let Liquidity providers take the risk of cross chain failures, and let them put up collateral that would be used throughout the protocol. The advantage of this form of liquidity provision is that users would be able to always get a CoW.

2: Use Maker style fast confirmations

MakerDAO’s teleport (on halt at the moment) project allowed fast withdrawals of Dai. They were able to do this, as they are the minting facility of DAI. A similar token set-up could be created to enable the cross chain security of the CoW^3

3: Use Chain link’s CCIP

Chainlink has a cross chain interoperability protocol. Not sure if this would suit that protocol exactly, but it should be looked into.

Discussion

In general I think that some project will try to accomplish something like this, I personally just think CoW Protocol is well suited to fullfill this role, as it would fit its mission well. So I ask the community:

  1. Does this interest the CoW DAO?
  2. What would the community like to see before moving something like this into implementation?
2 Likes

Enabling cross chain Coincident of Wants is super interesting! However, it will need to be reviewed by a member of the technical team to assess security risks.

1 Like

I think having this discussion is great, I def see the immense opportunity with enabling cross chain CoWs.

This post does mention the security challenge but doesn’t add a lot of detail or practical solution proposal.
This is where IMO lies the main challenge.
Different blockchain networks are finalizing transactions at different cadence and provide different security assumptions.
Batching multiple swaps and cross chain bridging actions on several networks is extremely complex given that some parts of the batch might fail to execute.
A batch being partially-executed is something that cannot happen in the existing design of CoW Protocol.
Proposing ideas for this problem is crucial for having a concrete discussion about a potential “Cross-Chain CoW”

3 Likes

I agree that that is indeed the main challenge. The reason I did not go into too much detail yet is that (1) - I currently know too little of the inner design of the CoW protocol to comment, and (2) - I don’t know if there already are plans/preferences of these types of solutions.

Although it is a difficult problem, I don’t think it is unsolvable. Every solution will likely have trade-offs, so I think the CoW DAO should express some preference regarding:

  • Speed of finalization
  • Complete control of the solution (building in-house vs using something built by others)
  • Is capturing revenue important for cross chain cows?
  • Should the ideal solution need liquidity providers, or not?

These would form the constraints to which potential solutions can then be crafted.

Generally, a super interesting topic where efforts shall be dedicated to. However, I also think the community should define whether cross-chain means EVM chains or also non-EVM chains. Thorchain / Chainflip (even more elegantly) already solved the non-EVM chain cross-chain swap with a solver like structure. Maybe partnering / integrating with those solutions is also an interesting solution instead of re-inventing the wheel.