Skip to main content

Decoding Madara: defining its technological heart

OnlyDust

✍️
Shoutout to contributor Ayushtom for this article. He is a product engineer who likes building things people would like to use everyday.

When you enter the world of Web3 and open-source, you are bound to discover the world of Starknet. And within this world, you will definitely come across a project named “Madara”, a pioneering force in the realm of decentralized applications (dApps). This project stands at the forefront of revolutionising decentralized technology, partaking in the adventure of shaping how future applications can function more effectively and securely.

Are you ready to explore this?

This article will take a look into understanding Madara by decoding certain terminology, unwinding its usage of zero knowledge proofs, validity rollups, and state-of-the-art innovation from Starknet, in order to discuss its advantages from a developer’s point of view.

This piece will also look at the foundational elementals of the Madara project, examining how it navigates the challenges of decentralization and security in the blockchain space.

All-in-all to demystify Madara for any newcomer that is interested in this universe!

Unveiling the Technological Heart of Madara


Before we start, we can define Madara something like the following:

Madara is a framework to build validity rollups powered by the substrate framework from Polkadot.

So what does that mean? Let’s take a look at each of the terms below.

What is substrate?

Substrate is a framework to build your own blockchains which has been battle tested for years.

This framework is chain agnostic and allows us to swap in and out any components we would like to use in our blockchain.

What I mean by chain agnostic is that we can swap out any component we want in our blockchain without worrying if it will be compatible with substrate. Substrate is made to be highly modular and is not dependent on any logic of Polkadot. You can use it to make proof of work, proof of stake chains and any modifications you want according to your needs.

If you want to learn more about substrate, check it out here.

A little about Polkadot

For those that are unfamiliar, Polkadot is another chain created by the ex-CTO of Ethereum (Gavin Wood). He built the substrate framework when he realized that most chains have to build many basic components from scratch even though they are widely used by many chains.

By building this framework, his vision was to make it easier to build your own blockchains by making it highly modular so that you can just use the parts you want and replace anything according to your needs.

Learn more here if you want a bit more background reading.

How does Madara use substrate?

Now that we have looked at  what substrate is, we can briefly discuss how Madara uses it. Madara is built on the substrate framework where we integrate the zero knowledge tech from Starknet. This allows Madara to inherit all properties on Starknet.

The substrate framework allows us to use all the components we want in our blockchain because of its modular nature.

Importance of Starknet integration on Madara

Starknet is a Validity-Rollup on Ethereum.

To quickly define a Validity-Rollup is to understand that Starknet executes transactions on its own chain and sends the proof of execution to the Ethereum network. The Ethereum network verifies if these transactions are correct (if they have actually executed in the right way) and will update the state of the Starknet chain on its newly created block too.

The proof of execution which I mention here is created with the help of zero knowledge (ZK) proofs. Starknet will execute these transactions and create a ZK proof of its new updated state and send it to the Ethereum network.

How does ZK help?

ZK technology enables Starknet to execute these transactions much faster. The proof of these transactions need to be created only once (expensive operation) and then the proof can be verified by the validators (cheap operation). A lot of compute power is saved since verification is much cheaper hence this also contributes to the speed of Starknet.

The genuine force of Madara exists in its answer, called Starknet. Simply envision transactions occurring at lightning speeds, all while utilizing zero knowledge proofs to approve without uncovering any data. The best part? The security of the Ethereum Mainnet stays in proper shape all throughout since these proofs will eventually be submitted and settled on Ethereum.

We can ask ourselves whether Validity-Rollups are the only way to scale up. The answer is no, the blockchain is varied; different scaling solutions exist, each with its own assets. For Madara, this was their chosen path. Madara's decision lines up with the mission for security and speed.

Thanks to Validity-Rollups and Zero-Knowledge proofs, Madara gets exchanges cryptographically which in turn guarantees the computational integrity of data while channeling the speed of off-chain processing.

So, how does Madara leverage the Starknet technology to become a Validity rollup?

First we need to understand what a Validity rollup needs:

  • A virtual machine which can run your smart contracts deployed on your Validity rollup,
  • A RPC service which can be used to query your rollup,
  • A proving service which can prove your transaction before passing it to the parent blockchain,
  • A data availability layer/ settlement layer to store information about transactions that are happening on the blockchain.

Now that we understand what a Validity rollup needs, we can take a look at how Madara uses the Starknet technology to become a Validity rollup. The following components, core to Starknet technology, are thus implemented by Madara to achieve this:

Virtual Machine -  Madara has integrated the CairoVM which allows you to use the provable programming language called Cairo from Starkware and run it in a CairoVM. Being inherently provable, this allows the VM to generate a trace of all the computations done in the smart contract and send it to the prover for generating a proof of this smart contract. Moreover, as developers, you can execute complex smart contracts off-chain and improve efficiency thanks to Cairo.

RPC Service - This enables you with all the things you require to query the Starknet blockchain. This means that all the dev tooling which is available on Starknet are out of the box compatible with Madara too (wallets, starknetjs , starknetrs)

Proving service - We use the SHARP prover by starkware team which helps you generate proof for all your smart contracts. You won’t have to build your own prover for generating proofs for your contracts. You can directly inherit the prover used in Starknet and use it from Madara.

Data Availability - Madara is DA agnostic and you can use any data/ settlement layer you want for your rollup like Celestia, Avail, Ethereum.


What are the advantages of Madara?

Now that we have unveiled the technological heart of Madara, it’s useful to see what the advantages of Madara are.

First off, Madara has all the advantages of a Validity rollup, meaning faster finality and cheaper data availability. This means that:

  • You don’t have to wait for a longer time to see if transactions are accepted on the settlement layer (Optimistic rollups have a time period to challenge any transaction which you feel is incorrect)
  • you only post the state diffs and not all the transactions.

Secondly, Madara ensures that you only focus on your business logic so that you don’t have to rethink problems of settling data, proving transactions and other technicalities which involve the virtual machine your smart contract will run in, etc. These problems are already solved in Starknet, Madara simply inherits these properties from Starknet making it a really good choice to make a Validity rollup of your own.

Thirdly, Madara is also highly modular where you can choose a consensus algorithm of your own choice, a virtual machine for your smart contracts, data availability layer, your own prover etc.

Build your own chain

Now that we have looked at the advantages of Madara, what is interesting is to explore how it can be used by developers to build their own products.

You can use Madara to build a chain of your own and essentially get all the advantages of hosting your own chain for your product. You can use it to host your own onchain game, onchain decentralized exchanges (DEX), onchain applications and so forth. A few of them are already live, which you can see today:

  • Acala: This is an appchain built using the Substrate framework from Polkadot. Their mission is to democratize finance.
  • Axie Infinity: This is a fantasy game which uses a Ronin chain (an appchain solution for web3 games).
  • Dydx v4: This app chain is built using the Cosmos SDK (framework for building blockchains by cosmos)

So when you use Madara to develop your own chain for your product, you can decide the components you want to use in your blockchain and also omit or add features specific to your chain. These chains are defined as “appchains”.

Having your own “appchain” gives you the power to decide what would be the gas fees, block time and other core features of your chain. With the essential components to build a Validity rollup already ready to use out of the box for you, you can leverage this tech to make an app chain for your product and avoid all issues which you face in a public blockchain (high gas fees of Ethereum, slower transactions). In the below diagram , the appchains(L3) are built on top on public Starknet layer(L2).


Let's wrap it up


In the perplexing dance of zero-knowledge proofs and Validity-rollups, Madara on Starknet arises as a technological wonder. This is because it tends to the “blockchain trilemma” and does so without compromising decentralization and security, and thus introducing a new era for blockchain.

As a reminder, the “blockchain trilemma” is a concept commonly discussed in the field of blockchain technology. It refers to the challenge of achieving three key properties in a blockchain network: decentralization, security and scalability. Achieving all three at once is very difficult, but Madara has found a way around this!

Thanks to Madara, we get the security and scalability of ZK Proofs and the decentralization of Ethereum.

So, what lies beyond? The answer lies in the hands of a community driven by curiosity, investigation, and dedication to pushing the limits of what's technologically feasible. Madara is completely open source with more than 70 contributors and actively looking out for more people to contribute too!

This is a community driven project started by Starkware and they also pay you for each contribution. There are many people to help you get started on Madara and also assist you if you get stuck on something. The community is vibrant with experts on ZK technology guiding you on fronts!

So if you are interested in participating in this adventure, feel free to reach out. This project is found on OnlyDust like many other awesome ones in the ecosystem.

As a reminder, OnlyDust is a platform that helps connect developers with the most exciting open-source projects. The added bonus? A strong community and rewards for contributions.


For more information on Madara, you can visit the following links which can be of great help:

Github Repository Link:

https://github.com/keep-starknet-strange/madara

A walkthrough done by one of the maintainers:

https://youtu.be/kYZEEUsc-tE?si=Bqe4x7Lgpiue29uF

Talks done on Madara:

https://youtu.be/gKGumhRISLU?si=6-tUUpyOum1ReWzChttps://youtu.be/lL9W6PhCOTQ?si=BVb4Pleld7FzCm5P

Documentation:

https://docs.madara.zone/