funded
Anastasia Labs - Midgard: Cardano Layer 2
Current Project Status
In Progress
Amount
Received
₳60,000
Amount
Requested
₳500,000
Percentage
Received
12.00%
Solution

Proposing a high-throughput Cardano L2 with fast finality and relaxed SC execution constraints. Enhances scalability, speed, cost-efficiency, enables high-volume transactions without congesting the L1

Problem

L1 congestion during project launches leads to delays, slow responsiveness, and concurrency issues, hindering DeFi strategies. Fast finalization is crucial.

Copy-of-White-Minimalist-Profile-LinkedIn-Banner-1ac994.png

Impact Alignment
Feasibility
Value for Money
Anastasia Labs - Midgard: Cardano Layer 2

Please describe your proposed solution

Our proposed solution, Midgard, is a Layer 2 (L2) scaling solution for the Cardano blockchain, designed to enhance scalability, speed, and cost-efficiency while preserving the security and decentralization of the Cardano Layer 1 (L1). Midgard aims to address the issues of network congestion and long wait times that occur during high-frequency chain activities, such as highly anticipated project launches.

Midgard is isomorphic to the Cardano L1, meaning that decentralized applications (DApps) can seamlessly redeploy on Midgard using the exact same code and tech stack. This feature significantly reduces the burden on developers, allowing them to leverage the benefits of Layer 2 without modifying their existing codebase, tech stack, or architecture. This ease of transition encourages broader adoption and utilization of the Layer 2 solution.

Midgard is built on a robust codebase, largely vendored from the Cardano ledger, but with significant modifications to consensus mechanisms and the introduction of logic to regulate a constrained validator set. Key improvements include:

  • Increased Blocksize Limits: Allowing for more transactions per block.
  • Expanded Script Execution Units: Enabling more complex operations within each transaction.
  • Reduced Block Times: Block times have been reduced to 3 seconds, with ongoing work to decrease this further.

Midgard offloads non-critical financial activities and high-volume transactions, such as NFT launches, staking platforms, on-chain games, and meme-coin trading, from the Cardano L1 to the Layer 2. By managing these activities on Midgard, the main chain experiences reduced congestion, ensuring that critical transactions on the L1 are processed efficiently, even during peak periods.

Despite offloading significant transaction volume, Midgard remains dependent on the Cardano L1 for security and consensus. It regularly interacts with the main chain to publish checkpoints of the L2 state, ensuring continuous transaction flow and fee generation for the Cardano L1. This integration supports the economic model of Cardano, ensuring sustainability and growth of the main network.

Several projects, including FluidTokens, have already committed to utilizing Midgard. This early adoption showcases the confidence of the community and developers in the capabilities of Midgard to deliver a high-performance Layer 2 solution.

Please define the positive impact your project will have on the wider Cardano community

By offloading non-critical and high-volume activities like NFT launches, staking platforms, on-chain games, and meme-coin trading to the L2, Midgard will help alleviate congestion on the Cardano Layer 1 (L1). This ensures that critical financial transactions, especially during high traffic periods, can be processed more efficiently, reducing risks for users involved in lending, borrowing, and other time-sensitive DeFi activities.

Midgard will cater specifically to users engaged in high-frequency trading activities, such as arbitrage and liquidation auctions, by providing the necessary speed and scalability. This prevents users from leaving the Cardano ecosystem for other platforms like Solana or Polygon, thereby retaining liquidity and growing the user base within Cardano.

Midgard will spread the transaction load by conducting and settling activities during low-congestion periods. This leads to a more balanced and efficient use of Cardano's L1 block space, enhancing the overall performance and reliability of the network.

Midgard’s dependency on the Cardano L1 for security and consensus means it will regularly interact with the main chain, paying fees for publishing checkpoints. This continual interaction supports the economic model of Cardano by ensuring that L1 remains financially sustainable and benefits from the increased activity generated by the L2.

What is your capability to deliver your project with high levels of trust and accountability? How do you intend to validate if your approach is feasible?

FluidTokens has successfully built and delivered multiple DeFi projects on Cardano while Anastasia Labs team consists of highly skilled developers who have made significant contributions to various community projects, including Lucid, Agora, Liqwid-Plutarch-Extra. Our developers have had experience developing and publishing end-to-end DApps including production projects such as Discovery (SundaeSwap Liquidity BootStrapping Mechanism). We have audited a large number of protocols including MinSwap, Genius Yield, Optim Finance, Wanchain, Lenfi, Encoins, FluidTokens, Spectrum Finance, and Atrium Labs. In addition to our project involvement, our team has been actively engaged in the developer experience domain. We have actively participated in educational panels focused on DApp Security Practices and Design Patterns, and our members have served as co-chairs of the IOHK developer experience working group.

Furthermore, our collaboration with Emurgo Academy has been instrumental in educating aspiring developers, with our team playing an essential role in this endeavor. We have also recognized and recruited a number of exceptional talents from the courses.

We have developed software development kits (SDKs) that facilitate the integration of existing dApps with other systems through off-chain code. Our team has also designed various protocols, including bridges and staking systems, while also actively contributing to open-source smart contract languages and their associated standard libraries.

With broad range of expertise within the Cardano Ecosystem we are a highly capable and versatile development firm

What are the key milestones you need to achieve in order to complete your project successfully?

Milestone 1: Technical architecture specification

  • Network and Consensus mechanisms:

Define the network topology and consensus algorithm for the sidechain.

  • Communication protocol between L1 and L2
  • L2 transaction handling
  • Detail the process of transaction initiation and validation on L2.
  • Describe the steps for commitment and proof generation for L1.
  • Outline mechanism for handling failed transactions or rollbacks.
  • Data storage and retrieval mechanisms.

Specify the mechanism for data storage and retrieval on the sidechain.

  • Economic Model
  • Provide overview of fee structure for transactions, staking mechanisms and participant incentives.
  • Security Model
  • Describe rules for the registration of the validator set.

Acceptance Criteria: Approval of network topology and consensus algorithm by project lead.

Evidence of Milestone Completion: Submission of network and consensus mechanism documentation, along with all other technical documentation specified above on Github.

Milestone 2: Layer 2 Node infrastructure

  • Implement network parameterization
  • Develop Layer 2 toolkit tailored for managing node services
  • Create Docker infrastructure for easy deployment and management of the Layer 2 nodes
  • Implement Kupo/Ogmios services for seamless data retrieval and submission

Milestone Outputs:

  • Network parameterization configurations
  • Layer 2 toolkit for managing node services
  • Docker infrastructure for deployment and management of Layer 2 nodes
  • Kupo/Ogmios services for data retrieval and submission

Acceptance Criteria:

  • Successful implementation and approval of network parameterization by project lead
  • Approval of Layer 2 toolkit by project lead
  • Successful deployment and management of Layer 2 nodes using Docker
  • Successful implementation and approval of Kupo/Ogmios services by project lead

Evidence of Milestone Completion:

  • Submission of network parameterization configuration files
  • Release of toolkit on GitHub repository
  • Submission of Docker infrastructure files and documentation
  • Release of Kupo/Ogmios services on GitHub repository

Milestone 3: Security Inheritance Mechanism

  • While the validator set of our Layer 2 solution operates independently from the Cardano Layer 1, it leverages periodic checkpoints on the main chain. This design enables our Layer 2 to inherit the robust security features of the Cardano L1, ensuring a secure and reliable operation. This milestone covers the implementation of the checkpoint mechanism.

Milestone Outputs:

  • Implementation of checkpoint publication mechanism for periodic security inheritance from Cardano L1

Acceptance Criteria:

  • Successful implementation and approval of checkpoint mechanism by project lead

Evidence of Milestone Completion:

  • Submission of checkpoint mechanism code and documentation on Github

Milestone 4: L2 Throughput optimization

  • Analyze existing layer architecture to identify areas that need modifications, with the final goal of increasing the throughput in Layer 2.
  • Conduct benchmarking tests to measure the throughput (transactions per second) and finality (time taken for transaction to be confirmed) between layer 1 and layer 2.

Milestone Outputs:

  • Analysis report identifying areas for throughput improvement
  • Benchmarking test results measuring throughput and finality
  • Optimize the parameters and network configuration iteratively based on feedback from the benchmarks

Acceptance Criteria:

  • Approval of analysis report by project lead
  • Successful completion and analysis of benchmarking tests
  • Demonstrable improvements in benchmark metrics such as throughput, finality, block-time, script execution limitations and/or demonstrable reduction in memory/CPU requirements of node infrastructure.

Evidence of Milestone Completion:

  • Submission of analysis report
  • Submission of benchmarking test results
  • Optimization PRs transparent in GitHub history.

Milestone 5: Production instance

Marks the culmination of development efforts, from testing to an operational blockchain ready to use.

  • Generate the genesis keys and configuration files required for initializing the network, including initial distribution, validator set and network settings.
  • Provide an API that allows users to interact with the blockchain in real-time.

Acceptance Criteria:

  • Approval of genesis keys and configuration files by project lead
  • Successful deployment and approval of API functionality
  • Live transactions on the production L2 deployment, and live transactions on the Cardano L1 for periodic state publication.

Evidence of completion:

  • Release of API documentation and code on GitHub repository
  • Chain-explorer data that illustrates the transactions on the live L2 network

Final Milestone: Milestone Outputs:

  • Project closeout video summarizing project achievements, challenges, and lessons learned
  • Project closeout report detailing key milestones and outcomes
  • Documentation and support for onboarding new projects to Midgard

Acceptance Criteria:

  • Approval of project closeout video by stakeholders
  • Approval of project closeout report by stakeholders
  • Successful onboarding of initial projects and approval by project lead

Evidence of Milestone Completion:

  • Submission of project closeout video
  • Submission of project closeout report on GitHub repository
  • Submission of onboarding documentation and testimonials from onboarded projects

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

Team FluidTokens.com

Matteo Coppola: Cloud Architect, Backend and Smart Contract Developer, <https://twitter.com/0xMetamatt>

Raul Antonio Rosa Padilla: Smart Contract Developer, Offchain integrations, https://twitter.com/ElRaulito_cnft

Team Anastasia Labs

Philip DiSarro, Compiler &amp; Programming Language Research, https://twitter.com/phil_uplc

Philip is an expert in the field of Compiler Development &amp; Programming Language Theory. He has made significant open-source contributions to the Cardano developer ecosystem. As a co-chair of the IOHK developer experience working group he worked to identify and resolve pain points that DApp developers experience in Cardano. He has a vast wealth of professional experience in smart contract security and auditing on Cardano; and was responsible for the identification and resolution of a large number of critical exploits in production open-source smart contracts. Recently, Philip has concentrated his efforts on designing and deploying effective zero-knowledge proof applications within the Cardano ecosystem.

Philip is a senior Haskell developer on the XSY team, a consultant and lecturer for Emurgo, and the CEO and co-founder of Anastasia Labs.

Jonathan Rodriguez, Functional Programming &amp; TypeScript SDKs, <https://twitter.com/solidsnakedev>

Jonathan is a highly skilled smart contract developer specializing in Cardano, a blockchain technology that he is deeply passionate about.

His passion in smart contract development drives him to constantly polish his technical knowledge. In the pursuit of that knowledge he obtained the following certifications: Cardano Solution Architect, Cardano Developer Professional, and Associate Certificate.

With an extensive background in Haskell development, which is a critical language for Cardano, he possesses a thorough understanding of functional programming concepts.

His expertise extends to various aspects of the Cardano ecosystem, including the Cardano Toolchain, Transaction Structure, Plutus Smart Contracts, Native Tokens, DApp Connector, and other essential components.

Jonathan is well-versed in conducting use case analysis and tokenomics, as well as interfacing with decentralized storage, server APIs, and integrating databases.

He is knowledgeable in establishing robust CI/CD (Continuous Integration/Continuous Deployment) flows and integrating them into development processes. Additionally, he is skilled in conducting thorough unit testing to ensure the reliability and security of his smart contract solutions.

Please provide a cost breakdown of the proposed work and resources

Lead Haskell developer - 1 individual - ADA 150K

Senior Haskell developer - 2 individuals - ADA 100K each

Lead Blockchain architect - 1 individual - 150K

No dependencies

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

Recent user activity trends in the DeFi space reveal a high demand for high frequency trading activities.

Layer one blockchains are typically designed to prioritize security and decentralization over throughput, and as such they are often not suited to facilitate such activity. There is a cost to security and decentralization and often increased throughput must come at the expense of security or decentralization. How then can you accommodate users who want to engage in high throughput and fast finality transactions without compromising the integrity of the layer one?

In many cases, Hydra is a great solution; however, there are many use-cases which are not suited for the ephemeral nature of Hydra deployments. There are a variety of approaches that blockchains take to accommodate such users. One of the most tried and tested approaches is the development of layer 2 solutions. Using layer 2s, users can engage in high-frequency trading activities with the speed and scalability they require, while the layer one blockchain maintains its focus on security and decentralization. Layer 2 solutions achieve this by offloading transaction processing from the main chain, allowing for rapid transaction finality and increased throughput.

Currently Cardano does not have a general purpose layer 2 solution. As a result, when users want to engage in certain high-frequency trading activity (i.e. for arbitrage or other financial instruments that require quick response times that Hydra is not suited for) they are often forced to leave the network and look elsewhere (i.e. to Solana and Polygon).

Midgard, our layer 2 solution, will provide users who wish to engage in high frequency trading activity with the ability to do so without exiting the Cardano ecosystem.

Furthermore, during normal network operation the user experience on the Cardano L1 is extremely well-designed and community feedback reflects that. Transaction are cheap, you don't pay when they fail, the fees are consistent, and transactions do only exactly what users are expecting (as presented to them by their wallets). However, during hyped launches and periods with extremely high transaction volume, the network can become congested. In such cases, the security of the network is preserved and the blockchain continues to work as intended with strong resiliency. That said, some DeFi protocols subject users to risk in high congestion environments because they rely on the ability to get critical transactions, such as collateral liquidation, into a block. This can leave users unable to reinforce their positions on synthetic platforms or increase their collateral on lending platforms, which in turn results in their positions being liquidated. A lot of this network congestion can be alleviated by off-ramping non-critical financial instrument volume such as NFT launches/trading, CNT staking platforms, on-chain games, and meme-coin launches to the layer 2. These activities are often centralized by nature; the NFT/FT users receive is commonly just determined off-chain by the relevant party. Many such applications are centralized by nature, and it doesn’t make sense to for them to pay the costs associated with the security and decentralized consensus of a layer 1 if they don’t actually take advantage of it. Instead that activity can be done on Midgard and settled to the Cardano mainnet when the utilization of block-space is lower thus alleviating congestion from the L1.

One of the great things about Midgard as an L2 to is that it inherits it security from the Cardano L1. Midgard is consistently providing value to Cardano because it is fully dependent on the L1 for security and consensus. To achieve this, it must consistently transaction with (and thus pay fees to) the Cardano L1 to publish checkpoints of the L2 state. So instead of reducing the network activity of the Cardano L1, Midgard simply disperses activity conducted during high-congestion periods across low-congestion periods thus facilitating a more efficient use of Cardano's L1 block-space.

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