Madara

Welcome to Madara, a modular stack designed for building app chains utilizing Cairo and Starknet technology. Starknet has powered applications like dYdX V3, Immutable, and Sorare with its StarkEx technology for scaling. Now, with Madara, these capabilities are open source and accessible to everyone.

Madara is constructed on the Substrate framework, known for its modularity and access to an extensive array of development tools, libraries, and a vibrant developer community. This framework is particularly advantageous for developers seeking greater control over their chain by owning more of the stack.

📚 Documentation

Madara's comprehensive documentation offers guidance on various aspects, from the project structure and architecture to benchmarking and operational instructions:

📣 Building App Chains

With Madara, many use cases do not require forking the repository to build an app chain. By using forking, you would need to periodically rebase and resolve conflicts to stay updated with the latest version. Madara provides:

  • pallet_starknet: Integrates CairoVM into Substrate, allowing deployment and execution of Cairo contracts.
  • Starknet RPC: Adds all Starknet RPC calls, ensuring compatibility with tools like starknet-js and wallets.
  • DA Interface: A versatile interface for using any DA layer such as Avail, Celestia, Ethereum, etc.
  • Proving: Operates the Starknet OS (runtime logic in Cairo) for proving on the L1.

For modifications like configuration parameters, DA layers, genesis state, off-chain workers, and new pallets, forking Madara isn't necessary. Instead, you can import the relevant code as crates/pallets. The app-chain-template demonstrates this approach.

For more complex use cases, such as adding new syscalls to the Cairo VM or altering runtime logic significantly, consider forking parts of Madara.

📣 Peripheral Repositories

Madara's ecosystem includes several peripheral repositories:

🌟 Features

Madara boasts several standout features:

  • Starknet sequencer 🐺
  • Built on Substrate 🌐
  • Rust-based for safety and performance 🏎️
  • Custom FRAME pallets for Starknet functionality 🔧
  • Comprehensive documentation 📚
  • Active development and community support 🤝

🏗️ Build & Run

To get started quickly, refer to the Getting Started Guide for instructions on building and running Madara on your local machine.

Benchmarking

Benchmarking is crucial in Madara's development lifecycle, providing insights into transaction throughput and performance evolution. The Benchmark Page tracks these metrics. Note that these benchmarks, run on a self-hosted GitHub runner, are intended for tracking relative performance changes over time, not as definitive production numbers.

To identify performance bottlenecks, generate flamegraphs with flamegraph-rs:

./target/release/madara setup
flamegraph --root --open  -- ./target/release/madara --dev

Similar Projects