Closed hankminden closed 2 years ago
Sorry just came across this thread, but @hankminden just wanna say I got the same quote as you do in my social media "Make things as simple as possible, but no simpler" :)))))
@hankminden I really enjoyed reading your proposal and a few questions from the team:
As the team is building this SDK, would you be able to provide an application or demo of how someone might utilize what you're building? We would love to see POCs of the work in order to educate people on how to use your tool. I also noticed that Yacht Labs has its own DeFi application, would this SDK be used within your application?
Thanks @debbly I'm glad you enjoyed it. We do plan on integrating this SDK directly into our app, so that would probably be the most helpful POC. The goal would be to start the integration in parallel so that as we submit the final milestone we would also have a working implementation in our mobile app. We're happy to open source the mobile implementation for community education and benefit.
Of course, we will also be writing unit tests so that as we are building we can demonstrate incremental functionality as we submit PRs for each module.
@yayashuxue cool! It's a good mantra to live/code by ;)
@hankminden at this point, Lit is able to support up to $10k to build the initial infrastructure and we can work with you to get additional funding (either through venture capital or additional grants). Let me know what you think and here is my calendar to schedule some time to get on a call!
approving this grant and moving on communication to telegram and email.
Open Grant Proposal:
SDK for Cross-Chain Swaps with PKPs
Name of Project: Lit Yacht Cross-Chain Swaps
Proposal Category:
devtool-library
Proposers:
hankminden
&&a-straus
Do you agree to open source all work you do on behalf of this grant and dual-license under MIT, APACHE2, or GPL licenses?: Yes
Project Description
Problem
As many new L1 and L2 chains arise to meet the demand for blockspace and specialized execution environments, the problem of inter-chain communication has yet to be conclusively solved. Many cross-chain bridging solutions have been developed to facilitate asset swaps between chains, however they are notoriously vulnerable to attacks as evidenced by the explosion of bridge hacks in 2022.
Fig 1: Bridge Hacks in 2022 Source: CNBC and Elliptic
Compounding this issue, these bridges rely on the “vault-mint/burn-redeem” pattern, which gives users a synthetic token on the destination chain representing the original asset they are bridging over. This synthetic token is backed by the real asset the user deposited in a vault on the origin side. This presents two major issues:
Solution
We propose a novel cross-chain swapping solution that will utilize Lit protocol as a cross-chain messaging layer, enabling users to trustlessly swap their assets across different Lit-enabled blockchain protocols. Users will receive actual assets, not synthetic ones, on the destination side of the swap. The solution uses PKPs with immutable Lit Actions to act as a decentralized messaging agent that will securely execute the swap. This scheme will provide enhanced security over centralized bridges: there is no honeypot of pooled liquidity and much less potential for a bad internal actor to rug funds from the pool.
Value
When executed successfully, this project will provide value for users looking to safely swap assets across blockchains. Since it would allow for native assets to be used on both source and destination chains, it solves the liquidity fragmentation and counterparty risk problems mentioned above. Since this scheme would only need to wait for enough block confirmations to ensure there was not a chain reorg, swaps would resolve in mere minutes as opposed to the week-long lead times of some optimistic bridges.
This value creation for the end user will create value for the Lit protocol as well. Each swap will require a unique PKP to be created, increasing the use of the protocol and fees generated. By providing an open source swap SDK, we will encourage other developers to implement and innovate (fork) cross-chain swaps with Lit.
One challenge with this project will be accumulating enough liquidity to ensure users’ swap orders are filled quickly. Even if the swap system works perfectly from a technical perspective, if there is not adequate liquidity on the chains and assets which users are interested in swapping, users will get frustrated and abandon the system. One solution to this would be to implement an off-chain order book that would aggregate requests to swap (orders) and could route large orders through multiple counter-parties, similarly to how a CEX operates.
Another solution to the liquidity problem would be to implement liquidity pools on multiple chains and incentivize users to provide liquidity by sharing the swap fees with them, similar to other AMMs and bridges. Implementing this would likely result in more liquidity accumulation, but would require additional research to design and implement.
Because this swap system would be transmitting real valuable assets, security is a primary concern. The code would need to be diligently reviewed and potentially undergo an external audit to ensure no latent vulnerabilities exist. There also exists inherent protocol risk: if there was some failure mode that caused the PKP to be compromised, the swap system would also be vulnerable.
Deliverables
We propose the development of a modular SDK that will provide developers all of the required building blocks to implement a cross-chain swap of ERC20 tokens. For the scope of this grant, we will enable swaps on any Lit-enabled EVM compatible network, although architecturally it will be possible to extend the SDK to function on the Bitcoin, Cosmos, and Solana networks (as well as any future networks supported by the Lit Protocol). It will also be possible to extend the SDK to enable NFT, native asset swaps, or arbitrary message signing. The SDK will contain public functions to construct and deploy the Lit Action and PKP necessary for the swap. We will provide full documentation and code examples for community benefit.
Below is an architecture diagram that describes the swap process in more detail. Additionally, we break down the individual SDK modules in the development roadmap below.
Fig 2: Proposed System Architecture
Development Roadmap
Milestone 1: Complete Transaction Factory Module
1 Week 2 Fullstack Devs $3,000
This module is responsible for creating the unsigned transactions that need to be signed in order to execute the swap between the counter-parties (steps 7 and 8 in the diagram). It will expose a method in the SDK that takes the destination address, chain id, amount, and ERC20 contract address as parameters and returns an unsigned transaction that will be used to create the Lit Action.
Milestone 2: Complete Swap Lit Action Factory Module
1 Week 2 Fullstack Devs $3,000
This module is responsible for creating the Lit Action needed to execute the swap (step 2 in the diagram). It will take in all of the parameters needed to build the transactions as well as the time interval where the swap will be considered valid. If either counter-party fails to complete their side of the swap in the time interval, the assets can be returned to the counter-party that did. This module returns text ready to be written to IPFS.
This uses the Transaction Factory Module to build the necessary Lit Actions.
Milestone 3: Complete Lit Action + PKP Deployer Module
1 Week 2 Fullstack Devs $3,000
This module is responsible for writing the Lit Action to IPFS and creating a PKP using the mint/grant/burn pattern (step 3 in the diagram). The Lit Action that defines the swap will be granted to said PKP. When successful this module returns a promise to return either a PKP ID or a detailed error message. (success, PKP_ID?, error?)
Milestone 4: Integration Testing and Documentation
3 days 2 Fullstack Devs $1,000
This milestone will involve bringing all of the modules together to demonstrate cross-chain swaps in action. We will provide the necessary client-side code to execute a swap with code examples. Additionally, we will provide video documentation of swaps on testnet and deliver a gitbook documenting the SDK sufficiently so that a person unfamiliar with the project could implement the SDK in their project.
Total Budget Requested
Total Budget Requested: $10,000 USD
This development effort will require full-time commitment from our team to ensure delivery of a robust, secure system with full test coverage. These funds will be used to compensate the team for the development.
Maintenance and Upgrade Plans
Yacht Labs is a team of software engineers dedicated to developing open source blockchain technologies. We intend to develop the Lit Protocol cross-chain swap SDK for all developers to use and also intend to implement it within our own interfaces as we build our own cross-chain decentralized infrastructure and interfaces. Because we will develop and use the SDK ourselves, we will continue to maintain and improve it over time as required. We plan on extending the SDK to support additional networks and chains, and would contribute these to the community. Minor upgrades and bug fixes will be pushed out regularly, and if it is determined that a major release is necessary we will remain in communication with the Lit Protocol team to determine the best way to support the development of the SDK.
Team
Henry Minden brings 11 years of software engineering and management experience to the Yacht team. In 2017, Henry founded Constellation (DAG) which raised $33 million in Q1 2018 and reached a $1B market cap in 2021. Since founding Constellation he has been mastering the practice of mobile development, helping several companies build award-winning apps such as Upkept and Happier. Armed with deep insider knowledge of mobile development and crypto, Henry joined forces with Adam to form Yacht.
Adam Straus has seven years of engineering experience including fullstack and devops and was a cofounder of Stone Road Farms, a lifestyle cannabis brand that has received numerous awards for brand strategy. While there he developed their mobile app around a consumer rewards experience to increase brand stickiness. As a longtime DeFi investor, in 2021 he decided that it wasn’t enough to just invest in the crypto space: it was time to build a tool that would bring more users into the ecosystem.
Team Member LinkedIn Profiles
Henry Minden Adam Straus
Team Website
Yacht Labs
Relevant Experience
Our team has nearly 20 years of combined engineering experience including Henry Minden’s time developing the novel L1 Constellation protocol. We are steeped in decentralized infrastructure and have developed code for native DeFi mobile interactions, hardware wallet integrations and a proof of concept vault-mint/burn-redeem type bridging service (Aurora <-> Ethereum). We were recently awarded a grant from Euler Finance to develop a mobile interface for their lending protocol. We are the right team to build this project because we are dedicated to continuing DeFi development and want to integrate our work with this SDK into our won user facing products.
Team code repositories
Yacht Labs Team Github Some of our more relevant blockchain repositories have not yet been open sourced but we are happy to provide access upon request.
Additional Information
How did you learn about the Lit Open Grants Program? Through David Sneider, connected through Figment Inc.
Contact
henry@yachtlabs.io