Cross-Chain Bridging with Yacht Lit Swap
February 17, 2023
Video Demonstration of Yacht Lit Swap App
PKP from video on Ethereum PKP from video on Polygon
At Yacht labs, our focus is on building decentralized products that are as easy to use and as feature rich as centralized ones. For instance, moving liquidity between different chains is still hard to do without relying on a centralized custodian. Right now the easiest way to swap assets between chains is to send your coins to a centralized exchange and take advantage of their deep liquidity on a variety of chains and tokens. Although this might be easy from a user experience perspective, it sacrifices the decentralized security and anonymity inherent in blockchain technology. You have to relinquish control of your assets with no technical guarantee that they can ever be returned, and your funds are regularly locked up while you complete long KYC verifications.
To help solve the issue of decentralized cross chain asset exchanges, we’ve been working with Lit Protocol and their decentralized key management network. It’s 2023, and transferring assets across chains should be trustless, verifiable, and instantaneous. Fortunately, Lit Protocol’s Programmable Key Pairs and Lit Actions bring us one step closer to that goal.
Lit Protocol uses threshold cryptography to generate private key shares amongst the nodes in its network, with each node having no knowledge of the others’ data. These private keys function just like the ones we’re used to and can be used to generate public addresses on the blockchain and sign any transaction, whether that be sending tokens or interacting with a smart contract. The nodes in the Lit network can recombine their shares to sign a transaction without ever coordinating to learn each others’ shares. But how does threshold cryptography and multiparty computation (MPC) enable cross chain interactions?
Given that we can verify data on-chain and use a Lit key pair to sign transactions, we open up a world of possibilities when it comes to cross chain interactions. If we generate a PKP and write some code to check the balance of its public address, we can develop an escrow service where two parties both send assets to the PKP address. Then the Lit network can generate two transactions sending the respective tokens to each counterparty. This becomes a trustless, decentralized and near instantaneous swap of assets between chains. The moment that the PKP verifies that it has the required balance of the two tokens on both chains, the swap can be completed. No more waiting for optimistic rollups or hoping your exchange’s KYC goes through. Just decide on a price, send your assets to the PKP, and you’re good to go.
We have developed an open source SDK that makes it possible to integrate these exchanges within an application: https://github.com/Yacht-Labs/yacht-lit-sdk. Check out our documentation which gives an overview of the technology and describes our logic for determining whether or not users have sent their tokens to the PKP address and for ideas on implementing it within your own application.
Currently, you’ll need to know who the other counterparty is before you create the Lit Action code to generate the swap transactions. In a future iteration, it would be possible to develop a cross chain orderbook, with users creating bids for tokens to swap for. A liquidity provider could take bids and facilitate the exchanges, enabling users to not have to find a counterparty themselves.
We’re also very excited about the possibility of adding Bitcoin support to the Lit network. With Bitcoin MPC signing, we enable a rare, instantaneous bridge between BTC, EVM, and Cosmos chains. Stay tuned for more developments!
We’re always looking for new technologies that can make users’ interactions with blockchains more secure and easier to use. Follow us at @yacht_labs on twitter and check out our website at www.yachtlabs.io