not approved
P2P-DeFi Protocols
Current Project Status
Unfunded
Amount
Received
₳0
Amount
Requested
₳483,600
Percentage
Received
0.00%
Solution

We propose a family of radically permissionless and composable p2p-DeFi protocols that forgo reliance on permissioned off-chain software, in favor of p2p-driven liquidity and price discovery.

Problem

Current DeFi protocols lack composability and rely on a variety of centralized actors (i.e. oracles, batchers). Such resilience/availability risks are unsuitable for an alternative financial system.

Impact / Alignment
Feasibility
Value for money

Team

2 members

P2P-DeFi Protocols

Please describe your proposed solution.

Decentralized Finance (DeFi) has long sought to provide an alternative financial platform for the disenfranchised or underbanked peoples of the world. Although DeFi has come a long way, it still suffers from issues that mostly stem from the same critical tradeoff: permissioned actors.

<u>Availability/Resilience</u>

An alternative financial system will likely be perceived as a threat by those in positions of high (legacy) power, who may employ a variety of regulatory or cyber-offensive tactics to disrupt it. To resist such disruptions, DeFi protocols must strive to maintain rigorous security and availability guarantees, ideally as much as the underlying blockchain. Although many DeFi protocols offer reasonable security guarantees, the same cannot be said for availability:

  1. Most DeFi protocols rely on a permissioned set of batchers/arbitragers/aggregators for liquidity. Such actors are at a high risk of denial-of-service (DOS) attacks, and are thus single-points of failure. This is doubly true for protocols that rely on oracles for external price feeds, where DOS and oracle collusion/corruption are significant attack vectors.
  2. Governance of permissioned actors is a complex and nuanced topic: who decides who gets to be a batcher or oracle provider? How are they compensated? If the answer is DAOs and dApp tokens, the result is a pandora's box of technical, economic, and regulatory concerns. Decentralized governance is a messy topic, and should be simplified or minimized whenever possible.

This project solves the availability concern by forgoing reliance on off-chain information in favor of endogenous price discovery and NFT-mediated indexing.

<u>Custody and Composability</u>

Efficient use of (limited) transaction space is critical to scaling decentralized protocols. A key idea here is that simple pieces of logic can be composed with one another, resulting in complex and expressive protocols. The trick is in designing these simple pieces holistically, such that they do in fact compose well with each other. Unfortunately, this is not so easy in practice, and is largely a consequence of - you guessed it - permissioned actors.

Since most DeFi applications are designed by separate teams and usually rely on separate aggregators/batchers/LPs, the resulting protocols are not easily composable. There may be some instances where composition is achievable through hacky/low-level transaction building, but this is far from an optimal solution. Additionally, permissioned actors must be incentivized, and are mostly done so through extra fees. These "protocol" fees are usually about an order of magnitude higher than the underlying transaction fee, which is less than ideal.

This project achieves composability by taking a holistic approach to eUTxO-based DeFi. The requirements of an entire financial stack are considered, and are balanced with the constraints of a fully p2p architecture. A key feature is that delegation control is never sacrificed.

How does your proposed solution address the challenge and what benefits will this bring to the Cardano ecosystem?

The P2P-DeFi Protocols project seeks to establish the basic building blocks of p2p finance on Cardano. it is a family of synergistically composable DeFi protocols with high security and availability guarantees. Currently, it is composed of four core protocols:

  1. Cardano-Swaps - a p2p-exchange protocol for swapping fungible tokens. It serves as the liquidity "base" for composition with the other three protocols.
  2. Cardano-Loans - a p2p-lending/borrowing protocol featuring trade-able "Bond" NFTs, on-chain loan term negotiations, and an on-chain credit history.
  3. Cardano-Options - a p2p-options protocol for writing, buying, and exercising (trade-able) American-style covered options contracts.
  4. Cardano-Secondary-Market - a p2p-aftermarket protocol for buying/selling NFTs, especially well suited for "Financial NFTs" (i.e. Bonds, Options, e.t.c.)

All four of these are already working prototypes. For more details on each protocol, please visit the respective Github repos linked above.

Here are some high-impact features shared by all four protocols:

  • Censorship Resistance - The protocols are fully peer-to-peer, 100% permissionless, and do not rely on any "specialized" oracle/batcher/indexing software. Since there are no special entities, there are no single points of failure, resulting in the lowest attack surface of any DeFi architecture. Assets are not only safe, but the protocols inherit the same availability guarantees as the Cardano blockchain itself.

  • Composability - The protocols are synergistic and highly composable with one another, especially from the buyer's perspective. For example, the output of a swap can be used as the input to purchase an (aftermarket) options contract, which itself can be used as an input to exercise the underlying option, all in one transaction. See here for a visual.

  • Full Custody - users always maintain complete spending and delegation control over their assets. The only exception is when locking is required to enforce protocol logic, which restricts spending (but never restricts staking). Since there are no special actors to incentivize, fees are about an order of magnitude lower than comparable protocols.

For a full list of features shared by all p2p-DeFi protocols, please refer to the broad overview document here. The scope of this proposal is to continue the development, documentation and peripheral support of the four protocols.

How do you intend to measure the success of your project?

Fee and Execution Benchmarking: The protocols' efficiency is measured by benchmarking transaction fees and CPU/memory usage. These metrics will be concisely tabulated for individual protocols, as well as for more complex compositions. Since transactions on Cardano have CPU/memory limits, lower resource utilization results in higher throughput and composability. Adding features while keeping resource usage at a minimum is a prime indicator of success.

Github Activity: Collectively, the four protocols already have 52 stars (and counting) on Github, and many accounts are following the development of the protocols. Some have even begun contributing to the project (i.e. Cardano-Loans Aiken reimplementation). An increasing number of engagements or collaborations on Github is an indicator of adoption and success.

Developer Adoption: This project has already inspired some developers to adopt/modify its design patterns for their own protocols (i.e. Val-U-Swap). As more outside projects make use of the protocols' design patterns, more developers will cooperate and coverage on best-practices or optimal design patterns. This too, is an indicator of adoption and success.

Community Feedback: Quantitative interest and qualitative feedback of the community is measurable on social channels like Twitter. Community feedback and support is key to the success of the project's vision.

Please describe your plans to share the outputs and results of your project?

Technical Documentation - As development proceeds, thorough technical documentation and changelogs for each of the four protocols will be continuously updated on Github. This will include:

  • Written explanations & pseudocode
  • Diagrams for visualizing control flow
  • Detailed feature discussions
  • Additional overarching documentation to discuss/standardize common design patterns shared by all four protocols.

Demos & Tutorials - User-friendly written and video tutorials will be created for each of the four protocols. They will start simple, where each protocol is used in isolation, and progress to more advanced demos where the protocols are composed with one another.

Design Standardization - Certain design patterns shared by all four protocols (i.e. Beacon Tokens) may be of independent interest to the broader community of eUTxO developers. Through further R&D, we may extract a generalizable pattern for such novel techniques and standardize them through the CIP process. These can also be published on existing developer repositories, such as the Cardano Developer Portal.

Social Media Outreach - Social media platforms like Twitter will be leveraged to announce progress updates, receive feedback, and engage with the community of users and developers.

In-Person Presentations - Presenting at Cardano-specific conferences or meetups is an excellent opportunity for real-time Q/A and feedback from a technical audience.

What is your capability to deliver your project with high levels of trust and accountability?

The team behind this project has already produced working prototypes for each of the four proposed protocols, and in doing so has attracted wide community support to continue their efforts. Up until now, development has been entirely self-funded.

Due to the fully open source nature of this project (and no "dApp"-specific tokens), there is no way for the team to profit directly, even upon widespread adoption. That being said, and considering the support for the team's accomplishments thus far, requesting community funds seems appropriate at this point in time.

We believe our track record is an adequate testament to our commitment and ability to execute on the project.

What are the main goals for the project and how will you validate if your approach is feasible?

Research & Development

Each of the four protocols are already working MVPs. They will continue to be refined/optimized, the specifics of which are discussed in the milestone section, below. The chief focus of our R&D and refactoring efforts is:

  • Lowering the protocols' CPU/memory utilization, thereby increasing throughput/composability
  • Minimizing minUTxO fees, thereby "bridging the gap" between shrimps and whales
  • Increasing querying "expressiveness" of Beacon Tokens, making it easier to filter on-chain data
  • Balancing the effects of new features with the imperative of the previous three points

Feasibility is validated through rigorous benchmarking of deposit and transaction fees, CPU/memory utilization, and number of Beacon queries. New features will never sacrifice the core properties of p2p-DeFi.

Unified CLI Program

A terminal-based interface will be developed to interact with the four protocols, and will serve as the minimum viable UI for early adopters. It will support using each protocol individually, composing transactions with multiple protocols, and querying beacon tokens via a pluggable API.

Feasibility is validated by ensuring all the protocols' functionalities are accessible through the CLI. User-friendliness based on community feedback.

Documentation & Support

Architectural decision-making and protocols' logic will be thoroughly documented to foster collaboration with a wider community of developers. Written and video tutorials will be created to help establish a user base. The feasibility of our approach will be validated by feedback from users and developers.

Please provide a detailed breakdown of your project’s milestones and each of the main tasks or activities to reach the milestone plus the expected timeline for the delivery.

Milestone 0: Preliminary Refinement (~8 weeks)

This is the time between proposal submission and voting results. It will be spent finalizing the next iteration of Cardano-Loans (here), creating an Architectural Decision Record (ADR) for each protocol, and updating the overview document to reflect the newly discovered commonalities. If this gets done in less than 8 weeks, the team will proceed with the following milestones ahead of schedule:

Milestone 1: Cardano-Swaps (~6 weeks)

  • Rearchitect the protocol to utilize "Offer-based" Beacon Policies
  • Implement refinements/optimizations, which are outlined here
  • Provide benchmarks for transactions involving the protocol
  • Update documentation to reflect changes
  • Create written and video tutorials to demonstrate use

Milestone 2: Cardano-Loans (~8 weeks)

  • Rearchitect the protocol to improve the expressiveness of beacon querying
  • Implement features/optimizations, which are outlined here
  • Provide benchmarks for transactions involving the protocol
  • Update documentation to reflect changes
  • Create written and video tutorials to demonstrate use

Milestone 3: Cardano-Options (~7 weeks)

  • Rewrite the protocol using Aiken
  • Implement features/optimizations, which are outlined here
  • Provide benchmarks for transactions involving the protocol
  • Update documentation to reflect changes
  • Create written and video tutorials to demonstrate use

Milestone 4: Cardano-Secondary-Market (~7 weeks)

  • Rewrite the protocol using Aiken
  • Implement features/optimizations, which are outlined here
  • Provide benchmarks for transactions involving the protocol
  • Update documentation to reflect changes
  • Create written and video tutorials to demonstrate use

Milestone 5: Unified CLI Program (~6 weeks)

  • Write a single CLI program that unifies the four protocols into one terminal-based interface.
  • Provide written & video tutorials to demonstrate use, plus advanced composition.
  • Provide benchmarks for complex transactions that compose multiple protocols

Note: the team may accomplish their milestones sooner than anticipated. This timeline was estimated liberally to ensure the team has the flexibility to explore novel eUTxO design patterns.

Future Directions (beyond the scope of this proposal):

  • Fund third-party security audits of the four protocols (once Aiken is stable)
  • Develop a browser-based frontend for enhanced UX
  • Additional features (i.e. revenue-swap contracts for Cardano-Loans - not to be confused with Cardano-Swaps)
  • Continue refining/optimizing the core protocols for efficiency

Please describe the deliverables, outputs and intended outcomes of each milestone.

<u>Deliverables/Outputs</u>

Completion of each milestone will be marked by the presence of:

  • Updated source code + changelogs
  • Contract Blueprints
  • Thorough Benchmarks
  • Detailed Documentation
  • Written + Video Tutorials

The final milestone will culminate with a unified CLI program capable of simple and complex (composed) transactions, and pluggable support for querying Beacon Tokens (via Blockfrost, Koios, or any API of the user's choice). Tutorials/demos will be provided.

<u>Intended Outcomes</u>

Milestones 1-4 will deliver refined versions of each protocol, along with thorough documentation detailing protocol logic, architectural decision-making, benchmarks, contract blueprints and tutorials/demos. The idea is to make every piece of this project as accessible as possible to users and developers alike, and to accelerate the exploration of novel eUTxO architectures.

Since the four core protocols are already working prototypes, the team is well positioned to focus its efforts on holistic deliverables: enhancing efficiency/composability, refining technical & support documents, and developing a unified CLI.

Please provide a detailed budget breakdown of the proposed work and resources.

Total Budget: $145,080 / 483,600 ADA (@ $0.30 per ADA) / 9 months

Note: 9 months includes 2 months between proposal submission and voting results, plus 7 months after voting results. The team will treat the two month interim as if they are funded, and will share their work accordingly.

Breakdown:

Full-time Protocol Architect & Developer: $65/hr x 1560 hours = $101,400

Full-time Technical Writer & Admin - $28/hr x 1560 hours = $43,680

Who is in the project team and what are their roles?

We are a two-man team based in the US:

@fallen-icarus: Protocol Architect and Lead Developer

After over two years' experience with PlutusTx and Aiken, fallen-icarus has developed a deep understanding of Cardano's eUTxO model. As a pioneer of the Beacon Token design pattern, he has a proven ability to think outside the box and develop novel asset-oriented programming techniques.

@zhekson: Technical Writer and Community Advisor

A longtime member of the community, zhekson has demonstrated his commitment and technical expertise in Cardano. He is passionate about distilling high-impact technical concepts for the masses, and doing so in an easily digestible manner. He actively engages with the community on Twitter, is a top contributor to the Cardano Stack Exchange, and operates a productive stake pool.

How does the cost of the project represent value for money for the Cardano ecosystem?

The team is based in the US, and has priced their time accordingly.

This proposal offers an excellent value for money to the Cardano ecosystem. For the price of one and a half developers, we can build a set of protocols that empowers users to form an endogenous economy on Cardano. One that is decoupled from the whims of the legacy financial system, and is secure, available, and 100% permissionless.

Moreover, this project heavily leans into previously unexplored eUTxO design principles (i.e. Beacon Tokens, Stake Key Overloading, e.t.c.) that may help advance the state of the field. The team has a reasonable expectation that their R&D efforts will be of interest to the eUTxO developer community at large, particularly with respect to composability.

close

Playlist

  • EP2: epoch_length

    Authored by: Darlington Kofa

    3m 24s
    Darlington Kofa
  • EP1: 'd' parameter

    Authored by: Darlington Kofa

    4m 3s
    Darlington Kofa
  • EP3: key_deposit

    Authored by: Darlington Kofa

    3m 48s
    Darlington Kofa
  • EP4: epoch_no

    Authored by: Darlington Kofa

    2m 16s
    Darlington Kofa
  • EP5: max_block_size

    Authored by: Darlington Kofa

    3m 14s
    Darlington Kofa
  • EP6: pool_deposit

    Authored by: Darlington Kofa

    3m 19s
    Darlington Kofa
  • EP7: max_tx_size

    Authored by: Darlington Kofa

    4m 59s
    Darlington Kofa
0:00
/
~0:00