stacksgov / grants-program

Welcome to the Stacks Foundation Grant Program. Community members interested in submitting a grant proposal may do so by opening an issue in this repository and filling out the grant application.
140 stars 36 forks source link

Lava: Borrowing, DLCs, and unlocking bitcoin functionality #319

Closed shehzanmaredia closed 1 year ago

shehzanmaredia commented 2 years ago

Background


James Taylor and I, Shehzan Maredia, started working on projects together since we first met freshman year at Duke studying computer science and mathematics. Both of us were reading about freedom, finance, privacy, and security from an early age, and our interests led us to bitcoin. As we explored the global financial system, we realized that in its current state, it is natively unfair and entrenches wealth inequality while depleting people of sovereignty and privacy. After understanding the problems of the current fiat system and exploring solutions, we came to the conclusion that bitcoin is the best monetary asset for a fair financial system as it enables people to not only store their value but also gain privacy, sovereignty, and security (link here on why we believe Bitcoin is the best money: https://www.notion.so/Argument-for-bitcoin-d1d60d7b421440aca3315e85af6e7dc3).

As we dived into the current solutions enabling people to use bitcoin for their financial needs, we realized that currently, users have to give up custody and trust institutions to achieve most of their financial needs using bitcoin. Whereas users in other blockchain ecosystems are able to achieve financial primitives on their native tokens without going directly to institutions, bitcoiners are given few solutions.

We believe a holistic, trust-minimized financial experience must be delivered for bitcoin to create an anti-fragile, fair financial system that works for people. To do so, we must bring more functionality to bitcoin, and we are focusing on building just that.

Problem


It is difficult and generally impossible for users today to experience financial primitives on their bitcoin without giving up trust and privacy.

What We Are Building


Lava is one of the first teams working on bringing functionality to bitcoin by working with Discreet Log Contracts (DLCs). Currently, we are focusing on building native-BTC borrowing by letting people lock-up bitcoin as collateral on bitcoin L1 contract and borrow assets that can live on any other chain (Stacks). Imagine borrowing Stablecoins on Stacks/Citycoins against bitcoin as collateral.

We are building open-source tech that can help users borrow assets against bitcoin as collateral, and we are also contributing to helping build out an open-source DLC library. With Lava, we want to help people understand what can be built on bitcoin and inspire others to build more on bitcoin.

Borrowing for Bitcoin


The terms for bitcoin borrowing work similarly to how they work on Aave/Compound. A user locks up bitcoin in a DLC, and they borrow an asset (for ex. USDC). With the DLC, all possible outcomes are enumerate ahead of time, and the outcomes that are possible are liquidation, loan repayment, and loan termination.

If the bitcoin price drops significantly and the LTV is less than the threshold (1.1), the oracle’s attestation enables the lender to redeem their initial loan + interest owed. In this system, it is important to note that unlike centralized systems, the lender can not confiscate the user’s collateral unless the LTV is below the threshold.

The user can also choose to repay the loan ahead of time. The terms to the loan are fixed and time-capped. If the user wants to repay the loan, they can repay it, and the smart contract they pay the loan to will reveal a pre-image to a hash that the user can then use to redeem their initial collateral completely.

In terms of loan termination, if the loan term is coming to an end and the user has not paid any interest, the lender will be able to redeem their initial principal + interest owed based on the price of bitcoin at loan termination. The user will be able to redeem the rest of their collateral.

By using DLCs, we can create a borrowing system that is significantly more transparent between the two counter-parties. The SEC lawsuit on BlockFi illustrates the lack of transparency present within centralized systems. DLCs are completely transparent, but they are also private from bitcoin miners/network. They are also fully secured by bitcoin and only use native-BTC.

Scope


Borrowing against bitcoin enables a whole set of applications for bitcoin and Stacks. Users can now borrow any assets against bitcoin as collateral, and this is particularly useful as bitcoin monetizes as money. Bitcoin is currently in its SoV phase where spending bitcoin on day-to-day transactions makes little sense. It is volatile, not widely accepted, and has tax implications. Borrowing enables people to retain price exposure to bitcoin, the world’s best money, while also holding other assets (ex. stablecoins) that they can use to spend for day-to-day transactions. One could imagine MiamiCoin for example being used as a local fiat-currency that is price-stable for money, and users could borrow MiamiCoin against BTC while minimizing trust. This unleashes a whole set of applications that help us progress to creating a trust-minimized, decentralized financial system.

Lava’s open-source code and library also helps others understand what can be done with bitcoin and build a whole set of applications that we can not imagine today. This fits in quite well with the vision of the recent Stacks grant to DLC.link.

Deliverables, Budget, and Milestones


Total Grant Request: $250,000

Our deliverables are:

  1. Build the core functionality to borrow against native-BTC

    1. Work with bitcoin strict to make the contract maker
    2. Work with current oracle providers to receive attestations on bitcoin price feed
    3. Ensure that contract be trustless initiated via atomic swaps
    4. Build contract for repayment
    5. Create documentation for users on how to receive their collateral/pay their loan in the case Lava ever shut down

    Total grant requested: $75,000

  2. Design an app that any user can use to borrow against bitcoin

    1. Design screens for app
    2. Test with community to make sure UX is simple and intuitive

    Total grant requested: $25,000

  3. Build an app that enables people to simply borrow against bitcoin

    1. Work to implement the app in React-Native using designs
    2. Interact with core systems in Rust

    Total grant requested: $75,000

  4. Create open-source code that others can use to understand and build more with DLCs.

    1. Write great documentation about Lava’s current code
    2. Make sure code is verifiable

    Total grant requested: $5,000

  5. Help contribute to developing an open-source library to easily build DLC applications

    1. Work to make sure people can easily build DLC applications. bitcoin is hard.
    2. Create documentation that makes it easier for people to understand bitcoin
    3. Create resources that explain to people how DLCs work and how to program them

    Total grant requested: $45,000

  6. Further Research how DLCs can be used to make bitcoin programmable money

    1. Analyze possibilities for DLCs
    2. Create documentation explaining what can be done with DLCs and how
    3. Offer suggestions to improve state of DLC/bitcoin infrastructure today

    Total grant requested: $25,000

We request a payment schedule of (5) $45k payments + (1) $25k final payment

Our deliverable is a functioning borrowing product, an app that any user can use to borrow against bitcoin, and open-source code that others can use to understand and build more with DLCs.

Community and Supporting Materials


All Information and Deliverables will be available on Lava’s github. We will also open a channel on Stacks Discord for questions/concerns/comments.

Risks


We are confident that the borrowing product can be built, and we are working on building it today. In terms of risks we see, we think that with our product, similar to the crypto space in general, regulation can hinder progress. Governments can do much to hurt bitcoin and Lava, and our goal is to work with the community to make sure that we can build products that help the people and help the government understand how these products are helping their citizens.

We also see technical risk as being an issue for Lava. Anytime we are dealing with money, there are risks of losing funds. However, bitcoin’s limited expressivity actually limits the surface area for exploits, and the off-chain contracts Lava uses help minimize the risk for exploits as the contracts are totally private from the bitcoin network. They are simply transparent between the two counter-parties. This significantly reduces the possibilities for exploits.

Team


Shehzan and James have been working together ever since they met at Duke studying math and computer science. More information on their background can be found here here:

Shehzan Maredia: (https://www.linkedin.com/in/shehzan-maredia314/) James Taylor: (https://www.linkedin.com/in/jamesetaylor3/)

stx-grant-bot[bot] commented 2 years ago

Thanks for submitting a grant proposal. Our team will review your submission and get back to you.

Akibalogh commented 2 years ago

We (DLC.link) initially met Lava through the DLC community and we've had several great discussions since. Shehzan and James are very credible and have clearly given their app a lot of thought. They're building unique, differentiated technology, and learnings from this project will help further bridge the gap between native BTC and STX. Lava is also a great testbed for DLC tech as well, so it's an ideal use case as we explore what's possible (with and without using xBTC). This app targets a very large market and their participation in Stacks would attract more Bitcoiners to Stacks.

shehzanmaredia commented 2 years ago

Thanks for your support @Akibalogh

diopitis commented 2 years ago

Wow this is a great proposal and trustless borrowing using BTC as collateral is really promising! For your milestones what do you estimate to be your timeline?

shehzanmaredia commented 2 years ago

We estimate milestone 1 to take ~3 months, including time to debug and fix any issues. Milestone 2 (Designing) should take 1-2 months, and Milestone 3 (implementing the wallet) should take around 2-3 months. Milestone 4 and 5 (Contributing to the library) will happen throughout the process but will be happening for around 5-6 months. Milestone 6 (research) should be ~1-2 months.

will-corcoran commented 2 years ago

@shehzanmaredia per our call right now please revise the application to note the three following items:

  1. Revise the payment schedule (5) $45k payments + (1) $25k final payment
  2. Indicate the majority of the code will be open source
  3. Indicate the intention is for this to yield a mobile-first product

See you Friday! Very excited!

shehzanmaredia commented 2 years ago

Done, talk to you all soon.

tycho1212 commented 2 years ago

I've met Shehzan on multiple occasions - he has deep knowledge of DLCs and the Bitcoin dev ecosystem. Getting this app live with most of its code open source would be very meaningful in helping more people build on Bitcoin

shehzanmaredia commented 2 years ago

Thanks for the support Tycho

GinaAbrams commented 2 years ago

+1 Lava is one of few companies at the forefront of Bitcoin development with a team that's well equipped to bring new capabilities to Bitcoin. Would love to see this project go live and pave the way for new functionality to Bitcoin + Stacks alike. 🌋

shehzanmaredia commented 2 years ago

Thanks for your support @GinaAbrams

pseudozach commented 2 years ago

Hi, This looks very interesting, I'm not an expert in DLCs but I would love to see new tools built around it so we can integrate it.

A few questions: Is your app similar to atomic.finance and if not what are the differences? What will you be building that is different to existing DLC libraries? e.g. https://github.com/AtomicFinance/node-dlc or rust implementation here: https://github.com/p2pderivatives/rust-dlc ? From what I can tell DLC spec is (mostly) implemented including listing and accepting offers. Have you considered forking them or contributing to them to reduce scope so you can build the app directly? The missing piece seems to be a marketplace which I think your app will do.

Regarding oracles, you only mention you'll integrate with existing ones (afaik there's only suredbits now), so I'm understanding you will not build/maintain any oracles? How about a generic oracle attestation wrapper such that any public feed can be used in DLCs?

Thanks, looking forward to the cool stuff you'll be building,

shehzanmaredia commented 2 years ago

Great questions. I will answer them here.

Is your app similar to atomic.finance and if not what are the differences?

Atomic.finance is a great team, but they are working on something completely different, selling puts/calls against your bitcoin position. Our project focuses on different financial primitives and also interacts with DLCs that have different constraints (we work with assets on other chains and contracts with multiple possible outputs).

What will you be building that is different to existing DLC libraries? e.g. https://github.com/AtomicFinance/node-dlc or rust implementation here: https://github.com/p2pderivatives/rust-dlc ? From what I can tell DLC spec is (mostly) implemented including listing and accepting offers. Have you considered forking them or contributing to them to reduce scope so you can build the app directly? The missing piece seems to be a marketplace which I think your app will do.

Yes, we've checked out both of these libraries, and we are in communication with Tibo from rust-dlc. We will be working to help contribute to rust-dlc, but we also want to do more. If you look at the former 2 libraries, they are not intended for building contracts that interact with the constraints above (interact with different outputs, assets on other chains, etc.). We also think there are other resources/papers that can be created to better understand bitcoin script/DLCs/working with bitcoin.

Regarding oracles, you only mention you'll integrate with existing ones (afaik there's only suredbits now), so I'm understanding you will not build/maintain any oracles? How about a generic oracle attestation wrapper such that any public feed can be used in DLCs?

We don't want to build our own oracles because there is a conflict of interest there. We will work with Suredbits, DLC.link, and any other team working in the space. We are also talking to companies/exchanges who are interested as well in participating. If you're interested in learning more about solutions to oracles, please reach out as well because we have some ideas here and would love to support/help people who want to work on solving certain problems in the space today.

Let me know if this helps. Feel free to reach out with more questions.

Thanks for your time

will-corcoran commented 2 years ago

@shehzanmaredia and James. Thanks for the application and for presenting yesterday. This is such an exciting project! The grant is approved - with the revise the payment schedule (5) $45k payments + (1) $25k final payment. Congrats! I will reach out via email about setting up a monthly progress review call. Also, I want to connect you with Albert who is starting a Stacks Pre-Accelerator.

stx-grant-bot[bot] commented 2 years ago

Congratulations. Your grant is now approved. Please complete the on-boarding link here: https://grants.stacks.org/onboard?q=d7fff1123f1359f2b8ca2c5bdf956186

shehzanmaredia commented 2 years ago

Thank you so much. Just finished the on-boarding link.

Very happy to have everyone's support. Thanks again.

will-corcoran commented 2 years ago

Hello and thank you for participating in the Stacks Foundation Grants Program!

We are in the process of migrating from GitHub to the new Grants Dashboard. In order to complete your grant, you will need to submit any remaining Progress Review and/or Final Review requests through the Dashboard in order to receive your remaining payments.

Lastly, please note we are marking this grant 'closed' on GitHub for organizational purposes, but it is still 'open' on the Grants Dashboard.

Thanks and we hope to continue to support your efforts with additional grants!

Best, Will

Hero-Gamer commented 1 year ago

Hi @shehzanmaredia @will-at-stacks How can we follow the progress on this grant? There has not been much communication re grant progression? Would love to hear more from a big grant like this.

Thanks

will-corcoran commented 1 year ago

@Hero-Gamer the team hit some roadblocks with liquidity providooors and felt the best thing to do would be to halt work on the grant and not collect the remaining funds. This happened about 12 mos ago. Sorry for not posting an update here. Thanks for asking.

Hi @shehzanmaredia @will-at-stacks How can we follow the progress on this grant? There has not been much communication re grant progression? Would love to hear more from a big grant like this.

Thanks