MELD
Published in

MELD

Akamon Beta — Improvements in Babbage Era 🚀

Developments & efficiency improvements as the Vasil hard fork approaches

https://testnet.app.meld.com/akamon

Akamon — The native gateway between Cardano and Polygon 🌉

The Cardano contracts of Akamon Beta were initially designed to work in the Alonzo era since we were uncertain when the Vasil hard-fork (or you can call it the Babbage era) was going to happen. However, as you already know, the Vasil hard-fork was successfully launched on the public testnet on July 3rd.

With Akamon Beta only in its early stage, we realized that this is an excellent chance to push for all the optimizations & improvements that are only made available by the hard fork. We want the community to experience the latest Cardano enhancements and know what to be expected when the Vasil hard-fork hits the mainnet later this year.

We classify improvements that came with the hard fork into two categories:

  1. Passive: Developers don’t need to make any changes to their dApps to benefit from these improvements.
    Ex: Diffusion Pipelining, UTXO set on-disk storage
  2. Active: Developers need to make changes to their dApps themselves.

“Active” improvements are what we’re interested in and excited to work with:

We’ll assume that the readers are already somewhat familiar with those CIPs and how they can improve Cardano dApps in theory. Therefore we’ll only focus on what we have done with Akamon Beta using such improvements:

Tools & Libraries
Scripts Deployment
Inline Datums
Other Optimizations
“Almost” Oracle Solution

⚒️ Tools & Libraries

Even in late June and early July, while we’ve been preparing for the hard fork, many popular tools & libraries still aren’t ready for the Babbage era, and that’s still somewhat true at the time of writing. However, we anticipated this and decided to commit deeply to homegrown solutions such as cardano-index and cardano-tx-builder. As a result, we could adapt Akamon Beta to the Babbage era and experiment with new improvements more quickly - instead of waiting for external libraries to be ready and stable.

Unfortunately, we can’t implement everything ourselves, and we still need to wait for the Cardano ecosystem to move as a whole. For example, at the time of writing, many browser wallets can’t sign a transaction with inline datums or reference inputs… We expect this to be much better in the next few weeks when the hard fork is coming closer to the mainnet.

📄 Scripts Deployment

Before the Vasil hard-fork, in order to consume a script-locked UTXO or mint some tokens, you always need to include the needed scripts in the transaction. As a consequence, transactions involving Plutus smart contracts are huge in size. This alone causes several problems:

  • We all heard about the famous “script size” problem on Cardano: Transactions are limited to 16KB; therefore, developers can’t build complex transactions that require interactions of 3–4 scripts even if their scripts are optimized in terms of execution units.
  • There’s also a size limit per block, which means there’s only a small number of complex transactions that can get into a single block, giving the community a somewhat “false” impression that Cardano has a low throughput.
  • Transaction fee scales with transaction size (along with execution units and some fixed amount); bigger transactions have higher fees.

Things changed completely in the Babbage era; with CIP-31 (Reference Inputs) and CIP-33 (Reference Scripts), scripts no longer need to be included directly in the transactions. Instead, they can be “deployed” by producing UTXOs with reference scripts (CIP-33). Transactions requiring those scripts can just refer (CIP-31) to those deployment UTXOs, and they will get resolved and made available in the evaluation context by the Cardano nodes.

With this technique, we can reduce validators’ transaction size by 5x-10x (depending on how complex it is), cutting those transaction fees by 2x-3x in the process. In our experience, it’s a game-changing mechanism because it doesn’t only benefit us but the whole community as well: if all dApps use similar techniques, many more transactions can be included in a single Cardano block, and the whole network throughput and efficiency will be much higher.

📑 Inline Datums

Before the Vasil hard-fork, you could only produce script-locked UTXOs with datum hashes, but to consume those UTXOs, you need to provide the datum corresponding to the stored datum hash. It was meant to reduce the amount of data stored on-chain. However, it might not always be true:

  • In many of our contracts, we also need to check the outputs’ datums to see if they satisfy certain conditions therefore, we usually have to include the datum as a supplementary one in the UTXO-producing transaction.
  • To build the UTXO-consuming transaction, we need to get the corresponding datum somewhere. Without centralized databases, the only place we can store them is the actual Cardano blockchain.

Those lead to the fact that, in most cases, a datum needs to be included in both the producing and consuming transaction, effectively including it in a transaction twice, paying the fee twice.

With CIP-32 (Inline Datums), we can just include the datum in the producing transaction, and it will be made available to everyone. Not a deal-breaker for Akamon Beta, but definitely a nice overall improvement to lower the transaction size (again) and clear out some confusion for dApp developers on when and how they should make those datums available for consuming transactions.

🔮 “Almost” Oracle Solution

But the use of CIP-32 (Inline Datums) doesn’t stop there, when combined with CIP-31 (Reference Inputs), we can have Oracle-like UTXOs, acting as a data source for other contracts. This is a really effective technique for infrequently updated data. It allows us to make these interactions congestion-free in Akamon Beta:

  • Distribute collected fees to validators
  • Migrate users’ locked funds in a decentralized manner

We’re doing extensive research & exploration on the Oracle subject, and we have much more to write. However, let’s keep it for our next technical reports 😉

⚙️ Other Optimizations

Alongside those improvements brought by the Vasil hard-fork, we’ve also done some heavy optimizations on the contracts. After doing internal benchmarks, we expect the Polygon → Cardano throughput to be 5x what we had initially on the public testnet, and around 10x what we had with Akamon Alpha. But we’ll definitely provide more detailed stats after gathering real data from users when things are more stable on the public testnet.

One optimization we’ve tried used the CIP-42 (New Plutus Builtin: serialiseBuiltinData); this allows us to check for requests' consistency between approvals with more efficient computations.

We also plan to use CIP-40 (Collateral Output) to manage validators’ UTXOs better and protect them from losing unneeded collaterals when anomalies happen.

🔗Akamon Links

Akamon FAQ
Detailed step-by-step user experience of an Akamon transfer Akamon Public Issue Tracker

MELD — Be Your Own Bank

We think it’s essential for everyone to gain control of their financial lives and have equal access to financial instruments used by professionals, not just centralized institutions, governments, or the 1%. We want to provide financial freedom and control to the masses, including the unbanked.

We have a long-term goal to enable the $15 trillion that is currently locked out of the global economy, including 2 billion individuals worldwide that are either underbanked or have no access to banking services whatsoever, access to these tools. These are the people that are paying the highest fees, getting the worst customer service, and they are the ones that are having the most problems.

Our vision is to create an ecosystem that empowers individuals to regain financial control by providing them with the tools and services they need to manage their money on their terms. Whether that be creating a collateralized debt position (CDP) with cryptocurrency, earning an interest return for lending fiat to borrowers, or even participating in reward incentive programs, we strive to provide our users with the functions they need to manage their own financial lives.

Website | GitBook | Twitter | Reddit | Telegram Group | Telegram Notifications | Linkedin | Github | Youtube | Discord | Facebook | Instagram

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Stuart

Stuart

MELD is the future of DeFi. DeFi is life.