Gone are the days when all the action was happening just on the Ethereum mainnet.
With the proliferation of EVM networks, many interesting projects are launching straight on those chains to benefit from lower fees and faster transactions. So by now, you’re probably used to bridging.
Did you know you can also bridge and swap in the same transaction? That’s also known as cross-chain swaps. In this post, we’ll explain how cross chain swaps work and how they can help you move faster.
The basics of cross chain swaps
Cross-chain swaps are onchain transactions in which you sell a token on one network and get another token on the other network.
This type of swap is crucial when you need to get a specific token on the destination network. For example, you might have only ETH but need some MATIC to pay for gas on Polygon. Or you might want to use USDC in some dapp on Arbitrum but have only DAI and USDT across various other chains.
With most bridges, you’d need to do 2 or even 3 transactions:
- Swap tokens on the origination network
- Bridge tokens
- Swap tokens on the destination network (if the bridge didn’t support the token you need)
With cross-chain swaps, you can do that in one transaction!
You simply interact with a protocol, sending it a token. The protocol then sends you another token on a different network. This way, you manage to save both your time and gas costs.
How cross cross-chain swap work
For you, cross-chain swaps are not much different from using a decentralized exchange. Connect a wallet and sign transactions. Boom, it’s done, all in a self-custodial way.
However, the swap happens on two networks:
- On your original network (e.g., Optimism), you transfer a token to a smart contract
- An address on the destination network (e.g., Base) sends another token to you.
Depending on the speed of the networks, you might need to wait a few minutes or up to an hour for the second transaction to hit your wallet. (Don’t worry, it will get there!)
While only these ‘send’ and ‘receive’ will appear in your transaction history, a lot of stuff happens in between.
Under the hood, cross-chain swaps use a combination of DEXes and bridges, connected through smart contracts and back-end engines. This aggregation work is done by interoperability protocols like Socket.
Socket has done the hard work of bringing together liquidity (i.e., money) and data from across 15 different bridges that serve the wider Ethereum ecosystem. Socket effectively lets other dapps build their own bridges and embed them with other services.
Socket powers cross-chain swaps for both Zerion and Matcha, finding the best routes for swapping and bridging in one go.
Swap with Zerion
With Zerion, you can bridge and swap in the same transaction.
- Select the token that you want to sell and the network
- Select the token that you want to get and the network where you want to
- Sign transactions
You can do cross-chain swaps right in Zerion Wallet on mobile. Or you can connect your browser extension to the Zerion web app, which is also great for portfolio tracking.
Zerion charges a 0.5% fee for each swap unless you hold a Premium Zerion DNA (then it’s always 0%). You might need to pay some additional fees charged by the bridge.
Swap with Matcha
Matcha, a DEX aggregator by 0x, is another platform that lets you easily swap cross-chain using Socket, and benefit from the aggregated liquidity of 100s of DEXs combined.
- Select the token that you want to sell and the network
- Select the token that you want to buy and the network where you want it
- Sign the transactions
With Matcha, you can also set limit orders as opposed to market orders (swaps), which lets you choose a specific price for your trade to execute at, similar to how it works on centralized exchanges.
Matcha has two modes: free Standard swaps and Matcha Auto for a 0.15% fee, where transactions are faster, you get MEV protection, and Matcha handles the gas. Again, you might also need to pay bridge fees, depending on your bridging route.
Conclusion
In this post, we reviewed how a cross chain swap works in practice and under the hood.
While the way the underlying set of smart contracts and back-ends works is complex, in practice, it’s not harder than using a DEX. The only unusual part is waiting for the second transaction to hit your wallet. But after a few swaps, you’ll see that it’s not that scary.
Both Zerion and Matcha enable you to save time and gas and bridge in an easy and self-custodial way.