Optimizing the Throughput of Cardano: The Evolution of Indigo Protocol’s Smart Contracts

Indigo
5 min readSep 11, 2023

--

Introduction

The efficiency of smart contracts plays a pivotal role in determining the overall health and scalability of a network. Within the Cardano ecosystem, the Indigo Protocol stands out for its continued innovation, positive community sentiment, and its smart contracts being some of the most complex within the dApp ecosystem. As the protocol has grown in popularity and usage, the need for optimization has become a priority for v2 development.

The coming transition of the Indigo Protocol from PlutusTx (enhanced with Plutonomy) to Aiken is a promising step in the right direction. The initial version, Indigo Protocol v1, was already a marvel, having been launched on mainnet with contracts crafted in PlutusTx. Knowing the constraints of the PlutusTx language, Indigo Labs began exploring other options within the ecosystem: Plutarch, plu-ts, Opsin, Helios, among them. After researching the available options, the team decided on Aiken, due to its ease of implementation and readability. With the integration of Aiken, the performance metrics have excelled, particularly in terms of computational steps and memory units. For v1 it was too late to consider any alternative due to the amount of development that was already done prior to their release.

To truly appreciate this leap, one must understand the intricacies of Cardano’s smart contract metrics and limitations. Every script on the Cardano network is bound by two primary properties: the number of computational (CPU) steps it uses and the memory units it consumes. While each computational step signifies 1 picosecond of execution time on a benchmark machine, the memory units represent the bytes allocated by the script. These metrics are not just numbers; they directly influence the transaction fees and, by extension, the user experience.

By optimizing the Indigo Protocol’s smart contracts, we’re paving the way for a more performant Cardano ecosystem. Lowering the memory units and computational steps for each Indigo transaction means more room for other transactions, leading to increased throughput and a more robust network. This is the future of Cardano, and with the advancements in the Indigo Protocol, we’re one step closer to realizing this vision. Join us as we delve deeper into this transformative journey and explore the nuances of smart contract optimization on Cardano.

Diving into the Metrics: A Comparative Analysis of PlutusTx, PlutusTx w/ Plutonomy, and Aiken

In the realm of blockchain, numbers often tell a story more vividly than words. As we look more into the evolution of the Indigo Protocol’s smart contracts, it’s essential to ground our understanding in tangible metrics. For those who might not be technically inclined, fear not. We’ve broken up the data into its most digestible form, ensuring that everyone can grasp the significance of the transition.

We’re comparing three distinct phases in the development of the Indigo Protocol’s smart contracts:

  1. PlutusTx: The foundational layer, where it all began.
  2. PlutusTx w/ Plutonomy: These are the V1 contracts that were launched to mainnet. Basically PlutusTx but with an optimization pass with Plutonomy, an optimizer for untyped plutus core. The addition of Plutonomy was a pivotal step, as it was necessary for the launch of Indigo Protocol v1.
  3. Aiken: The latest evolution, chosen for its ease of implementation, readability, and superior performance metrics.

Before we delve into the charts, let’s establish a foundational understanding of the metrics we’re examining:

  • Tx Size: This refers to the size of the transaction. The Cardano protocol parameters set a limit of 16,384 bytes (or 16.384 kB). The charts below include the improvement of reference scripts. We will compare script size later in this article.
  • Computational Units: This metric represents the number of computational steps a script uses. The limit is set at a whopping 10,000,000,000 picoseconds or 10 milliseconds.
  • Mem Units: This denotes the memory consumed by the script, with a limit of 14,000,000 bytes (or 14 MB).

When interpreting these charts, it’s crucial to remember: lower percentages are better. A lower percentage indicates that the smart contract is consuming fewer resources relative to the maximum limits set by the Cardano protocol. This means more efficient transactions, lower fees, and a smoother user experience. We’ve managed to rewrite all of Indigo Protocol smart contracts and successfully integrate them with our existing test suite to find these numbers.

In the following sections, we’ll delve deeper into what these numbers mean for the Indigo Protocol and the broader Cardano ecosystem.

In Conclusion: A Brighter Horizon with Aiken

As we wrap up this exploration into the transformative journey of the Indigo Protocol’s smart contracts, one thing becomes abundantly clear: the shift to Aiken is not just a technical upgrade — it’s a leap towards a more efficient and expansive future for both Indigo and the broader Cardano dApp ecosystem.

The enhanced performance metrics of Aiken don’t just translate to numbers on a chart. They signify better throughput, enabling more transactions to be processed smoothly and swiftly. For the users of Indigo and the Cardano community at large, this means a more seamless experience, reduced transaction fees, and a more robust network.

But the benefits of Aiken don’t stop there. Its superior performance has unlocked doors that were previously closed due to the constraints of PlutusTx. Features that were deemed too complex for the initial version of the Indigo Protocol can now be revisited. These advanced functionalities, which had to be shelved during the development of v1, are now back on the table, thanks to Aiken’s capabilities.

We’re excited about these features and can’t wait to share more details with you all. Stay tuned for a future blog post where we’ll be unveiling some of these innovations, followed by a DAO proposal for the implementation of Indigo Protocol V2.

We’d be remiss if we didn’t extend our heartfelt gratitude to the Aiken Lang team. Their dedication and expertise in crafting this language have been instrumental in our journey. For those interested in diving deeper into the intricacies of Aiken, we encourage you to explore their work on GitHub.

In the ever-evolving world of blockchain, staying ahead of the curve is paramount. With Aiken as our ally, we’re not just keeping pace — we’re setting the pace. Here’s to a brighter, more efficient future for the Indigo Protocol and the Cardano ecosystem.

Website | Protocol | Discord | Twitter | Telegram | Indigo Paper

--

--

Indigo
Indigo

Written by Indigo

Indigo is a decentralized synthetic asset issuance protocol built on Cardano