September 26, 2022

The Future of Scaling on Cardano

Ben Beddow

Ben Beddow

Co-Founder

The difficulties involved in scaling a decentralized protocol, like Cardano, are often described as the blockchain trilemma which says:

A decentralized network can only excel in two of three of the most desirable properties of a decentralized network: security, scalability, and decentralization; and in order to excel at two of them it must forgo the third.

The developers and users of blockchains want their networks to stay decentralized while increase their scalability - the amount of transactions they can process in a certain amount of time, often measured in Transactions Per Second (TPS) - without losing any of the security properties that are key to keeping all the users and their funds safe from malicious entities.

For reference, the statistics of the centralized Visa network, regularly quoted at 1,700 TPS, are often held up as the goal and golden standard of network throughput that blockchains need to achieve in order to be widely accepted and used.

There are a wide variety of blockchains out there purporting to solve the blockchain trilemma with just a base layer blockchain, a.k.a the layer 1 (L1). Cardano indeed will, and just has with the Vasil hardfork, introduce scalability upgrades that improve the throughput of the layer 1 without sacrificing the network’s security or decentralization.

But in order to scale to meet the operational standards that are expected by both the users and institutions who want to use the network on a day-to-day basis, and on a global scale, and keep the 3 elements of the blockchain trilemma intact, other exciting options are being explored. You may of heard of it them collectively layer 2 scaling.

What is a Layer 2?

Upgrades to the underlying protocol, like Cardano’s Vasil hardfork, are called Layer 1 scaling. The main blockchain, Cardano, is considered the L1, and upgrades that improve its performance are called L1 scaling. Layer 2s, much like the layers of a cake, are built on top of these Layer 1, and rely on the layer 1 to support them in one way or another.

Layer 2s vary in how they operate, as we’ll see in a bit, but their goal is typically to remove the computation and transaction process from the L1, thereby reducing the computational load on the L1 and increasing the L1’s throughput by freeing up space for other transactions.


Layer 2 Scaling on Cardano

L2 and scaling solutions for Cardano can be be divided into three categories:

  • Sidechain
  • Rollups
  • State Channels (Hydra)

All L2s and scaling solutions are different and even each type of L2 comes in many formats, making it difficult to make generalizations about how they function. What we can do, however, is to discuss what the benefits and drawbacks are of each type of L2.

A generalization for layer 2s and scaling solutions that can be made is that users must lock up their funds on the main-chain in either a multisig wallet or, more commonly, a smart contract, to use these scaling solutions.


Sidechain

Sidechains are blockchains that are entirely separate from the L1 chain and process and secure transactions by themselves. They are connected to the L1 via a two-way blockchain bridge. Users send their assets to a smart contract on the L1 where these assets are locked. They are then mirrored on the sidechain by assets minted by a smart contract on the sidechain. The only transactions recorded on the L1 from the sidechain’s activity are those of the locking and unlocking of the tokens sent to and from the sidechain.

Each sidechain will have its own consensus protocol (how the network is secured) and network of validators (those who validate transactions and produce blocks) and their set of validators is typically much smaller than that of the L1 they’re built on top of.

As a result, users of a sidechain are typically required to trust the third party validators to be honest actors. Sidechain can scale to become decentralized by adding more validators in a decentralized manner, however, the vast majority of sidechains available at the moment are highly centralized.

What users get for a reduction in the level of security of their funds is an increase in transaction speed and much lower transaction fees.

Sidechains can operate on the same model as the L1 they are built upon, or they can bring the capabilities of other environments to the users of that blockchain, such as Milkomeda C1 which brings Ethereum Virtual Machine (EVM) capabilities to the users of the Cardano blockchain and acts mainly as an interoperability solution rather than a scaling solution.

Note that because sidechains are their own chain, running independent from the main-chain with their own validators, they are not considered as L2s, but can sometimes be thought of in the context of scaling solutions. Rollups and state channels, because of their reliance on the main-chain, are considered true L2 scaling solutions.


Rollups

Rollups compress the data from multiple transactions that are computed off-chain and add that data to the L1 as a single transaction, storing just enough data on the L1 to allow other entities to view and validate the transactions inside it. A smart contract stores the state of the rollup on the L1 and when the rollup posts a bundle of transactions to the main-chain, as a single transaction, the state of the rollup -i.e. the record of the distribution of tokens on the rollup- is updated.

There are two main types of rollups currently in use in the blockchain world, these are optimistic rollups and zk-rollups. Optimistic rollups assume that all the transactions that take place on the rollup are valid. Once posted, a transaction can be challenged for up to 7 days and after that it is locked in as valid. Zk-rollups post a zero-knowledge proof to the L1 that is checked before the transactions are executed and added to the rollup state, ensuring that all transactions added to create that state are valid.

While transactions on a zk-rollup process slower than those on an optimistic rollup, as they wait for the process of proving to be completed, the withdrawal time from a zk-rollup is much quicker as the transactions have already been validated. In optimistic rollups the user must wait until 7 days -the length of the challenge period- after they have submitted their withdrawal to receive the funds.

By compressing multiple L2 transactions into one L1 transaction the L1’s throughput is increased and the transaction cost for the users of the rollup is reduced, as the transaction fee for the single transaction is split across all the transactions included in the bundle of transactions. The speed of transactions on the L2 rollup is also faster than that of the L1.

Rollups uses the L1 for data availability while removing the computational load from it to enable efficiency gains. As a result the L2 inherits the security of the L1 but is not secured by the consensus mechanism of the underlying L1.

Rollups can use the same or different models from the underlying blockchain e.g. the EVM or the eUTxO model. There is one rollup protocol currently being built on Cardano, and that is Orbis. Developing zk-rollups using the eUTxO model.


State Channels (Hydra)

State channel are peer-to-peer channels that are opened by users who deposit funds in a smart contract or multisig wallet. In the state channel these users can then transact between each other with these funds as much as they like. When the users are finished using their state channel they post the final state, i.e. how much they each have, to the L1 and the funds are unlocked.

Only two transactions are recorded on the L1, the transaction to setup the channel, containing the initial state, and the transaction to close the channel, containing the final state. None of the transactions that happened in the state channel are recorded on the L1, allowing users to complete an unlimited amount of transactions for the price of two L1 transactions.

Because the users of a state channel are also their own validators their transactions are finalized instantly. So users get instant transaction finality and much cheaper transactions while removing their transactions, and therefore congestion, from the L1.

As their own validators, users of a state channel must always be online to agree to updates to the state of the state channel by signing it with their private keys. Keeping such a hot wallet makes them vulnerable to online attacks. Users also have to deposit their funds into the channel until the channel is closed, meaning they can’t use them elsewhere until the channel is closed and the funds released.

Hydra

IOG has been developing isomorphic, multi-party state-channels, affectionately named Hydra, for multiple years now. You can read the paper that introduced Hydra here.

In the Hydra protocol each state channel is called a head, hence why it’s called Hydra, and Hydra works in a very similar way to the state channels discussed above. The main way in which they differ is in their isomorphic nature. Being isomorphic means that Hydra heads directly adopt the L1s smart contracting system, allowing the L1 to still be able to compute any disputes that arise out of the L2. This also allows the contracts that are created in the L2 to be launched on the L1 after the closing of the state channel. Perhaps most excitingly, the Hydra protocol allows for “incremental commits and decommits” meaning that UTxOs can be added and removed by users while the head is in use, allowing for funds to be added or removed from the state channel without the need to close it.

For a breakdown of Hydra from the technical minds that are building it, read this blog post.

The concept of virtual Hydra heads, where two Hydra heads are connected together through a virtual Hydra Head, means that users can interact across Hydra state channels, without going via the L1, opening the potential for a large network of Hydra heads in the future. Details of virtual Hydra heads can be found in this paper.


The Scaling Future is Bright!

Scaling is one of the main focuses of the blockchain and cryptocurrency world at the moment and you can expect to see exciting and groundbreaking developments across the ecosystem in all three of the solutions mentioned above over the coming 12 months!

All the current scaling and L2 solutions have their benefits and their trade offs, namely increasing transaction throughput and decreasing the cost of transactions whilst decreasing security for the user and their funds. As the research continues we edge ever closer to finding a solution that solves the blockchain trilemma and the scalability issue that many see to be the boon of blockchains right now.

Continue Reading

Something new
Introducing: The Alonzo Graduation NFT Collection