<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Karnot</title>
        <link>https://paragraph.com/@karnot</link>
        <description>We help you deploy app chains using the Starknet Stack
</description>
        <lastBuildDate>Wed, 11 Nov 2026 12:12:16 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <image>
            <title>Karnot</title>
            <url>https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/4e0cbade1f52fff0175351c19226aabf65eb37980ab857fc7c037b1b5447686b.png</url>
            <link>https://paragraph.com/@karnot</link>
        </image>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[Paradex Takes the Wheel: How a Karnot-Run App-Chain Supercharges the SuperDEX]]></title>
            <link>https://paragraph.com/@karnot/paradex-takes-the-wheel-how-a-karnot-run-app-chain-supercharges-the-superdex</link>
            <guid>QV9xa56wBHnu9upsTK2e</guid>
            <pubDate>Mon, 30 Jun 2025 12:02:17 GMT</pubDate>
            <description><![CDATA[Paradex is moving its sequencer to a Karnot-run open-source stack, a shift built on two years of shipping the SuperDEX. This custom infrastructure stack lets Paradex deliver a bespoke trading UX not possible on today’s L1s or L2s, all while retaining Ethereum security. This piece unpacks why the move matters, how it works under the hood, and what it unlocks next. https://x.com/tradeparadex/status/1938570326990008443TL;DRParadex is partnering with Karnot to run its own Madara sequencer on an e...]]></description>
            <content:encoded><![CDATA[<p>Paradex is moving its sequencer to a Karnot-run open-source stack, a shift built on two years of shipping the SuperDEX. This custom infrastructure stack lets Paradex deliver a bespoke trading UX not possible on today’s L1s or L2s, all while retaining Ethereum security. This piece unpacks why the move matters, how it works under the hood, and what it unlocks next.</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/tradeparadex/status/1938570326990008443">https://x.com/tradeparadex/status/1938570326990008443</a></p><h2 id="h-tldr" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">TL;DR</h2><p>Paradex is partnering with Karnot to run its own <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://madara.build"><strong>Madara</strong></a> sequencer on an entirely open-source SN Stack. This custom infrastructure turbocharges Paradex’s roadmap, potentially enabling:</p><p>(i) custom functionality built into the Paradex chain;</p><p>(ii) masked positions at the RPC layer; and</p><p>(iii) $DIME as the native gas token.</p><hr><h2 id="h-paradexs-growth-curve-and-whats-ahead" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Paradex’s Growth Curve &amp; What’s Ahead</h2><p>When Paradex debuted in 2023, it was celebrated as the first Starknet app-chain: a DEX running on a StarkWare-operated sequencer with ETH DA. That setup proved purpose-built chains can match centralised exchanges in throughput and latency while staying fully on-chain.</p><p>Today, the team is pursuing a fuller vision: <strong>the SuperDEX.</strong></p><p>Achieving that “<em>better-than-CEX</em>” UX now hinges on freedoms a generic L1 or L2 can’t grant: RPC-level privacy, total control over every layer of infrastructure, and chain-level protocol upgrades.</p><p>With this new partnership, StarkWare continues to run <strong>SHARP</strong> (the shared proving service), while Karnot takes over sequencing, scaling and more. The result: every performance dial sits in Paradex’s hands, with zero compromise.</p><h2 id="h-shifting-gears-with-madara" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Shifting Gears with Madara</h2><p>Madara is the open-source Starknet sequencer that turns the SN Stack into modular bricks. Together with Paradex, we can integrate custom opcodes, swap DA layers, or migrate state between sequencers. Karnot’s engineers co-maintain Madara, bringing battle-tested familiarity that cuts upgrade risk.</p><p>What a self-owned stack unlocks:</p><ol><li><p><strong>Full Position Privacy.</strong> RPC masking can hide order and position data.</p></li><li><p><strong>Native Gas in $DIME.</strong> Paradex can make $DIME the chain’s gas token.</p></li><li><p><strong>Modular DA Paths.</strong> Pluggable DA lets Paradex drive costs even lower.</p></li></ol><h2 id="h-why-karnot" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Why Karnot?</h2><h3 id="h-madara-core-maintainer" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Madara Core Maintainer</h3><p>Karnot, along with the Kasar Labs team, contributes code, reviews, and actively develops Madara. That hands-on familiarity gives us full control over new features, release timelines, and infrastructure resilience. The same team that ships the sequencer also runs it.</p><h3 id="h-validator-grade-reliability" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Validator-Grade Reliability</h3><p>Karnot operates the second-largest Starknet validator, overseeing roughly <strong>44 million STRK</strong> with <em>perfect uptime</em>. The same operational promise now backs Paradex.</p><h3 id="h-proven-app-chain-track-record" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Proven App-Chain Track Record</h3><p>We’ve partnered with projects like Kakarot and Pragma, and our accelerator supports app-chains building AI marketplaces, RWA platforms, and stablecoin gateways. Furthermore, Karnot collaborates with Finternet, an open protocol layer aiming to connect global financial systems, using our experience running production-grade infrastructure to help build the world&apos;s financial rails.</p><hr><p>Migrating the SuperDEX to a Karnot-run Madara stack turns infrastructure into leverage. Let&apos;s both teams double down on their specialities, trading logic for Paradex, zero-downtime chains for Karnot and set the stage for a new class of high-throughput, privacy-preserving protocols.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/967adf40abf27210fd19b85a0309f3c9feb6a15e1a39d056f0602e7c6497ab78.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Launch Your Own Starknet App Chain Today]]></title>
            <link>https://paragraph.com/@karnot/launch-your-own-starknet-app-chain-today</link>
            <guid>cUoK474200W5Dfj6WZwH</guid>
            <pubDate>Wed, 18 Dec 2024 11:50:41 GMT</pubDate>
            <description><![CDATA[We&apos;re thrilled to announce that after a year of intensive development, the Starknet Stack is ready and available for everyone to use. That’s right! The most powerful ZK stack is now available to deploy app chains and it won’t cost you a fortune. Before we talk about why Karnot, we would like to take a quick trip down the memory lane of Starknet app chains.Why Starknet App Chains?Starkware has been the age old pioneer in the app chain space. Before Starknet even existed, Starkware offered...]]></description>
            <content:encoded><![CDATA[<p>We&apos;re thrilled to announce that after a year of intensive development, the Starknet Stack is ready and available for everyone to use. That’s right! The most powerful ZK stack is now available to deploy app chains and it won’t cost you a fortune.</p><p>Before we talk about why Karnot, we would like to take a quick trip down the memory lane of Starknet app chains.</p><h2 id="h-why-starknet-app-chains" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Why Starknet App Chains?</h2><p>Starkware has been the age old pioneer in the app chain space. Before Starknet even existed, Starkware offered StarkEx chains to some of the most well known web3 companies today - dYdX, Immutable, Sorare and more. However, the solution was closed source and needed work with Starkware for deployment. So almost a year ago, the Madara effort started to build an open source solution for Starknet App Chains.</p><p>Why another stack?</p><p>Native account abstraction, Cairo, state diffs, native execution and more!</p><h3 id="h-key-advantages-of-the-starknet-stack" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Key Advantages of the Starknet Stack</h3><ul><li><p><strong>Native Account Abstraction:</strong> The Starknet Stack offers account abstraction baked right into the protocol. You don’t need to convince external parties that charge you large amounts of money to get ERC 4337. Every account is a smart wallet out of the box!</p></li><li><p><strong>ZK friendly and affordable:</strong> Solidity is great but wait till you put your hands on Cairo. It’s similar to Rust, has a strong developer ecosystem, and is much more efficient when it comes to ZK proving</p><blockquote><p>You can do millions of transactions a month with the Starknet Stack without breaking the bank. A lot of other solutions in the market would charge you $100k/mo for the same scale.</p></blockquote></li><li><p><strong>State diffs:</strong> Unlike optimistic rollups and some ZK rollups, the Starknet Stack doesn’t need to post every transaction on the base chain. You’ve a perp chain where two users trade a million times? Great, just post the final balances on Ethereum. NOT EVERY SINGLE TRANSACTION.</p></li><li><p><strong>Unmatched Performance:</strong> Starknet has already broken the record of maximum TPS achieved by an L2 (<a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.starknet.io/blog/starknet-sustained-tps-record/#:~:text=Starknet%20averaged%20127%20transactions%20per,averaging%20at%20%240.002%20per%20transaction.">857</a>!). And this is before we’ve Cairo native which will make it even faster. Top that up with Stwo coming next year and your costs will get even lower. The Starknet Stack is designed from first principles and is available today, it’s not a dream that you’ll need to wait for another year.</p></li></ul><h2 id="h-the-full-stack-app-chain-suite" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Full Stack App Chain Suite</h2><p>Users who choose to launch with Karnot get</p><ul><li><p>Madara sequencer with autoscaling</p></li><li><p>Voyager explorer</p></li><li><p>A white label bridge and faucet with customization</p></li><li><p>Transparent pricing</p></li><li><p>Seamless upgrades to the latest versions of the stack</p></li><li><p>Real-time monitoring</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/d60c7c2c6c947bbe83aa39e2676e41f807e9e271c00f2b50e6b386eaf3581763.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>You can read in detail about the offering on our <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://karnot.xyz">new website</a>.</p><h2 id="h-why-karnot" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Why Karnot?</h2><p>Two simple reasons</p><h3 id="h-1-core-contributors-to-the-stack" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">1. Core Contributors to the Stack</h3><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/4331e171fae6a11e486a65fc2e0795c98c5bd419b5f41ad03de60cbb3e6a283a.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>At Karnot, we’re not just a RaaS company that offers cloud deployments of an open source stack. We do that of course (at production scale), but along with that, the Karnot team is a core contributor to the Starknet Stack (Madara to be precise). We’ve been maintaining Madara for more than a year now and we understand the stack inside out. Fun fact:</p><blockquote><p>Karnot is the first team outside Starkware that has run an E2E version of the Starknet Stack.</p></blockquote><p>Our deep expertise in the underlying tech not only ensures reliability and security but also allows us to offer very user specific customizations on top of the stack.</p><h3 id="h-2-trusted-across-starknet" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">2. Trusted Across Starknet</h3><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/2aba322751045fed8e6f1d7b7c3f9544810914e987f1676b4ef30be1121b8b6b.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>Don’t trust us, verify! Karnot is the preferred infra partner in the Starknet Ecosystem. At the time of writing this, Karnot operates as the 2nd largest validator on Starknet, securing over 22M of staked STRK. We’re THE infra solution on Starknet and are aligned with it’s long term success.</p><h2 id="h-pricing-that-scales-with-you" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Pricing That Scales With You</h2><p>Karnot is for everyone - from budding startups to large enterprise. Our pricing is simple</p><ul><li><p><strong>Free Devnet and Testnets</strong></p><ul><li><p>No blockers for the tinkerers. Get your devnet for free today and start testing.</p></li></ul></li><li><p><strong>Mainnet Plans at $5,000/month</strong></p><ul><li><p>Designed for growing teams</p></li><li><p>High uptime</p></li><li><p>Detailed monitoring</p></li><li><p>On-call support</p></li><li><p>Customization options</p></li></ul></li><li><p><strong>Enterprise Plans</strong></p><ul><li><p>Tailored solutions with SLAs</p></li><li><p>Higher level of customizations</p></li></ul></li></ul><p>Deploy your Starknet App Chain today.</p><p>Schedule a call with us <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://cal.com/apoorvsadana/karnot">here</a>.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/f807913143d626174fadd853ec0bd6275de4fb44e3c8a5916ab594ce8e10a762.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[xSTRK: Elevating Staking on Starknet]]></title>
            <link>https://paragraph.com/@karnot/xstrk-elevating-staking-on-starknet</link>
            <guid>Q4jr0vYaBwts2jSdwGQs</guid>
            <pubDate>Thu, 07 Nov 2024 12:22:11 GMT</pubDate>
            <description><![CDATA[Staking is coming to Starknet, and we&apos;re excited to be part of this milestone. Here&apos;s why this matters for you.The Foundation: Zero-Commission StakingStaking is fundamental to any blockchain ecosystem – it&apos;s how you participate in securing the network while earning rewards. Powered by Karnot&apos;s zero-commission nodes, with Native Staking you receive 100% of your staking yields, with minimal risk and zero commission.Beyond Basic Staking: Eliminating Opportunity CostsHowever, ...]]></description>
            <content:encoded><![CDATA[<p>Staking is coming to Starknet, and we&apos;re excited to be part of this milestone. Here&apos;s why this matters for you.</p><h2 id="h-the-foundation-zero-commission-staking" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Foundation: Zero-Commission Staking</h2><p>Staking is fundamental to any blockchain ecosystem – it&apos;s how you participate in securing the network while earning rewards. Powered by Karnot&apos;s <strong>zero-commission nodes</strong>, with Native Staking you receive 100% of your staking yields, with minimal risk and zero commission.</p><h2 id="h-beyond-basic-staking-eliminating-opportunity-costs" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Beyond Basic Staking: Eliminating Opportunity Costs</h2><p>However, traditional staking comes with a trade-off: your locked STRK cannot participate in DeFi opportunities.</p><p>Securing the network shouldn’t come with an opportunity cost.</p><h2 id="h-endur-bringing-endurance-to-the-ecosystem" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Endur: Bringing Endurance to the Ecosystem</h2><p>Karnot has joined hands with StrkFarm, to create <strong>Endur</strong>, standing for our vision of endurance, commitment, and growth of the Starknet ecosystem. With Endur, we bring <strong>xSTRK:</strong> a liquid staking solution that combines the best of both worlds.</p><p>With xSTRK, you can:</p><ul><li><p>Earn the base staking yield</p></li><li><p>Maintain full liquidity of your assets</p></li><li><p>Participate in DeFi Spring strategies</p></li><li><p>Use your staked assets across the ecosystem</p></li></ul><h1 id="h-xstrk-an-ecosystem-first-approach" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">xSTRK: An Ecosystem-First Approach</h1><p>While there are several LSTs on Starknet, xSTRK is built with a focus on ecosystem-wide utility. As long-standing members of the ecosystem, we recognize the need for a <strong>neutral</strong>, high-quality LST that can seamlessly integrate across all platforms.</p><h2 id="h-working-with-strkfarm" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Working with StrkFarm</h2><p>We&apos;re thrilled to announce that xSTRK is being developed in partnership with StrkFarm. Their team has been an integral part of the ecosystem for over 2 years, and their track record in building robust ERC 4626 architecture makes them the perfect partner to bring xSTRK to fruition. StrkFarm&apos;s expertise will be instrumental in ensuring xSTRK&apos;s technical excellence and long-term success.</p><h2 id="h-security-first" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Security First</h2><p>Every xSTRK contract undergoes thorough auditing, ensuring your funds only interact with verified, secure code.</p><h2 id="h-integration-ecosystem" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Integration Ecosystem</h2><p>xSTRK is designed for seamless integration across Starknet&apos;s DeFi landscape, with a vision to evolve xSTRK into Starknet’s most liquid LST. xSTRK will be available on DEXs and Market Makers from Day 1. We envision these integrations to further develop with time, allowing the design of complex DeFi instruments atop xSTRK.</p><h1 id="h-the-future-of-staking" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Future of Staking</h1><p>xSTRK introduces ecosystem-wide utility empowering DeFi innovation and boosting network security for Starknet. This marks just the beginning of our commitment to growing the ecosystem.</p><p>Reach out to us at @endurfi &amp; stay tuned for detailed technical specifications and launch information!</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://t.me/+gZw5DWpFtFY2ZDZl">https://t.me/+gZw5DWpFtFY2ZDZl</a></p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/57ac33ea5808beb6ef7a33f0b311f1dd371aca056ece9a810262aaaf2bd2fd10.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Bringing Zero Commission Staking to Starknet]]></title>
            <link>https://paragraph.com/@karnot/bringing-zero-commission-staking-to-starknet</link>
            <guid>iapRQH0s8FTvMUb8dKZR</guid>
            <pubDate>Mon, 23 Sep 2024 15:50:53 GMT</pubDate>
            <description><![CDATA[Starknet achieved a significant milestone with the approval of SNIP 18: Staking’s First Stage on Starknet introducing native staking to the network. With an overwhelming 98.94% vote in favor, this proposal positions Starknet as the only L2 to support staking, marking a crucial step towards realizing it’s vision of a truly decentralized ecosystem.The Importance of StakingStaking is a fundamental mechanism for blockchains, offering benefits that extend beyond simple yield generation.Enhanced Ne...]]></description>
            <content:encoded><![CDATA[<p>Starknet achieved a significant milestone with the approval of <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://community.starknet.io/t/snip-18-staking-s-first-stage-on-starknet/114334">SNIP 18: Staking’s First Stage on Starknet</a> introducing native staking to the network. With an overwhelming 98.94% vote in favor, this proposal positions Starknet as the only L2 to support staking, marking a crucial step towards realizing it’s vision of a truly decentralized ecosystem.</p><h2 id="h-the-importance-of-staking" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Importance of Staking</h2><p>Staking is a fundamental mechanism for blockchains, offering benefits that extend beyond simple yield generation.</p><ul><li><p><strong>Enhanced Network Security</strong>: Enables economic participation from token holders.</p></li><li><p><strong>Long-term Network Stability</strong>: Stakers are vital in <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://community.starknet.io/t/snip-18-staking-s-first-stage-on-starknet/114334#:~:text=the%20network%20by-,producing%2C%20attesting%2C%20and%20proving%20blocks,-.%20However%2C%20it%E2%80%99s%20not">block production, attestation, and proving</a>.</p></li><li><p><strong>Community Engagement</strong>: Opens opportunities for participation and network growth.</p></li></ul><h2 id="h-understanding-starknets-staking-model" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"><strong>Understanding Starknet&apos;s Staking Model</strong></h2><p>Starknet&apos;s implementation introduces a dual participation model that enhances decentralization and aligns network engagement with economic interests:</p><h3 id="h-participants" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Participants:</h3><ul><li><p><strong>Validators:</strong> Run nodes with a minimum of 20,000 STRK, earning rewards from self-staked tokens and commissions on delegated funds.</p></li><li><p><strong>Delegators:</strong> Participate without running infrastructure by delegating any amount of STRK to existing validators.</p></li></ul><p>Furthermore, integrating native staking also extends STRK&apos;s utility to being a gas fee token, governance token, and yield-generating staked asset.</p><h2 id="h-native-staking-with-karnot-empowering-starknets-ecosystem" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Native Staking with Karnot: Empowering Starknet&apos;s Ecosystem</h2><p>As Starknet&apos;s leading Rollup-as-a-Service provider and an active maintainer of <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/MadaraStarknet">Madara</a> (a sequencer &amp; mainnet-ready full node), Karnot offers a unique validator option that aligns closely with Starknet&apos;s vision of a decentralised ecosystem.</p><h3 id="h-key-features-of-karnots-validator" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Key Features of Karnot&apos;s Validator:</h3><ol><li><p><strong>0% Commission:</strong> We intend to launch our validator without any commission allowing more value to flow back into the community.</p><ol><li><p>Our primary goal for offering staking <strong>isn&apos;t revenue generation</strong>, but to contribute toward strengthening the ecosystem and advancing Starknet&apos;s decentralized vision.</p></li><li><p>Our projected roadmap doesn’t include changes to our zero commission policy, as we don’t see staking as a revenue source; we primarily offer RaaS services for the same. However, if there’s a change in this plan, you can be well assured that all delegators will be communicated well in advance. That’s a big if though :)</p></li></ol></li><li><p><strong>Ecosystem Focus:</strong> With nearly two years of experience in the Starknet space, the Karnot team is exclusively dedicated to building and innovating <strong>within</strong> the Starknet ecosystem. We&apos;re aware of multiple stakers and staking solutions launching on Starknet, including companies that offer services across various chains and ecosystems.</p><ol><li><p>While cross-chain experience has its merits, our focus on Starknet allows us to stay deeply engaged with the ecosystem&apos;s latest developments. This engagement is reflected in our up-to-date clients, new integrations, and optimized yield strategies.</p></li></ol></li><li><p><strong>Technical Expertise:</strong> The Karnot team collaborates with projects such as <strong>Kakarot and Pragma</strong>, running full nodes, sequencers, and core infrastructure support. Delegating with Karnot places your funds with Karnot’s secure, battle-tested infrastructure.</p></li><li><p><strong>Governance Participation:</strong> We are actively involved in Starknet governance, community forums, and technical discussions. By staking with Karnot, you strengthen the voice of engaged stakeholders in Starknet&apos;s growth.</p></li><li><p><strong>Dedicated Support:</strong> Our exclusive focus on the Starknet ecosystem <strong>ensures fast updates and 24/7 support</strong> for our nodes.</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/cc46f2cc01f29888bd6070cd0b4974bbf5702eade1a9b0a6217cda32966900dd.png" alt="Just &quot;Stake with Karnot&quot;" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Just &quot;Stake with Karnot&quot;</figcaption></figure><h3 id="h-how-to-stake-with-karnot" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">How to Stake with Karnot:</h3><ul><li><p><strong>Coming Soon</strong>: A user-friendly Karnot staking dashboard where you can:</p><ul><li><p>Connect any compatible wallet containing STRK</p></li><li><p>Stake and manage your delegations</p></li><li><p>View validator details including identity, addresses, active stake, and commission percentage</p></li></ul></li></ul><h2 id="h-empowering-starknets-future-through-staking" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Empowering Starknet&apos;s Future Through Staking</h2><p>At Karnot, we strive to achieve Starknet’s vision of a decentralised integrity-focused ecosystem, your stake contributes to allowing Karnot’s development of crucial infrastructure for Starknet and its app chains.</p><p>To get started or learn more about staking with Karnot, visit our <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.karnot.xyz/">website</a> or follow us on <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/karnotxyz">Twitter</a>. Together, we can contribute to Starknet&apos;s decentralization and secure its future as a leading Layer 2 solution.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/0b630244a590f47701b0b12effbe1ff35f9b74e6a298036ad8b6ce979b42289a.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[The Evolution of Blockchain State Architectures]]></title>
            <link>https://paragraph.com/@karnot/the-evolution-of-blockchain-state-architectures</link>
            <guid>PMsyvlCA8EJIsClyB45s</guid>
            <pubDate>Thu, 05 Sep 2024 13:43:42 GMT</pubDate>
            <description><![CDATA[Special thanks to the Kasar Labs team for discussion and review. Blockchains represent a significant advancement in decentralised, permissionless databases, built to be trustless and scalable. Ethereum, as a prime example is a global database operating with over six thousand nodes that constantly read and write to the blockchain. A distributed system of such proportions demands a state architecture that meets three key criteria: it must be immutably verifiable, enable lightning-fast lookups, ...]]></description>
            <content:encoded><![CDATA[<p><em>Special thanks to the Kasar Labs team for discussion and review.</em></p><p>Blockchains represent a significant advancement in decentralised, permissionless databases, built to be trustless and scalable. Ethereum, as a prime example is a global database operating with over <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://ethernodes.org/"><strong>six thousand nodes</strong></a> that constantly read and write to the blockchain. A distributed system of such proportions demands a state architecture that meets three key criteria: it must be <strong>immutably verifiable</strong>, enable <strong>lightning-fast lookups</strong>, and <strong>scale to handle tens of thousands of writes</strong>.</p><p>Ethereum achieves this by maintaining a &quot;world state&quot; - a global state that is constantly updated by executing transactions. This world state <strong>stores critical information</strong> about Ethereum accounts, such as balances and smart contract states. Each interaction, whether it&apos;s a transfer, NFT mint, or memecoin snipe involves multiple reads and writes to this state. During these interactions, the system accesses the world state and executes state transformation functions to update the state accordingly.</p><p>In this article, we&apos;ll discuss the <strong>evolution of Ethereum&apos;s state architecture</strong>, its future, and how we&apos;ve <strong>reimagined state at Madara</strong>. We&apos;ll explore Madara&apos;s <strong>Bonsai architecture</strong> towards the end, but we recommend reading the preceding sections to establish a solid foundation.</p><h1 id="h-solving-the-state-verifiability-problem" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Solving the State Verifiability Problem</h1><p>The blockchain “verifiability problem” arises from the need for an architecture that can support thousands of reads and writes, while remaining <strong>verifiable even on compute-light machines</strong> (light clients). While centralised databases such as SQL are efficient, scalable and battle-tested, they lack the trustless nature that blockchains require.</p><p>The primary challenge lies in achieving a balance between performance and verifiability. Blockchains require nodes to validate and store each transaction. Consequently, blockchain state architecture must be designed to be lightweight and easy to verify.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/01706ccdff5b9976dd4a4c48fc1cb4ea0807c091a1ab85346c51b6592025c355.png" alt="As the blockchain state expands, block verification requires more resources." blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">As the blockchain state expands, block verification requires more resources.</figcaption></figure><p>As the blockchain state expands, block verification requires more resources, which state architectures like MPTs address. Here we discuss state architectures implemented by Ethereum and Starknet</p><hr><h1 id="h-tries-patricia-tries-and-merkle-trees" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Tries, Patricia Tries &amp; Merkle Trees</h1><blockquote><p>In the following examples, we will use the words <strong>&quot;bin,&quot; &quot;binary,&quot; &quot;tree,&quot; &quot;trie,&quot; &quot;move,&quot; and &quot;movie&quot;</strong> to illustrate the concept of tries. Additionally, we will present the key-value pairs <strong>(bin,10), (binary,8), (move,30), (movie,55), (tree,20), (trie,48)</strong> to demonstrate Merkle trees, Merkle Patricia trees, and Bonsai trees.</p></blockquote><h2 id="h-tries-efficient-retrieval-by-key-lookup" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Tries: Efficient Retrieval by Key-Lookup</h2><p>A trie is an ordered tree data structure used to represent a <strong>set of strings</strong> over an alphabet set. A trie&apos;s architecture allows for the <strong>efficient storage of words</strong> with common prefixes. This design allows optimised checks on the presence of a word in a dictionary.</p><h3 id="h-structure-of-a-trie" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Structure of a Trie</strong></h3><ol><li><p><strong>Nodes</strong>: Each node in a trie represents a prefix of the strings stored. A trie node can have multiple children, each corresponding to a different character.</p></li><li><p><strong>Character Mapping</strong>: Each node contains a mapping from characters to child nodes.</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/311d403a6d2ee545ccad2615a75d3dba8da2761dbc308c9e9f87459a87d27d2b.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h3 id="h-nodes-in-a-trie" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Nodes in a Trie</h3><p>In the adjoining diagram, there are two types of nodes:</p><ol><li><p><strong>Leaf Nodes (Green Nodes):</strong></p><ol><li><p>Signify the end of a branch in a Trie</p></li><li><p>Have a leaf flag to indicate whether the node is a complete word or a prefix.</p></li><li><p>“tree” and “trie” are examples of leaf nodes that signal complete words in the dictionary.</p></li></ol></li><li><p><strong>Intermediate Nodes (Yellow Nodes):</strong></p><ol><li><p>Have a character mapping to one or more child nodes</p></li><li><p>“move” represents an intermediate node, a node that maps two child nodes to its existing prefix.</p></li><li><p>“bin” behaves as a terminal node, representing a full word that exists in the dictionary while also having child nodes of its own.</p></li></ol></li></ol><p>A Trie’s unique design enables straightforward reads of leaf nodes by encoding the string as the path to the leaf node that stores the string. Hence the time complexity for insertion and search is proportional to the length of the string <strong>(O(m))</strong>, where m is the length of the string. This is because each operation involves <strong>traversing ALL the characters.</strong></p><p>Similarly, tries demand a storage complexity of <strong>O(n),</strong> where n is the total size of all strings stored. However, the <strong>height of the trie depends only on the length of the longest string</strong>.</p><h2 id="h-patricia-tries" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Patricia Tries</h2><p>A trie’s structure allows <strong>efficient retrieval of leaf values</strong>, as the string <strong>is sufficient to determine its position</strong> within the Trie. As the Trie expands, this encoding allows for optimised lookup times; however a trie’s naive limitations can also be identified.</p><p>For sparse key sets, a trie may run unnecessarily deep, with many nodes having only one child. Long &apos;single-child&apos; chains increase read and write times due to the need to traverse the entire tree depth.</p><p><strong>PATRICIA</strong> (Practical Algorithm To Retrieve Information Coded In Alphanumeric) <strong>Tries</strong> are a specialised type of trie designed to <strong>optimise space usage</strong> by collapsing chains of nodes with only one child.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/ddd9031534af0b161bf2e6fb77d5b27d9d0eaba58c0c6dd47d76211ce7adb885.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h3 id="h-structure-of-patricia-tries" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Structure of Patricia Tries</strong></h3><ol><li><p><strong>Nodes and Edges</strong>: Each node in a PATRICIA Trie represents a common prefix of the strings stored in the tree. Unlike a standard trie, where each edge corresponds to a single character, <strong>edges in a PATRICIA tree can represent multiple characters</strong>, leading to a more compact structure.</p></li><li><p><strong>Merging Nodes</strong>: In a PATRICIA tree, any node that has only one child is <strong>merged with its parent</strong>. This merging reduces the number of nodes and the overall height of the tree, making it more space efficient.</p></li></ol><p>A Patricia Trie’s optimisations result in improvements in the storage and compute complexity of lookups and insertions. While the worst case time complexity remains proportional to the length of the string (O(m)), due to the collapsed chains, the <strong>actual time can be less than in standard tries.</strong></p><p>Similarly, due to a Patricia tries <strong>space-efficient</strong> design, the <strong>number of nodes required</strong> to represent a (sparse) dictionary reduce.</p><blockquote><p><em>Using Patricia tries, we can create a data structure that </em><strong><em>quickly locates a node&apos;s position in any arbitrary tree based on its key</em></strong><em>. This allows for efficient lookups even in large databases.</em></p></blockquote><h2 id="h-merkle-trees" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Merkle Trees</h2><p>With the implementation of a Patricia trie, we address the challenge of rapid reads/writes by enabling access to data storage slots through knowledge of the corresponding keys. However, in trustless environments, it is essential to ensure that the retrieved data is accurate. While Patricia tries can facilitate data retrieval, they <strong>require two separate read operations to achieve verification</strong>:</p><ol><li><p><strong>Value Retrieval</strong>: The first operation retrieves the value associated with a given key from the trie.</p></li><li><p><strong>Value Validation</strong>: The second operation involves the validator traversing the trie again to validate the correctness of the retrieved value.</p></li></ol><p>To validate without a second read, we can use a tree-like data structure that stores hashed values instead. This approach ensures that any change to the leaf node’s value automatically triggers a rehash across the tree, updating the leaf node and all its parent nodes up to the root.</p><blockquote><p><em>The validation problem is reduced to a simple cryptographic check: </em><strong><em>if the provided leaf hash can be used to reconstruct the root hash through the Merkle proof, we can be </em></strong><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.symbol.dev/concepts/data-validation.html#:~:text=The%20following%20steps,equals%20to%20HRoot."><strong><em>certain that the leaf value is untampered.</em></strong></a></p></blockquote><h3 id="h-structure-of-merkle-trees" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Structure of Merkle Trees</strong></h3><p>This data structure is called a Merkle Tree. It is a tree based structure where <strong>each leaf node represents a hash of the underlying data</strong>, and each non-leaf node is a hash of its child nodes. This recursive hashing mechanism ensures that any data modification alters the hash of the corresponding node, propagating changes up to the root.</p><p>From this, we can derive two important properties:</p><ol><li><p>To verify if all leaf nodes are unchanged between a “trusted” state tree and an “untrusted” state tree, we only need to compare the root node hash.</p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/crypto-0-nite/merkle-proofs-explained-6dd429623dc5">Merkle proofs</a> verify the inclusion of specific data within the tree</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/75dc79245239a29f64ee14749ecc4e2635293fc24d2488d4305e46a93b271016.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>To verify the presence of the leaf node <strong>&quot;bin&quot;</strong>, we compute and return the following hashes:</p><ul><li><p><strong>h(binary)</strong></p></li><li><p><strong>h(h(move)+h(movie))</strong></p></li><li><p><strong>h(h(tree)+h(trie))</strong></p></li></ul><p>By calculating these hash values, we can <strong>traverse through all sibling nodes</strong>, allowing us to <strong>reconstruct the hash of the root node</strong>, to verify whether the leaf node &quot;bin&quot; is included in the tree. Read more on Merkle Proof verification <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.cyfrin.io/blog/what-is-a-merkle-tree-merkle-proof-and-merkle-root#:~:text=To%20prove%20that%20some%20data%20is%20present%20in%20the%20Merkle%20tree%E2%80%93prove%20that%20%E2%80%9CCiara%E2%80%9D%20is%20part%20of%20the%20VIP%20club%3A">here</a> and <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://nakamoto.com/merkle-trees/#:~:text=Have%20an%20idea%3F%20The%20animation%20below%20demonstrates%20the%20answer%20for%20a%20simple%204%2Dword%20e%2Dbook.">here</a>.</p><blockquote><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://ethereum2077.substack.com/p/verkle-trees-for-the-rest-of-us-part-1#:~:text=Merkle%20trees%20enable%20efficient%20verification%20of%20the%20contents%20of%20a%20data%20structure%20by%20storing%20cryptographic%20commitments"><em>Merkle trees enable efficient verification of the contents of a data structure by storing cryptographic commitments.</em></a></p></blockquote><p>Merkle trees excel at <strong>proving data inclusion</strong>. To demonstrate the inclusion of a leaf node, a user can simply request a Merkle proof that shows a particular leaf is a child of the state root. Consequently,<strong>“Verifying Proof of Data Inclusion”</strong> requires only <strong>O(log N)</strong> time.</p><p>However, Merkle trees are <strong>inefficient at retrieving the &quot;actual value&quot;</strong> at the leaf node. This inefficiency arises because the position of a node is independent of it’s key. Hence the only way to fetch the “actual value” of a leaf node is to traverse the entire tree in a brute force fashion.</p><p>Read more about how Ethereum uses Merkle Proofs <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://blog.ethereum.org/2015/11/15/merkling-in-ethereum#:~:text=A">here</a>.</p><hr><h1 id="h-merkle-patricia-trees-ethereums-solution" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Merkle-Patricia Trees: Ethereum’s Solution</h1><p>A Merkle Trees property of enabling efficient checks on inclusion is leveraged in the Bitcoin Network. Light clients can use Merkle proofs to verify the status of a transaction. They do this by requesting a proof that demonstrates the inclusion of a transaction in one of the Merkle trees, with the root of that tree being included in the block header of the main chain.</p><p>This achieves Bitcoin’s use-case as a <strong>peer-to-peer version of electronic cash</strong>. However as Ethereum extends to behave as a <strong>global computer</strong>, Merkle Proofs are limiting. In particular, while Merkle Proofs enable verifying inclusion of transactions, <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://blog.ethereum.org/2015/11/15/merkling-in-ethereum#:~:text=they%20cannot%20prove%20anything%20about%20the%20current%20state">proving the current state would require multiple, expensive reads.</a></p><p>Ethereum&apos;s state architecture must meet two crucial requirements:</p><ul><li><p><strong>Rapid Access:</strong> The architecture must support fast reads and writes to the state</p></li><li><p><strong>Verifiability:</strong> Ethereum&apos;s state must allow inclusion proofs</p></li></ul><p>To achieve this, Ethereum takes the Merkle tree concept one step further with <strong>“Merkle Patricia Trees”.</strong></p><blockquote><p><strong>Trees &amp; Tries</strong>: A tree in is a hierarchical data structure consisting of nodes connected by edges, where each node has at most one parent and zero or more children, with a single root node at the top.</p></blockquote><blockquote><p>A trie is a specialised tree-like structure designed to store strings. Each node in a trie represents one or more characters and paths corresponds to prefixes. A Merkle Patricia Tree derives properties from the Patricia Trie but is categorised as a Tree.</p></blockquote><h2 id="h-merkle-patricia-trees" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Merkle Patricia Trees</h2><p>Merkle Patricia Trees, are specialised tree structures that combine the benefits of Merkle Trees and Patricia Tries. In particular, with an MPT, Ethereum gains the data integrity guarantees of a Merkle Tree, alongside the optimised reads/writes achieved through Patricia Tree’s key encoding. Due to these design advantages, MPTs today power Ethereum and several other blockchains.</p><h3 id="h-structure-of-a-hexary-merkle-patricia-tree" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Structure of a</strong> Hexary <strong>Merkle Patricia Tree</strong></h3><ol><li><p><strong>Node Types</strong>: In a Hexary Merkle Patricia Tree, nodes are categorised into three types:</p><ul><li><p><strong>Branch Nodes</strong>: These nodes can have up to 16 children, representing the 16-character hexadecimal alphabet. Each branch node contains a hash for each of its child nodes.</p><ul><li><p><strong>Storage</strong>: Represented as a 17-item array, where the first 16 elements are pointers to child nodes, and the last element stores the value, if applicable.</p></li></ul></li><li><p><strong>Leaf Nodes</strong>: These nodes indicate the end of a path in the trie and contain the final segment of the path along with the associated value.</p><ul><li><p><strong>Storage</strong>: Stored as a 2-item array, consisting of the encoded path and the value.</p></li></ul></li><li><p><strong>Extension Nodes</strong>: Similar to Patricia trees, these nodes optimise the trie by compressing paths for nodes with a single child, reducing the number of nodes required.</p><ul><li><p><strong>Storage</strong>: Stored as a 2-item array, which includes the encoded path and a reference to the next node.</p></li></ul></li></ul></li><li><p><strong>Hashing</strong>: Similar to Merkle trees, each node in the tree has a unique hash value derived from its content. This ensures that any alteration in the data results in a change in the root hash, making tampering evident.</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/7fd1397df8132532ae1158aee83369ae3ac08794f579dd61ed3f4d47a90ec3f4.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>The MPT is visualised as a tree, however it is stored in a key-value database like RocksDB where each node is serialised and stored as a value, with its hash serving as the key. This allows for efficient retrieval and verification of nodes based on their hash values.</p><p>In the above example,</p><ul><li><p>The root node (h1) is a branch node that points to two child nodes (h2 and h3); it’s children are stored as a 17 member array with the first 16 nodes being pointers and the 17th member being the (optional) value</p></li><li><p>Node h3 is an extension node that points to another node (h6). Extension nodes have a 2 item array, with the first member as the encoded path and the second member as the hash to the child node.</p></li><li><p>Node h9 is a leaf node and has no children. Leaf nodes have a 2 item array as well, similar to extension nodes, with the first member as the encoded path and the second member as the hash to the child node.</p></li></ul><p>Leaf nodes and Extension nodes are differentiated through the use of a bit prefix, however we’ve omitted this detail to maintain simplicity in the diagram.</p><h3 id="h-reads-and-writes-in-merkle-patricia-trees" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Reads &amp; Writes in Merkle Patricia Trees</strong></h3><ul><li><p><strong>Key Lookup</strong>: When a read request is made, the system begins by converting the key into its corresponding hexadecimal representation.</p></li><li><p><strong>Traversal for Insertion</strong>: The system traverses the Tree using the hexadecimal string. If a suitable path does not exist (e.g., the key is new), the tree structure may need to be modified:</p><ul><li><p>At each branch node, the tree traverses between <code>0-9 or 0xA-0xF</code> allowing the trie to split across upto 16 child nodes.</p></li><li><p>New nodes may be created if the key diverges from existing prefixes.</p></li><li><p>Extension nodes may be added to compress the tree further.</p></li></ul></li></ul><p>To read the value encoded by the string &quot;binary&quot; in a Merkle Patricia Tree, follow this process:</p><ol><li><p><strong>Convert &quot;binary&quot; to a Hexadecimal String</strong>:</p><p>The string &quot;binary&quot; is converted to its hexadecimal representation: <code>0x62696e617279</code>.</p></li><li><p><strong>Descend the Tree</strong>:</p><p>Begin at the root branch node. At each branch node, descend to the child node linked to the current index of the hexadecimal string. The traversal follows the sequence of digits in the hexadecimal string: start with <code>6</code>, then move to <code>2</code> and continue this pattern until reaching the last digit <code>9</code>.</p></li><li><p><strong>Handling Extension Nodes</strong>:</p><p>When you reach an extension node, you can skip a prefix of the string entirely. This is possible because an extension node indicates that the prefix is common among all its child nodes, eliminating the need to traverse to a specific child node.</p><ul><li><p>In the above example on traversing the tree, starting with <code>6</code> and then <code>2</code> we reach an extension node. Extension nodes bypass unnecessary nodes allowing the traversal to skip <code>0x696e</code> and reach the next branch node.</p></li></ul></li><li><p><strong>Reaching the Leaf Node</strong>:</p><p>Finally, you will arrive at the leaf node. The key section of the path can be compressed into a single key, allowing you to read the value stored at the leaf node.</p></li></ol><p>The MPT inherits it’s compute complexity from the Patricia Tree’s structure with operations such as <strong>insertion, search, and verification proportional to the height of the tree</strong>, which is logarithmic in the number of leaf nodes <strong>(O(log n))</strong>. Similarly, the space complexity is also optimised due to the use of Patricia Trie&apos;s collapsing mechanism and the efficient hashing of Merkle Trees. <strong>This results in a space complexity that is generally better than standard tries (O(n))</strong>.</p><h2 id="h-binary-merkle-patricia-trees" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Binary Merkle Patricia Trees</h2><p>Hexary Merkle Patricia Trees build short trees of height $$log(n)/log(16)$$, creating shorter Merkle Paths than in a Binary Tree. This allows faster computation, as <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://eips.ethereum.org/EIPS/eip-3102#:~:text=Over%20the%20course%20of%20the%205%20years%20of%20Ethereum%E2%80%99s%20existence%2C%20it%20has%20become%20apparent%20that%20disk%20accesses%20are%20a%20greater%20bottleneck%20than%20hashing.">disk accesses are a greater bottleneck than hashing</a>; shorter trees means fewer DB reads.</p><blockquote><p><em>The Ethereum tree was originally hexary because database accesses are expensive and this </em><strong><em>would reduce the number of database reads</em></strong><em>. However, with some clever storage optimisations we can achieve hexary-like database accesses even with a binary tree (see </em><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://ethresear.ch/t/optimizing-sparse-merkle-trees/3751#:~:text=And%20here%20is,binary%20tree%20implementation"><em>https://ethresear.ch/t/optimizing-sparse-merkle-trees/3751#:~:text=And here is,binary tree implementation</em></a><em>.)</em></p></blockquote><p>By optimising database reads to be hexary-like, we can make BMPTs equally DB efficient as Hexary ones. Binary Trees have only 2 children per node, so BMPT Merkle proofs require 15x less node information to be sent (one sibling vs 15 in a hexary tree), while only being 4x longer than a Hexary tree; ~4x savings.</p><p>Noting this, EIP 3102 proposed switching Ethereum to a Binary Merkle Patricia Tree. As “<strong>hashing was computationally cheaper than disk accesses”</strong>, binary tries looked to maximise hashing by growing the length of the tree while reducing its breadth.</p><p>Consequently, with a binary tree we achieve <strong>low proof sizes</strong> and a more <strong>efficient representation in the database</strong>.</p><pre data-type="codeBlock" text="In general, in an N-element tree with each element having k children, 
the average length of a branch is roughly 32 * (k-1) * log(N) / log(k)
plus a few percent for overhead. 

32 is the length of a hash; the k-1 refers to the fact that a Merkle proof 
needs to provide all k-1 sister nodes at each level, and log(N) / log(k) 
is an approximation of the number of levels in the tree 

For any N, the expression is minimized at k = 2. 
Here’s a table of branch lengths for different k values assuming N = 2**24:
"><code>In general, in an N<span class="hljs-operator">-</span>element tree with each element having k children, 
the average length of a branch <span class="hljs-keyword">is</span> roughly <span class="hljs-number">32</span> <span class="hljs-operator">*</span> (k<span class="hljs-number">-1</span>) <span class="hljs-operator">*</span> log(N) <span class="hljs-operator">/</span> log(k)
plus a few percent <span class="hljs-keyword">for</span> overhead. 

32 <span class="hljs-keyword">is</span> the length of a hash; the k<span class="hljs-number">-1</span> refers to the fact that a Merkle proof 
needs to provide all k<span class="hljs-number">-1</span> sister nodes at each level, and log(N) <span class="hljs-operator">/</span> log(k) 
<span class="hljs-keyword">is</span> an approximation of the number of levels in the tree 

For any N, the expression <span class="hljs-keyword">is</span> minimized at k <span class="hljs-operator">=</span> <span class="hljs-number">2.</span> 
Here’s a table of branch lengths <span class="hljs-keyword">for</span> different k values assuming N <span class="hljs-operator">=</span> <span class="hljs-number">2</span><span class="hljs-operator">*</span><span class="hljs-operator">*</span><span class="hljs-number">24</span>:
</code></pre><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/b2fc010219ff24511bcc3510f9d0a3f176f01a9d0f4e4ce65f0eccb1b55e7d3e.png" alt="The expression 32" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">The expression 32</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/3dae24c7dc1507615cd4c9d61fddf158328a6bf99db0744617bf3a228d4f0ab1.png" alt="For n=2^256, the branch length increases rapidly with a small change in the value of ‘k’" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">For n=2^256, the branch length increases rapidly with a small change in the value of ‘k’</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/c8bb2f090dffcf64c1c419bd746d0b3b26d4fe627772e69eba48ee071ef23bd7.png" alt="A Quaternary Tree with 17 children requires only 3 levels, however a Merkle Proof for node 16 contains 6 nodes ((14,15,17), (2,3,5))" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">A Quaternary Tree with 17 children requires only 3 levels, however a Merkle Proof for node 16 contains 6 nodes ((14,15,17), (2,3,5))</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/3ef56750f4467512c31f6fae8298be0a4cfafdfef1c8729ec55ddd80b603f13d.png" alt="A Binary Tree with 17 children requires 5 levels, however a Merkle Proof for node 16 contains only 4 nodes (17,9,5,3)" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">A Binary Tree with 17 children requires 5 levels, however a Merkle Proof for node 16 contains only 4 nodes (17,9,5,3)</figcaption></figure><p>While EIP 3102 was shelved in favor of Ethereum’s <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://volt.capital/blog/the-merge?ref=bankless.ghost.io#:~:text=History%20%26%20State%20(The%20Verge%20%26%20The%20Purge)">“Verge”</a>, it was picked up by several rollups including Starknet, which now <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.starknet.io/architecture-and-concepts/network-architecture/starknet-state/#merkle_patricia_trie">operates as a Binary MPT</a>.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/f5022a7e702ec37e1970b071ac9e584d368cea4374bf5959aefc3b1813f28019.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>Similar to a hexary MPT, a binary MPT is also stored in a key-value database like RocksDB where each node is serialized and stored as a value, with its hash serving as the key. This allows for efficient retrieval and verification of nodes based on their hash values.</p><p>In the above example,</p><ul><li><p>The root node (h1) is an extension node that points to its child node (h2). Extension nodes have a 2 item array, with the first member as the encoded path and the second member as the hash to the child node.</p></li><li><p>The node (h2) is a branch node that points to two child nodes (h3 and h4); it’s children are stored as a 3 member array with the first 2 nodes being pointers and the 3rd member being the (optional) value</p></li><li><p>Node h12 is a leaf node and has no children. Leaf nodes have a 2 item array as well, similar to extension nodes, with the first member as the encoded path and the second member as the hash to the child node.</p></li></ul><p>Leaf nodes and Extension nodes are differentiated through the use of a bit prefix, however we’ve omitted this detail to maintain simplicity in the diagram.</p><h3 id="h-structure-of-binary-merkle-patricia-trees" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Structure of Binary Merkle Patricia Trees</strong></h3><p>The structure of a Binary MPT is quite similar to a Hexary MPT, with a simple modification where <strong>each</strong> node has upto two children. This design results in a longer tree—potentially up to four times longer than its hexary counterpart. However, the benefits of this structure are substantial.</p><p>In a BMPT, each branch node has only one sibling instead of fifteen, which achieves a reduction in the size of Merkle proofs, leading to a <strong>reduction of up to fifteen times</strong> in the data required for these proofs.</p><p>Additionally, BMPTs carry forward all the optimizations achieved by combining Merkle and Patricia trees.</p><p>A Binary Merkle Patricia Tree is architecturally similar to a Hexary Merkle Patricia Tree, hence it’s reads and writes are performed in a similar fashion, where bits are compared instead of hexadecimal digits for path encoding. The time and space complexity are also similar.</p><h1 id="h-the-limitations-of-current-solutions" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Limitations of Current Solutions</h1><p>While Merkle Patricia Trees and its binary version has significantly improved Ethereum&apos;s state management, challenges persist as the blockchain continues to grow. Today, an Ethereum archive node requires <strong>over 12 TB of storage</strong>, highlighting the need for more efficient state architectures.</p><ol><li><p><strong>Storage Bloat</strong>: As the chain grows, so does the state size, leading to increasing storage requirements.</p></li><li><p><strong>Read Performance</strong>: Taller Merkle paths in growing trees result in slower read times, especially for accessing historical state.</p></li><li><p><strong>Write Overhead</strong>: Updates to the state require traversing and updating the entire path from leaf to root, which becomes more time-consuming as the tree grows.</p></li></ol><p>These challenges have led to the development of stopgap measures such as <strong>state snapshots and pruning</strong>.</p><hr><h1 id="h-bonsai-a-unique-solution-to-the-state-problem" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Bonsai: A Unique Solution to the State Problem</h1><p>Developed by <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://consensys.io/blog/bonsai-tries-guide">Consensys</a>, Bonsai reimagines state storage and access rather than incrementally improving upon existing tree structures. This new approach is built on two key insights:</p><ol><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://ethereum.org/en/developers/docs/nodes-and-clients/archive-nodes/#:~:text=An%20execution%20layer%20client%20configured%20as%20a%20full%20node%20verifies%20and%20follows%20the%20latest%20state%20of%20the%20network%20but%20only%20caches%20the%20past%20few%20states%2C%20e.g.%20the%20state%20associated%20with%20the%20last%20128%20blocks%2C%20so%20it%20can%20handle%20chain%20reorgs%20and%20provide%20fast%20access%20to%20recent%20data">For non-archive nodes, the <strong>majority of state reads</strong> occur within the most recent 500 blocks.</a></p></li><li><p>Optimising for recent state access can yield <strong>significant performance improvements</strong> and storage savings.</p></li></ol><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/67fdeab32b68b6e8f827ee03ea4fa49f72e11fd772593bf5b0ea3d34ecf83538.png" alt="Storage Comparisons for Full Archive Nodes: " blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Storage Comparisons for Full Archive Nodes:</figcaption></figure><h2 id="h-key-features-of-bonsai" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"><strong>Key Features of Bonsai</strong></h2><p>The Bonsai Tree stands apart due to it’s distinct feature sets</p><ul><li><p><strong>O(1) read times</strong></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://besu.hyperledger.org/23.4.0/public-networks/concepts/data-storage-formats#:~:text=With%20an%20archive%20node%2C%20forest%20mode%20uses%20an%20estimated%2012%20TB%20of%20storage%2C%20while%20Bonsai%20uses%20an%20estimated%201100%20GB%20of%20storage"><strong>90% reduced storage</strong></a> requirement (under optimal conditions where Bonsai retains all trie logs and minimal snapshots to balance storage and read times)</p></li></ul><p>These metrics can be achieved due to Bonsai&apos;s implementation of leaf nodes as <strong>&quot;directly accessible key-value pairs in a flat database&quot;.</strong></p><blockquote><p><em>A flat database is a data storage structure that organises data in a two-dimensional format, consisting of rows and columns, where each row represents a record and each column represents a field.</em></p></blockquote><h2 id="h-bonsai-tree-structure" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Bonsai Tree Structure</h2><p>A Bonsai tree is a modified Binary Merkle Patricia Tree that stores leaf nodes in a flat database; hence significantly optimising read times. Unlike traditional Merkle Patricia Trees, where reading data requires traversing from the root node to a leaf, Bonsai enables retrieval with a single disk read.</p><p>However, updates or writes to the Bonsai tree are performed similarly to those on a BMPT, requiring traversal of the entire tree. This traversal is necessary to update the hashes for each parent node.</p><p>It is important to note that Bonsai stores state trie nodes based on their location within the trie. Therefore, an update to a value does not change its flat-DB key, allowing for O(1) reads to be maintained even after state updates.</p><blockquote><p><em>While most representations of Ethereum&apos;s </em><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/cybermiles/diving-into-ethereums-world-state-c893102030ed"><strong><em>global state trie</em></strong></a><em> use a key-value store indexed by each node&apos;s hash, </em><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://besu.hyperledger.org/public-networks/concepts/data-storage-formats#bonsai-tries"><strong><em>Bonsai</em></strong></a><strong><em> stores state trie nodes based on their location within the trie. This allows for direct access to an account&apos;s data</em></strong>** from storage using its key**</p></blockquote><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/c9acbc9accdeca24d4773f89bed0be1ed59f4ea0ff464e6da92bbaf9c573573a.png" alt="The Bonsai tree is an modified Binary Merkle Patricia Tree that stores leaf nodes in a flat-database to enable O(1) read times" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">The Bonsai tree is an modified Binary Merkle Patricia Tree that stores leaf nodes in a flat-database to enable O(1) read times</figcaption></figure><p>The Bonsai tree is an modified Binary Merkle Patricia Tree that stores leaf nodes in a flat-database to enable O(1) read times</p><p>To present a short example of Bonsai’s state reads and updates, we can refer to the diagram above. Note that the diagram is a simplification and omits certain steps of tree construction.</p><h3 id="h-read-operations-in-bonsai-trees" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Read Operations in Bonsai Trees</strong></h3><p>Reading data from a Bonsai Tree involves retrieving information based on a specific key. Here’s how it works:</p><ul><li><p><strong>Key Lookup</strong>: The system converts the data queried into its corresponding flat database key.</p></li><li><p><strong>Data Retrieval</strong>: The system queries the flat database using the calculated key. By skipping the trie traversal, Bonsai Trees can achieve O(1) access times.</p></li></ul><p>To read the value encoded with the key <code>bin</code> in a Bonsai Tree:</p><ol><li><p><strong>Key to Storage Translation</strong>: Bonsai stores data internally with the a calculated hash as the flat-database key, in our example this is <code>h(bin)</code></p></li><li><p><strong>Direct Storage Lookup</strong>: With the hash, Bonsai directly queries the flat-database and retrieves the data.</p><ol><li><p>This lookup is performed without traversing any trie structure or computing hashes.</p></li></ol></li></ol><h3 id="h-write-operations-in-bonsai-trees" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Write Operations in Bonsai Trees</strong></h3><p>Writing data involves updating the state of the Bonsai Tree and the flat database:</p><ul><li><p><strong>Key Conversion:</strong> The path key is converted into a binary string.</p></li><li><p><strong>Traversal for Insertion:</strong> The system traverses the Bonsai Tree using the binary string. If a suitable path doesn&apos;t exist, the tree structure may need modification.</p><ul><li><p>New nodes may be created if the key diverges from existing prefixes.</p></li><li><p>Extension nodes may be added to compress the tree further.</p></li></ul></li><li><p><strong>Updating the Flat Database:</strong> Once the appropriate leaf node is identified or created, the system updates it with the new value</p></li></ul><p>An example of writing data to a Bonsai Tree is as follows.</p><ol><li><p><strong>Identify the Storage Slot</strong>: The key that is being written to is <code>bin</code> , this key is converted to it’s binary equivalent <code>01100010 01101001 01101110</code></p></li><li><p><strong>Modify State Data</strong>: For example, let&apos;s say the value for this key needs to be updated from <code>10</code> to <code>11</code>.</p></li><li><p><strong>Update the Leaf Node</strong>: The system locates the leaf node associated with the key <code>bin</code> in the flat database.</p><ol><li><p>A trie traversal is performed, descending down the Bonsai trie according to the calculated binary key</p></li><li><p>The final branch node in the path has the leaf node as a child. This leaf node is used to update hashes for parent nodes, whereas the actual value for the leaf node is stored and accessed from the flat-database.</p></li></ol></li><li><p><strong>Write New State Data</strong>: The new state data (e.g., updated value of <code>11</code>) is written to the identified leaf node. The trie structure is updated to reflect this new state.</p></li><li><p><strong>Calculate New Root Hash</strong>: After updating the trie, the system recalculates all parent hashes up to the root hash of the trie.</p></li></ol><p>Thus, to write to a Bonsai Tree, the client must update all parent nodes of that leaf. This results in writes taking as long as Binary Merkle Patricia Trees.</p><h2 id="h-accessing-legacy-state-in-bonsai" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Accessing Legacy State in Bonsai</h2><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/590a96db6cd3c62391f02efcce74542ca0788e2f9bbcc96173daa2034d604895.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>Ethereum’s MPT allows for efficient retrieval of older data by maintaining a link between the current state and its historical versions. Each block in the blockchain contains a root hash of the state trie, which reflects the state of all accounts and contracts at that particular block.</p><p>As an MPT preserves older blocks, a user only needs to specify the block they want to query to access older data. Since all states are linked, an older block in the MPT can be fetched, and its state tree can be read. The MPT also allows unchanged storage in newer blocks to reference older blocks, reducing data duplication. Therefore, reading storage from block 175224 may require accessing block 175223, as the state tree of the former points to the latter.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/4416296102c3d97c2ba8c95393ce5fd5b1fe77738293b93df47f1cac9615f1b4.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>In a Bonsai tree, <strong>keys to leaf nodes are derived from their location</strong> in the trie rather than from the values of child nodes, as is the case with Merkle Patricia Trees. Consequently, when a leaf node value is updated, the previous value cannot be retained, and Bonsai <strong>only stores the latest state</strong>, automatically pruning older values with each update.</p><p>To access older state data, Bonsai utilizes <strong>trielogs</strong>, which capture modifications made to leaf nodes within a specific block. Each trielog records updates to the flat-database including both previous and current values. These trielogs are stored in the database with the block hash as the key.</p><h3 id="h-a-discussion-on-trie-logs" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">A Discussion on Trie Logs</h3><p>Trielogs represent the differences between two blocks’ states by capturing each modification. To read an older state, a node can use the trielogs to selectively revert or apply changes. By traversing the trielogs from the current block back to the desired block, the node can reconstruct the state at that specific point in time.</p><p>For example, to read the state at block 175223, a node would start from the current block and apply the trielogs in reverse order until it reaches block 175223.</p><p>A simplified example of Trie Logs is attached below.</p><pre data-type="codeBlock" text="Block Hash: 0xabcdef1234567890...

Trielog:

  - Account: 

    - Account address: 0x1234567890abcdef...

    - Previous Value: { balance: 100, nonce: 0 , ...}

    - Next Value: { balance: 150, nonce: 1 , ...}

  - Storage Slot:

    - Account address: 0x1234567890abcdef...

    - Slot key: 0x0111...

    - Previous Value: 0x01

    - Next Value: 0x02

  - Code:

    - Account address: 0x1234567890abcdef...

    - Previous Value: 0xaabbccddeeff...

    - Next Value: 0x112233445566...
"><code>Block Hash: <span class="hljs-number">0xabcdef1234567890</span>...

Trielog:

  <span class="hljs-operator">-</span> Account: 

    <span class="hljs-operator">-</span> Account <span class="hljs-keyword">address</span>: <span class="hljs-number">0x1234567890abcdef</span>...

    <span class="hljs-operator">-</span> Previous Value: { balance: <span class="hljs-number">100</span>, nonce: <span class="hljs-number">0</span> , ...}

    <span class="hljs-operator">-</span> Next Value: { balance: <span class="hljs-number">150</span>, nonce: <span class="hljs-number">1</span> , ...}

  <span class="hljs-operator">-</span> Storage Slot:

    <span class="hljs-operator">-</span> Account <span class="hljs-keyword">address</span>: <span class="hljs-number">0x1234567890abcdef</span>...

    <span class="hljs-operator">-</span> Slot key: <span class="hljs-number">0x0111</span>...

    <span class="hljs-operator">-</span> Previous Value: <span class="hljs-number">0x01</span>

    <span class="hljs-operator">-</span> Next Value: <span class="hljs-number">0x02</span>

  <span class="hljs-operator">-</span> Code:

    <span class="hljs-operator">-</span> Account <span class="hljs-keyword">address</span>: <span class="hljs-number">0x1234567890abcdef</span>...

    <span class="hljs-operator">-</span> Previous Value: <span class="hljs-number">0xaabbccddeeff</span>...

    <span class="hljs-operator">-</span> Next Value: <span class="hljs-number">0x112233445566</span>...
</code></pre><h2 id="h-key-elements-of-the-bonsai-architecture" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Key Elements of the Bonsai Architecture</h2><ol><li><p><strong>Bonsai’s Flat Database:</strong></p><ul><li><p>As Ethereum&apos;s state grows, <strong>Merkle paths</strong> <strong>become taller</strong>, leading to slower read times as tree traversal grows complex.</p></li><li><p>With Bonsai’s architecture, <strong>O(1) read times</strong> can be achieved <strong>by directly accessing leaves in the flat database</strong></p></li></ul></li><li><p><strong>Single State Representation:</strong></p><ul><li><p>Bonsai’s prioritises <strong>providing “real-time” state</strong> over functioning as an archive node.</p></li><li><p>This design enables the Bonsai tree to store <strong>only the latest state representation</strong> at any given time, resulting in no connections to previous blocks.</p></li><li><p>Consequently, this leads to a <strong>significantly more compact state representation</strong> compared to an MPT.</p></li><li><p>However, a single state representation means, unlike an MPT, Bonsai trees do not store previous block information in it’s state tree</p></li></ul></li><li><p><strong>Trielogs:</strong></p><ul><li><p>With a Single State Representation, Bonsai is still <strong>able to serve older block data</strong> through the use of Trielogs</p></li><li><p>Trielogs <strong>represent the differences between two blocks’ states</strong> by capturing each modification made.</p><ul><li><p>They contain the <strong>prior and next versions for each modification</strong>, allowing for state changes to be reverted or applied selectively.</p></li><li><p>Through the use of Trielogs, Bonsai trees can efficiently <strong>perform chain reorganisations</strong> by “rolling back” or “rolling forward” state.</p></li></ul></li><li><p>While enabling transitions between states, a recursive application of Trielogs to attain an older state can be both computationally and storage-wise expensive.</p><ul><li><p>Thus, bonsai’s read-first design comes at a tradeoff of being unoptimised for reads on extremely old blocks.</p></li></ul></li></ul></li></ol><h1 id="h-conclusion" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Conclusion</h1><p>In conclusion, blockchain state architectures have evolved significantly to address the challenges of verifiability, scalability, and performance. From simple Merkle trees to more complex structures like Merkle Patricia Trees (MPTs) and their binary variants, each iteration has brought improvements in efficiency and functionality.</p><p>Bonsai as the latest innovation represents a shift in state management. By storing leaf nodes in a flat database, Bonsai achieves O(1) read times and significantly reduces storage requirements. While optimized for recent state access, Bonsai uses trielogs to maintain historical data accessibility.</p><p>This evolution in state architecture demonstrates the ongoing efforts to balance the needs for rapid access, verifiability, and efficient storage in blockchain systems, paving the way for more scalable and performant decentralized networks.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/469fb3e569e90d2691e8803e0d2841c027a99e5139a3137ed18ed29da9bceeed.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[The Starknet-Appchain Paradigm]]></title>
            <link>https://paragraph.com/@karnot/the-starknet-appchain-paradigm</link>
            <guid>C4rhGla2QHMQKb1si45E</guid>
            <pubDate>Tue, 20 Aug 2024 13:28:57 GMT</pubDate>
            <description><![CDATA[The Rollup Ecosystem TodayThe Ethereum scaling landscape has expanded rapidly in recent years; introducing rollups that repurpose the L1 as a settlement layer. Traditionally featuring Optimistic L2s including Arbitrum and Optimism, and zkEVMs such as Scroll and Taiko; rollups today have enabled a surge in economic and network activity across the Ethereum landscape. While L2s enable complete modularity on all elements of the stack, most rollups operate as near-identical-EVMs. This approach doe...]]></description>
            <content:encoded><![CDATA[<h1 id="h-the-rollup-ecosystem-today" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Rollup Ecosystem Today</h1><p>The Ethereum scaling landscape has expanded rapidly in recent years; introducing rollups that repurpose the L1 as a settlement layer. Traditionally featuring Optimistic L2s including Arbitrum and Optimism, and zkEVMs such as Scroll and Taiko; rollups today have enabled a surge in economic and network activity across the Ethereum landscape.</p><p>While L2s enable <strong>complete modularity</strong> on all elements of the stack, most rollups operate as <strong>near-identical-EVMs.</strong> This approach does have merits: it ensures a consistent user experience, allowing rollups to feel &quot;native&quot; to the L1, and the reuse of Solidity contracts and EVM wallets allows a seamless transition for developers and users.</p><p>However, these benefits come at a significant cost. Such an architecture is <strong>constrained by the inherent limitations of EVMs,</strong> effectively carrying forward the very constraints L2s were meant to overcome. This ultimately undermines the core purpose and flexibility of L2s, which were intended to be a platform for innovation rather than mere <strong>scaled copies of existing systems</strong>.</p><p>This results in the carrying forward of EVMs’ ZK-unfriendly elements, such as the <strong>Keccak Opcode,</strong> which is exponentially more expensive to prove, and the Solidity programming language, whose shortcomings have often been critiqued.</p><p>Observing the limitations an EVM-identical rollup would suffer, Starknet chose an alternate approach with its ZK-focused Cairo VM.</p><h2 id="h-the-ideology-behind-starknet" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">The Ideology Behind Starknet</h2><p>Starknet&apos;s vision was to reinvent an L2 from first principles. Starting with a clean slate allowed Starknet to make unconstrained decisions across all aspects of its chain.</p><p>For instance, <strong>Native Account Abstraction</strong> is standard for all Starknet wallets, yet account abstraction is still unseen in most other rollups. Similarly, Starknet developed Cairo, a new <strong>smart contract language</strong> designed specifically for ZK proofs, rather than adapting Solidity for ZK compatibility.</p><p>This redesign allowed Starknet to build a rollup without inheriting the technical debt of EVMs.</p><h2 id="h-starknet-tech-overview" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Starknet Tech Overview</h2><h3 id="h-1-cairo-rust-like-and-provable" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">1. Cairo: Rust-Like &amp; Provable</h3><p>The Cairo programming language was invented by StarkWare to resolve the flaws of Solidity that were discovered through a decade of experimentation. Cairo is the result of a vision to create a <strong>“better Smart Contract Programming Language”</strong> that is “<strong>innately ZK-Friendly”.</strong></p><p>The Cairo programming language, invented by StarkWare, resolves the flaws of Solidity discovered through a decade of experimentation. Cairo is designed to be <strong>&quot;innately ZK-Friendly&quot;,</strong> unlike Solidity, which was <strong>solely focused on smart contract development</strong> and includes several ZK-unfriendly components, such as the <strong>Keccak hash</strong> and its version of the <strong>Merkle Patricia Tree.</strong></p><p>Cairo addresses Solidity’s limitations, including <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.soliditylang.org/en/latest/introduction-to-smart-contracts.html#:~:text=Calls%20are%20limited%20to%20a%20depth%20of%201024%2C%20which%20means%20that%20for%20more%20complex%20operations%2C%20loops%20should%20be%20preferred%20over%20recursive%20calls"><strong>stack management</strong></a><strong>, </strong><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.soliditylang.org/en/latest/types.html"><strong>linear type system</strong></a><strong>, and function imports</strong>, while being <strong>tailored for provability.</strong> For example, Cairo is not constrained by the limitations imposed by the EVM, such as the <strong>Keccak Opcode</strong>, which is approximately <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://scroll.io/blog/zkevm#:~:text=Keccak%20hash%20is%201000x%20larger%20than%20Poseidon%20hash%20in%20circuit.">1000x larger in circuit size</a> compared to ZK-friendly hash functions like <strong>Poseidon</strong>.</p><p>By addressing Solidity&apos;s limitations and optimizing for ZK-proving, Cairo positions itself as a future-ready smart contract development language, particularly for ZK apps.</p><h3 id="h-2-account-abstraction" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">2. Account Abstraction</h3><p>Another example of a shortcoming rooted in the EVM-identical approach is the lack of Account Abstraction across the rollup space.</p><p>Account abstraction enables the use of smart contracts instead of traditional Externally Owned Accounts. <strong>EIP-4337</strong> has been on the <strong>Ethereum roadmap for years</strong> now, with Vitalik himself admitting its absence in Ethereum as an <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/VitalikButerin/status/1261255053521883137"><strong>architectural regret.</strong></a></p><p>EIP-4337 enables <strong>complex transaction logic</strong> to be executed through smart contract wallets without requiring <strong>direct user management of private keys</strong>. This enhances <strong>security and usability,</strong> whilst also supporting advanced authentication methods.</p><p>While Ethereum’s changes are understandably slow, the <strong>dearth of innovation in L2s</strong> is reflected in the reluctance to <strong>“go beyond” the EVMs spec</strong>. Despite the demand for it, bar zkSync <strong>no other ZK-Rollup has implemented native account abstraction.</strong></p><p>On Starknet, Smart Contract Accounts are the norm with the likes of <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.argent.xyz/blog/wtf-is-account-abstraction/">Argent</a> and <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://braavos.app/wallet-features/">Braavos</a> continuously innovating and demonstrating the benefits of native account abstraction.</p><h2 id="h-whats-ahead-the-starknet-roadmap" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">What’s Ahead: The Starknet Roadmap</h2><p>The Starknet stack comprises a robust suite built on <strong>aggregated proving, Cairo</strong> as a Domain Specific Language, and an <strong>industry-leading ZK Prover.</strong> These components collectively enable Starknet to function as a high-performance, secure network.</p><p>Building on the Starknet Stack, Starknet’s roadmap over the next six months focuses on “continuous improvement” in the chain’s UX and DevX; allowing <strong>ALL Cairo chains to be faster and more efficient</strong>. Key areas of development include <strong>Parallelisation, Cairo Native, Stwo &amp; SHARP.</strong></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/937faba3b122e74e86c75b2c32f603cad2f1f82a9ac83486f5ee6b3e138539e4.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h3 id="h-1-optimistic-parallelisation" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>1. Optimistic Parallelisation</strong></h3><p>Starknet’s latest upgrade includes <strong>optimistic parallelisation</strong>, an approach that allows the sequencer to <strong>process multiple transactions simultaneously</strong>, achieving significantly <strong>lower confirmation times.</strong></p><p>A similar optimisation is implemented in <strong>Solana</strong>, albeit through the <strong>use of access lists</strong>, which require each transaction to <strong>declare the storage slots it’ll access</strong> before execution. This enables Solana to identify non-conflicting transactions that can be processed in parallel.</p><p>In contrast, Starknet’s approach is based on <strong>optimistic parallelization</strong>, where transactions are initially executed concurrently <strong>under the assumption that they are independent</strong>. The sequencer then checks for conflicts. If it finds that one transaction needs to read storage slots modified by another transaction, it <strong>re-executes the affected transaction.</strong></p><blockquote><p><strong>Starknet will be the only L2 to support parallelisation.</strong></p></blockquote><p>Starknet hence relies on a <strong>dynamically constructed dependency graph</strong> that tracks conflicts between transactions allowing <strong>Optimistic Parallelisation</strong> without access lists. The feature is live on Starknet’s Sepolia Testnet and is due to be on the Mainnet by late August.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/1b0160967db10d9e11c76018588d7a38aa557c418dfc4bbe227f486deaf96791.png" alt="Starknet’s transaction dependency graph" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Starknet’s transaction dependency graph</figcaption></figure><p>A detailed piece on Starknet’s parallelisation is in the works by the Karnot team and will be released shortly.</p><hr><h3 id="h-suggested-reading-the-starknet-architecture" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Suggested Reading: The Starknet Architecture</h3><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/9c59daaab34f2c2cfe556f87c717b599deed8ed5a32a075ab3acf0d11eba4013.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>While Starknet&apos;s architecture is complex and multi-layered, simplifying it helps us focus on Starknet’s two major upgrades: <strong>Cairo Native and Stwo.</strong> However to appreciate these optimisations, we must discuss two components of the Starknet architecture: <strong>The</strong> <strong>Sequencer and The Prover.</strong></p><p><strong>The Sequencer</strong> has two core tasks, sequencing and execution.</p><ul><li><p><strong>Sequencing</strong>: Ordering transactions and appending new blocks.</p></li><li><p><strong>Execution</strong>: Executing transactions and updating the system’s state</p><ul><li><p>The sequencer, hence is able to provide <strong>“soft confirmations”</strong> based on the result of its execution, however finality is only achieved with the chain’s settlement on L1.</p></li><li><p>Soft confirmations can be used by dApps to provide <strong>real time responsiveness</strong> on the premise that the Starknet sequencers’ execution is correct.</p></li></ul></li></ul><p><strong>The Prover</strong> provides a mathematical guarantee that the transactions in a block are executed correctly.</p><ul><li><p>The prover re-executes the transactions in a “Provable Environment” and generates</p><ul><li><p><strong>An Execution Trace:</strong> A log of how each transaction was executed</p></li><li><p><strong>A State Diff:</strong> A record of how the Starknet state changed after processing the block</p></li></ul></li><li><p>The prover then processes the execution trace, taking random samples to mathematically guarantee the executions validity</p></li><li><p>Together <strong>“The Proof and State Diff”</strong> encapsulate thousands of transactions and their validity</p></li><li><p>As dApps operate with Soft Confirmations from the sequencer, the prover is f<strong>ree to operate asynchronously</strong> and be scaled horizontally allowing Proof Submission to happen on <strong>“a rolling basis”.</strong></p></li></ul><hr><h3 id="h-2-cairo-native-enabling-high-speed-execution-with-mlir-and-llvm" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">2. Cairo Native: Enabling High Speed Execution with MLIR &amp; LLVM</h3><p>Cairo code today undergoes a multi-step compilation process, namely going from a Cairo program to an <strong>intermediate representation</strong> called <strong>Sierra</strong> (<strong>S</strong>afe <strong>I</strong>nt<strong>e</strong>rmediate <strong>R</strong>ep<strong>r</strong>esent<strong>a</strong>tion), to finally <strong>Cairo Assembly (CASM)</strong> that is executed on the Cairo VM.</p><p>The presence of the Sierra step <strong>ensures safety and prevents runtime errors,</strong> guaranteeing that all transactions that reach the Cairo VM are eventually provable. Overall this prevents DDOS and reduces the likeliness of failing transactions reaching execution. Read more <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://medium.com/nethermind-eth/under-the-hood-of-cairo-1-0-exploring-sierra-7f32808421f5#:~:text=The%20sequencer%20can%20be%20subjected%20to%20DDoS%20attacks%20with%20invalid%20transactions%2C%20causing%20them%20to%20work%20for%20nothing%20and%20not%20collect%20any%20fee%20for%20running%20these%20transactions.">here</a>.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/a992995efa2ed8bd1e19f3d4fa1421d4280dc273e356053501a17ff866e309ba.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><blockquote><p>Cairo Native significantly boosts performance, allowing up to 1700 swaps per second.</p></blockquote><p>The <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://lambdaclass.com/"><strong>LambdaClass</strong></a> team has been leading the development of <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/lambdaclass/cairo_native"><strong>Cairo Native</strong></a>, a compilation optimisation that <strong>converts Sierra code to native object cod</strong>e. Cairo Native’s optimised compilation enables <strong>significantly faster execution</strong> without the need for a Cairo VM. To get a brief idea of Cairo Native, we must understand two key compiler frameworks used in Cairo Native</p><ul><li><p><strong>LLVM: Assembly Code Abstraction</strong></p><ul><li><p><strong>LLVM IR</strong> is an <strong>intermediate representation</strong> that simplifies various CPU instruction sets (like x86 and ARM).</p></li><li><p>It allows for <strong>cross-architecture compatibility</strong> by using a generic language instead of specific assembly code.</p></li><li><p>LLVM IR maintains a <strong>linear instruction sequence</strong>, focusing on <strong>CPU instruction abstraction.</strong></p></li></ul></li><li><p><strong>MLIR: Abstraction over Intermediate Representation/Computation</strong></p><ul><li><p><strong>MLIR</strong> builds upon LLVM by using <strong>flexible operations</strong> that represent a wider range of computations than simple CPU instructions.</p></li></ul></li><li><p><strong>MLIR</strong> can convert its representations to LLVM IR, allowing it to benefit from LLVM&apos;s optimizations and generate efficient machine code.</p></li></ul><p>How Cairo Native uses both:</p><ul><li><p>Cairo code is first compiled to Sierra.</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/3b6bf4c7a18293689d409012510eee182a74fbf6418c8504e906569fcb4a2b64.png" alt="Example Cairo program" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Example Cairo program</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/e934e1556fa1cd9f70c526b1f7f8eb7092e6a01230456ec90ebfec23836211fb.png" alt="simple.cairo compiled to a Sierra representation" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">simple.cairo compiled to a Sierra representation</figcaption></figure><ul><li><p>Cairo Native translates Sierra to MLIR operations.</p></li></ul><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/37719a4e7b64f8b2bc30e727bc05a2e8a33779c2f538908af05e35fe0779c538.png" alt="Statements in the Sierra code represent the program instructions" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Statements in the Sierra code represent the program instructions</figcaption></figure><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/1c32462f3c4a7531016675fb820d7292d1b9c665f659a1c7c4bd7b7f1018cf1e.png" alt="Sierra is compiled to MLIR code" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Sierra is compiled to MLIR code</figcaption></figure><ul><li><p>These MLIR operations are then lowered to LLVM IR.</p></li><li><p>LLVM optimizes this IR and generates native machine code.</p></li></ul><p>This approach allows Cairo Native to <strong>handle Cairo’s functionality in MLIR,</strong> then leverage <strong>LLVM&apos;s ecosystem for final optimization and code generation</strong>.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/3ace55f4f962e6973e5c04f19c643f68306024933f62e21338e13a5d5db9d4dc.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>A detailed piece by the Karnot team on Cairo Native and it’s intricacies is in the works, meanwhile read more <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.starknet.io/architecture-and-concepts/smart-contracts/cairo-and-sierra/">here.</a></p><h3 id="h-3-stwo-starknets-industry-leading-prover" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">3. Stwo: Starknet’s Industry Leading Prover</h3><p>As discussed in the Architecture section; it is the <strong>role of a Prover to create mathematically sound proofs</strong> that attest to a transaction executing correctly. While computationally expensive, <strong>provers run “off-chain”</strong> and return a ZK-Proof to the Verifier contract; which is l<strong>ightweight and sufficient to guarantee correct execution.</strong></p><p>However, as ZK-Rollups scale, their <strong>biggest expenses</strong> steer towards being <strong>cloud costs</strong> incurred by running these provers. Consequently, <strong>any improvements in Provers has a amplified impact</strong> across the ecosystems expenses. Thus, a faster and more efficient Prover <strong>reduces proving costs, latency and potentially increases throughput.</strong></p><p>StarkWare’s latest breakthrough titled <strong>Circle STARKs</strong> introduces major optimisations to STARK calculation (the math behind Starknet’s ZK-Proofs). By working over <strong>smaller 31-bit fields instead of 256-bit fields.</strong> Computing circle STARKs over 31-bit fields fully utilises 32-bit registers, reducing wasted space and leading to more efficient hardware design. Circle STARKs thus can represent information much more efficiently, making proof creation significantly more hardware friendly.</p><blockquote><p><strong>Stwo has achieved record breaking results, and has benchmarked 1000x the hash rate of its predecessor, Stone.</strong></p></blockquote><p>Read more about Circle STARKs <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://vitalik.eth.limo/general/2024/07/23/circlestarks.html">here</a>.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/da18f7ed91fafb242c95d3dcd7dc85cbbdc12eadd18d909b3aea7a675e80031a.png" alt="StarkWare shattered the world proving record with over " blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">StarkWare shattered the world proving record with over</figcaption></figure><p>StarkWare shattered the world proving record with over <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/StarkWareLtd/status/1807776563188162562">500,000 hashes proved per second</a></p><h3 id="h-4-sharp-a-shared-prover-if-its-in-cairo-sharp-can-prove-it" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>4. SHARP</strong> (a <strong>SHAR</strong>ed <strong>P</strong>rover): If it’s in Cairo, SHARP can prove it</h3><p>Starkware’s SHARP is an <strong>industry first innovation</strong>, enabling <strong>Cross Chain Proof Aggregation</strong>. In simpler terms, SHARP reduces verification costs by generating recursive STARKs, accepting proofs from <strong>ALL Cairo chains</strong>.</p><blockquote><p><strong>SHARP’s cross-chain proof aggregation capability has been Mainnet ready since early 2023</strong></p></blockquote><p>By <strong>recursively aggregating multiple proofs</strong> from the Starknet chain, Paradex, DyDx and other Cairo chains, SHARP effectively spreads the cost of L1 verification across thousands of transactions, creating network effects across the ecosystem.</p><p>Stwo, scheduled for <strong>release in Q1 2025</strong>, is expected to <strong>significantly reduce proving costs</strong>. With <strong>SHARP as an aggregator wrapped atop Stwo</strong>, Starknet and all Cairo chains are expected to witness <strong>major savings in proving costs.</strong></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/3994692c24849f31a0af18f7d4a5f327cb9ee8a8b22150d22b37b7e460532488.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><h2 id="h-kakarot-zkevm-the-best-of-both-worlds" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Kakarot zkEVM: The Best of Both Worlds</h2><p>While we strongly believe <strong>Cairo</strong> is an <strong>efficient proving</strong> and <strong>advanced smart contract language,</strong> there are reasons to deploy on the <strong>EVM</strong>:</p><ol><li><p>Reusing audited smart contracts</p></li><li><p>Leveraging existing <strong>Solidity</strong> experience for faster shipping</p></li><li><p>Staying with the improving EVM ecosystem</p></li></ol><p>If you choose to build on the EVM, today&apos;s ZK-rollup ecosystem includes Scroll, zkSync and Polygon, each using a <strong>&quot;low-level circuit&quot;</strong> approach for EVM provability.</p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.kakarot.org/"><strong>Kakarot zkEVM</strong></a> is an E<strong>VM implementation written in Cairo.</strong> It combines <strong>Starknet Stack</strong> advancements (<strong>Stwo</strong>, <strong>SHARP</strong>, <strong>Parallelisation</strong>, <strong>Cairo Native</strong>) with EVM ecosystem’s network effects.</p><p>Kakarot&apos;s <strong>intermediate language</strong> approach results in a <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/VitalikButerin/status/1592884235102474240"><strong>90% lighter codebase</strong></a> than circuit-based rollups, enabling <strong>faster adoption of EVM upgrades</strong> and <strong>fewer potential vulnerabilities</strong>.</p><p>Kakarot’s approach <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/KakarotZkEvm/status/1783167787831026164">significantly simplifies introducing <strong>custom precompiles</strong></a>, allowing you to implement builtin functions that would be computationally expensive if executed in EVM bytecode be natively integrated into the Kakarot client; optimized for better performance.</p><p>Kakarot zkEVM is expected to achieve <strong>100% EVM compatibility</strong> soon. Moreover Kakarot’s bytecode compatibility enables full reuse of Solidity contracts while running your appchain with the security guarantees and proving architecture of <strong>all Cairo chains</strong>.</p><h2 id="h-madara" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Madara</h2><p>The Starknet Stack hence comprises of powerful innovations in the ZK and blockchain space. However till date, the <strong>only way to run a custom Starknet chain,</strong> alike Paradex and DyDx was <strong>through StarkEx</strong>, Starkware’s appchain-as-a-service offering. And whilst StarkEx has been in production on Mainnet since June 2020, StarkEx was closed source and had limited access.</p><blockquote><p><strong>With </strong><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://x.com/MadaraStarknet"><strong>Madara</strong></a><strong> we bring the same stack that powers over $1B TVL to <em>everyone</em>.</strong></p></blockquote><p>Inspired by the StarkEx, <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/madara-alliance/madara"><strong>Madara</strong></a><strong> is a performant and open-source implementation of the Starknet Stack.</strong> Madara is developed with a focus on fractal scaling—the use of <strong>L2s and L3s to exponentially scale Ethereum,</strong> whilst <strong>benefitting from all upgrades to ANY components of the Starknet Stack.</strong></p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/cf8568b3848b7972e241ad482c05c7394839716c043bfeb791f1d6aeb86c0a72.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>Madara&apos;s architecture enables integrating <strong>app-level customizations</strong> deep into the protocol layer, allowing fine-tuning of block times, gas costs, provers, and data availability layer according to the app&apos;s requirements.</p><blockquote><p><strong>With Madara, <em>any app</em> can be an appchain.</strong></p></blockquote><p>Read more about Madara <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.madara.build/">here</a>.</p><h2 id="h-karnot" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">Karnot</h2><p>At Karnot, we&apos;re proud to be <strong>core contributors to the Madara project</strong> and the <strong>leading RaaS provider for Madara app chains.</strong> Our team brings years of experience in building s<strong>calable, fault-tolearnt systems.</strong> Through successfully running multiple devnets and testnets, we&apos;ve continuously refined our services, ensuring robust and battle-tested solutions. We continue to <strong>actively contribute to Madara&apos;s developmen</strong>t while <strong>strengthening our infrastructure</strong> to offer &quot;Appchains as a Service&quot;. This dual focus puts Karnot in a unique position to <strong>build AND provide exceptional scaling</strong> solutions to appchains across the ecosystem.</p><p>Whether you&apos;re looking to <strong>build EVM app chains or Starknet app chain</strong>s, we&apos;re here to support your project. We invite you to <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.karnot.xyz/"><strong>connect with us</strong></a> and explore how our expertise can accelerate your appchain journey.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/c8f634ec58ae06e88b24c0b915504d7ac0129cd40a963658e5cc13b22cdac630.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Real-Time Access, Anywhere. Now on Starknet]]></title>
            <link>https://paragraph.com/@karnot/real-time-access-anywhere-now-on-starknet</link>
            <guid>nKgIlgyVQSE8OSGWkeVO</guid>
            <pubDate>Mon, 10 Jun 2024 17:23:24 GMT</pubDate>
            <description><![CDATA[At Karnot, we strive to enable appchains to seamlessly blend the best of Web2 and Web3, allowing users to interact effortlessly with sophisticated on-chain experiences. This demands accurate, real-time data for applications in gaming, DeFi, and payments. We&apos;re thrilled to announce that Pyth’s real-time oracle data will now be supported for app chains launched through Karnot! This complements our existing support for Pragma. With both Pyth and Pragma providing reliable data, developers on...]]></description>
            <content:encoded><![CDATA[<p>At Karnot, we strive to enable appchains to seamlessly blend the best of Web2 and Web3, allowing users to interact effortlessly with sophisticated on-chain experiences. This demands accurate, real-time data for applications in gaming, DeFi, and payments. We&apos;re thrilled to announce that Pyth’s real-time oracle data will now be supported for app chains launched through Karnot! This complements our existing support for Pragma. With both Pyth and Pragma providing reliable data, developers on Starknet have more robust options to build secure and scalable decentralized applications.</p><p><em>&quot;We are delighted to announce that Pyth Price Feeds will be available to all rollup developers choosing Karnot which will boost the growth of DeFi for the ecosystem.”</em> — Abhimanyu Bansal, Head of Business Development at Douro Labs.</p><h3 id="h-meet-pyth" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Meet Pyth</h3><p>The Pyth Network is a first-party financial data oracle network that delivers secure, low-latency price data for various assets on blockchains. Pyth incentivizes major exchanges, market makers, and trading firms to contribute their proprietary data to the network. This aggregated on-chain price data is available for smart contracts to use. Decentralized applications can request or pull Pyth price updates on-chain as needed.</p><p>In under a year, Pyth has secured over $2 billion in total value and supports over $5 billion. With over 500 live data feeds covering crypto, equities, ETFs, FX pairs, and commodities, Pyth has facilitated over $500 billion in total trading volume across over 60 blockchain networks.</p><h3 id="h-integration-with-karnot" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Integration with Karnot</h3><p>We are delighted to announce that Pyth’s extensive price feeds will soon be integrated into Karnot&apos;s suite of tools. With Pyth&apos;s diverse, low-latency data on various commodities and cryptocurrencies, developers within the Starknet ecosystem can now build advanced, real-time applications using industry-leading resources.</p><h3 id="h-start-building-today" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Start Building Today</h3><p>We’re eager to see the innovative solutions this integration will inspire within our chains and developer communities. If you’re interested in launching a rollup with Pyth&apos;s state-of-the-art oracle solution, contact us! Build with Karnot today and explore the vast possibilities Pyth’s oracle can unlock for your appchain.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/4217edd093175e8259b8fd2b79e368102c7d269525e92fc78bf6a60d30baf2c0.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Enhancing App Chains with Gevulot]]></title>
            <link>https://paragraph.com/@karnot/enhancing-app-chains-with-gevulot</link>
            <guid>qLzrb9v2KfDEl1emFTAb</guid>
            <pubDate>Thu, 21 Mar 2024 13:59:02 GMT</pubDate>
            <description><![CDATA[At Karnot, we recognize that app chains thrive on speed and security. As Madara rapidly evolves, integrating cutting-edge services like SHARP for efficient proof generation, Karnot offers adaptability through modularity and customization. While SHARP offers efficiency, its centralized nature motivates the exploration of decentralized alternatives. This is where Karnot&apos;s integration with Gevulot becomes pivotal. Gevulot&apos;s permissionless, general-purpose proof layer optimizes for bein...]]></description>
            <content:encoded><![CDATA[<p>At Karnot, we recognize that app chains thrive on speed and security. As Madara rapidly evolves, integrating cutting-edge services like SHARP for efficient proof generation, Karnot offers adaptability through modularity and customization.</p><p>While SHARP offers efficiency, its centralized nature motivates the exploration of decentralized alternatives. This is where Karnot&apos;s integration with <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://www.gevulot.com">Gevulot</a> becomes pivotal. Gevulot&apos;s permissionless, general-purpose proof layer optimizes for being credibly neutral, highly configurable, and incredibly low cost, enhancing app chain security and scalability whilst also providing verification.</p><p><strong>Why Karnot Chose Gevulot</strong></p><p>Karnot sought a decentralized proving solution uncompromising on speed, developer experience, or cost-efficiency. Gevulot delivers on all fronts. The economic design and optimised workload distribution maximize their internet-scale compute network, offering performance on par with even centralized provers. Gevulot&apos;s inherent support for STARK proofs also enables seamless integration with Starknet App Chains built with Madara.</p><p><strong>Benefits for Karnot App Chain Developers</strong></p><p>Karnot&apos;s Gevulot integration delivers tangible advantages for app chain developers. Gevulot offers crucial decentralization and flexibility, expanding developers’ options beyond specialized services like SHARP. Its focus on usability streamlines development processes, saving time and effort. With <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://blog.gevulot.com/p/devnet-developer-onboarding-begins">Gevulot&apos;s devnet</a> soon to be launched on March 25th, all Karnot App Chains will receive free proof generation and verification.</p><p><strong>Conclusion</strong></p><p>Our partnership with Gevulot expands Karnot&apos;s toolkit, offering cost-effective decentralized proof generation and verification. This integration strengthens Karnot&apos;s position as the leading RaaS provider for Madara app chains and demonstrates our commitment to cutting-edge solutions within the ecosystem.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/ac56c3fe993fff8070be36d514cf727f987d338fa0c7b2b393d67581e90ee343.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Karnot partners with Kakarot for its Sepolia testnet]]></title>
            <link>https://paragraph.com/@karnot/karnot-partners-with-kakarot-for-its-sepolia-testnet</link>
            <guid>74ApHmoBhKNfrOlELGNF</guid>
            <pubDate>Mon, 26 Feb 2024 16:37:01 GMT</pubDate>
            <description><![CDATA[Building scalable and secure ZK-app chains can be complex. Karnot offers the solution. Here, at Karnot we strive to be the leading RaaS provider for Madara chains, consistently pushing the envelope to allow our customers to develop scalable, efficient app chains without the burden of managing production-grade infrastructure. Making a significant milestone in our commitment to build for scale is Karnot’s latest partnership.We are excited to announce that Karnot will be hosting, deploying and m...]]></description>
            <content:encoded><![CDATA[<p>Building scalable and secure ZK-app chains can be complex. Karnot offers the solution. Here, at Karnot we strive to be the leading RaaS provider for Madara chains, consistently pushing the envelope to allow our customers to develop scalable, efficient app chains without the burden of managing production-grade infrastructure. Making a significant milestone in our commitment to build for scale is Karnot’s latest partnership.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/9c22fd935ba94adbede6090005334a81fca7a189310d05850674da4def0a4ac5.gif" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>We are excited to announce that Karnot will be hosting, deploying and managing a testnet for Kakarot over the next few months. This partnership aligns with Karnot&apos;s vision of becoming the leading RaaS provider, while simultaneously testing and accelerating Madara&apos;s path to mainnet readiness.</p><p>Kakarot has carved its niche as a key player in the ZK space, leveraging Cairo&apos;s inherent provability to build a verifiable zkEVM. This creates an Ethereum-compatible Layer 2, enabling seamless integration of existing EVM contracts, wallets, and transactions. This approach lowers the barrier to entry for developers and users familiar with the Ethereum ecosystem while also unlocking high scalability powered by STARKs and Cairo.</p><p>Kakarot&apos;s strategic decision to adopt Cairo for its zkEVM development offers significant advantages over the conventional approach of manually constructing low-level ZK circuits. By abstracting away complex cryptographic operations and circuit optimizations, Cairo, as a high-level language, allows the team to:</p><ul><li><p><strong>Maintain agility:</strong> Building on Cairo streamlines proof generation, allowing Kakarot to stay ahead of the rapidly evolving Ethereum roadmap and potentially secure a significant competitive edge.</p></li><li><p><strong>Prioritize user experience:</strong> Freed from low-level complexities, the team can focus on enhancing the user experience by introducing features such as native account abstraction, face ID reinforced EOA’s and native multicall within the zkEVM environment.</p></li><li><p><strong>Benefit from continuous improvement:</strong> Leveraging Cairo, Kakarot automatically inherits performance optimizations and new features from Starkware&apos;s ongoing development, ensuring its zkEVM stays at the forefront of advancements in the ZK space.</p></li></ul><p>The upcoming Kakarot testnet, in collaboration with Starkware and Karnot, brings exciting possibilities. Let&apos;s dissect its components to see how it works.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/f64b20e3c669afe1e6893b5543dae3da16532740c5dfe1d9c393003fe4c6285a.png" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><ol><li><p>Kakarot RPC:  Acts as the EVM-compatible gateway, allowing users to interact with the Kakarot’s zkEVM through simple EVM transactions</p></li><li><p>Full Node: Maintains a complete copy of the current state and independently verifies transactions</p></li><li><p>Indexer: Facilitates quick reads of chain state by maintaining indices on parts of the current state</p></li><li><p>Validator: Validates and executes transactions, creates blocks and handles proof and DA submissions. Currently run by Starkware.</p></li><li><p>Karnot Shadow Testnet: A dedicated Madara app chain hosted by Karnot, independently simulates the activity on Starknet’s validator. It executes transactions, generates blocks, and calculates state diffs, enabling a stress test of Madara’s performance in enterprise-grade environments. By benchmarking against industry leaders like Starkware in this testnet, Madara gains valuable insights into its scalability and efficiency, allowing Madara to be further Mainnet-ready.</p></li></ol><p>As Kakarot pushes boundaries, Karnot is proud to continue providing robust and scalable infrastructure solutions. We’re excited to build, deploy and grow from testnet to mainnet, to let Kakarot focus on innovation, not infrastructure.</p><p>If you’re building an app chain, Karnot offers unmatched scalability, security and expertise in the ZK app chain space. Reach out to us on Twitter, and get testnet ready in days instead of weeks.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/f6d9ccf7ee9c0b1870d828699ee96f90f8c4726239edca0f306156fdbd9f468f.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Getting started with Madara]]></title>
            <link>https://paragraph.com/@karnot/getting-started-with-madara</link>
            <guid>vTySZpgSc6HesZwrYrd6</guid>
            <pubDate>Mon, 29 Jan 2024 07:07:24 GMT</pubDate>
            <description><![CDATA[If you’ve reached here, it probably means you already have your Madara node up and running 🚀 Now it’s time that we start playing around with Madara - deploy accounts, contracts and get your app chain up and kicking (and move you on top of the leaderboard as well 😉).Using starknet.jsStarkent.js is an npm library that allows you to interact with Starknet using Node.js. We have created some sample scripts for you that allow you toDeclare a contractDeploy a contractTransfer funds to an accountG...]]></description>
            <content:encoded><![CDATA[<p>If you’ve reached here, it probably means you already have your Madara node up and running 🚀</p><p>Now it’s time that we start playing around with Madara - deploy accounts, contracts and get your app chain up and kicking (and move you on top of the <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://leaderboard.availproject.org/">leaderboard</a> as well 😉).</p><h3 id="h-using-starknetjs" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Using starknet.js</h3><p>Starkent.js is an npm library that allows you to interact with Starknet using Node.js. We have created some sample scripts for you that allow you to</p><ol><li><p>Declare a contract</p></li><li><p>Deploy a contract</p></li><li><p>Transfer funds to an account</p></li><li><p>Get a transaction receipt</p></li></ol><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/karnotxyz/madara-get-started">https://github.com/karnotxyz/madara-get-started</a></p><p>If you’ve ever used Node.js before, using these scripts should be a breeze! The instructions to use the scripts are in the README of the repo. Good luck 👍</p><h3 id="h-using-starkli" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Using starkli</h3><p><strong>Installing starkli</strong></p><p><a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/xJonathanLEI/starkli">starkli</a> is a CLI tool which allows you to interact with the Starknet based chain using your terminal! Currently, Madara is compatible with starkli v0.1.20. To install this version, go to this <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/xJonathanLEI/starkli/releases/tag/v0.1.20">link</a> and download the asset which is compatible with your machine (<code>arm</code> or <code>x86</code>, <code>mac</code>, <code>linux</code> or <code>windows</code>). Once downloaded, you can extract the file to get your binary. Once you’ve the binary, you can add the binary location to your <code>PATH</code> and access it on your terminal with <code>starkli</code>. Alternatively, you can <code>cd</code> to the location of the binary on your terminal and use <code>./starkli</code>. For the tutorial, we will assume you’ve added it to your path.</p><p>Ensure you’ve the correct version using</p><pre data-type="codeBlock" text="starkli --version
0.1.20 (e4d2307)
"><code>starkli <span class="hljs-attr">--version</span>
<span class="hljs-number">0.1</span><span class="hljs-selector-class">.20</span> (e4d2307)
</code></pre><p><strong>Setting up starkli</strong></p><ol><li><p>Once you’ve starkli installed, add your Madara RPC url to the <code>env</code>. By default, this would be <code>http://localhost:9944</code> if you’re running it locally. If you’ve hosted your chain for the Clash of Nodes campaign, this would be the <code>rpc_url</code> you submitted for the listing.</p><pre data-type="codeBlock" text="export STARKNET_RPC=&quot;http://localhost:9944/&quot;
"><code>export <span class="hljs-attr">STARKNET_RPC</span>=<span class="hljs-string">"http://localhost:9944/"</span>
</code></pre></li><li><p>The next step is to declare the Open Zepplin account contracts on your Madara chain! For this, you can use one of our js scripts above. You need to have Node.js installed.</p><pre data-type="codeBlock" text="git clone https://github.com/karnotxyz/madara-get-started
npm i
node scripts/declare.js
./contracts/OpenZeppelinAccountCairoOne.sierra.json
./contracts/OpenZeppelinAccountCairoOne.casm.json 
"><code>git clone https:<span class="hljs-comment">//github.com/karnotxyz/madara-get-started</span>
npm i
node scripts<span class="hljs-operator">/</span>declare.js
./contracts<span class="hljs-operator">/</span>OpenZeppelinAccountCairoOne.sierra.json
./contracts<span class="hljs-operator">/</span>OpenZeppelinAccountCairoOne.casm.json 
</code></pre><p>If you see the message, <code>Contract is already declared</code>it’s fine! It means you’re on the later version of Madara where we added this contract to genesis.</p></li><li><p>Awesome! You’re now setup to start using <code>starkli</code>. Follow this amazing <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://book.starkli.rs/tutorials/starkli-101">tutorial</a> here to interact with your Madara chain.</p></li><li><p>Some pointers to keep in mind when running the above tutorial.</p><ol><li><p>Madara chains currently support Cairo 2.1.0. The above tutorial is also based on Scarb 0.6.1 which is compatible with this Cairo version. To install this specific Scarb version, you can use asdf as explained <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.swmansion.com/scarb/download.html#install-via-asdf">here</a>.</p></li><li><p>When you create your Scarb project according to the tutorial, add the following code inside the <code>Scarb.toml</code> file</p><pre data-type="codeBlock" text="[dependencies]
starknet = &quot;&gt;=2.1.0&quot;

[[target.starknet-contract]]
"><code>[dependencies]
starknet = <span class="hljs-string">">=2.1.0"</span>

<span class="hljs-string">[[target.starknet-contract]]</span>
</code></pre></li></ol></li></ol><h3 id="h-learning-more-about-starknet-and-cairo" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">Learning more about Starknet and Cairo</h3><p>By now, you might have got the idea that using a Madara chain is similar to using Starknet. You just need to point your RPC url to Madara! So, if you’ve used Starknet before, you are ready to get started. However, if you haven’t, it’s not too late! Here are some good resources to give you a head start on your journey.</p><ol><li><p>Starknet book: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://book.starknet.io/">https://book.starknet.io/</a></p></li><li><p>Starknet docs: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.starknet.io/">https://docs.starknet.io/</a></p></li><li><p>Cairo book: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://book.cairo-lang.org/">https://book.cairo-lang.org/</a></p></li><li><p>Starknet Basecamp: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.youtube.com/watch?v=8GH92wM4jB0&amp;list=PLMXIoXErTTYX-ZSxlaYDxsR66l5a39IwA">https://www.youtube.com/watch?v=8GH92wM4jB0&amp;list=PLMXIoXErTTYX-ZSxlaYDxsR66l5a39IwA</a></p></li><li><p>About Madara + Demo: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.youtube.com/watch?v=gKGumhRISLU">https://www.youtube.com/watch?v=gKGumhRISLU</a></p></li></ol><h3 id="h-take-part-in-the-madara-hackathon" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0">🛠️ Take part in the Madara Hackathon</h3><p>Starkware has organised an hackathon with a Madara <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://taikai.network/starkware/hackathons/starknet-winter-hackathon/categories?token=NLPU3RY9KA6U7AQO">track</a>. The track has over $4000 in cash prizes for projects that build exciting things on top of Madara. And one of the problem statements is building an app chain! So if you believe you’ve something exciting, don’t forget to share it with us here and possible grab a cash prize 💸</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/536d42c5fdccc2f07cc856e50ba02686de745ef0632ba64554ea57da6f455c2b.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[FAQs: Avail Clash of Nodes]]></title>
            <link>https://paragraph.com/@karnot/faqs-avail-clash-of-nodes</link>
            <guid>iBaXNXjUfL39RzAvaNLB</guid>
            <pubDate>Fri, 26 Jan 2024 19:24:50 GMT</pubDate>
            <description><![CDATA[Hey everyone 👋 Firstly! Thanks a lot for the overwhelming response we received after launching the campaign. We are excited to see all of you trying out innovative things and testing our Madara and the CLI itself. However, we have seen some of you face a few hiccups when deploying the chain and that’s why we have decided to write this blog to answer some of the common questions we have received.FAQsHow do I update my CLI to the latest version?We have made some patches to the CLI tool to make...]]></description>
            <content:encoded><![CDATA[<p>Hey everyone 👋</p><p>Firstly! Thanks a lot for the overwhelming response we received after launching the <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://mirror.xyz/karnot.eth/LHs2iELJJYY6zm4EUYYYTRE_MX-bSMOaAf2b8Zc9pSc">campaign</a>. We are excited to see all of you trying out innovative things and testing our Madara and the CLI itself. However, we have seen some of you face a few hiccups when deploying the chain and that’s why we have decided to write this blog to answer some of the common questions we have received.</p><h1 id="h-faqs" class="text-4xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0">FAQs</h1><h4 id="h-how-do-i-update-my-cli-to-the-latest-version" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">How do I update my CLI to the latest version?</h4><p>We have made some patches to the CLI tool to make the deployment process easier and to fix some bugs. To stay updated to the latest version, simply run the <code>git pull</code> command. Also, <code>init</code> a new app chain to ensure you’re using the latest code.</p><h4 id="h-how-do-i-use-my-avail-address-for-submitting-da-blobs" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0"><strong>How do I use my Avail address for submitting DA blobs?</strong></h4><p>The CLI tool creates a <code>da-config.json</code> file for you at <code>~/.madara/app-chains/&lt;your_app_chain_name&gt;/da-config.json</code>. The JSON file looks like this</p><pre data-type="codeBlock" text="{
    &quot;ws_provider&quot;: &quot;wss://goldberg.avail.tools:443/ws&quot;,
    &quot;mode&quot;: &quot;sovereign&quot;,
    &quot;seed&quot;: &quot;&lt;seed&gt;&quot;,
    &quot;app_id&quot;: 0,
    &quot;address&quot;: &quot;&lt;address&gt;&quot;
}
"><code><span class="hljs-punctuation">{</span>
    <span class="hljs-attr">"ws_provider"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"wss://goldberg.avail.tools:443/ws"</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">"mode"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"sovereign"</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">"seed"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"&#x3C;seed>"</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">"app_id"</span><span class="hljs-punctuation">:</span> <span class="hljs-number">0</span><span class="hljs-punctuation">,</span>
    <span class="hljs-attr">"address"</span><span class="hljs-punctuation">:</span> <span class="hljs-string">"&#x3C;address>"</span>
<span class="hljs-punctuation">}</span>
</code></pre><p>Edit the <code>seed</code> and <code>address</code> fields with your specific wallet details to change the wallet used for submitting data to Avail.</p><h4 id="h-how-do-i-host-my-chain-using-the-cli-tool" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0"><strong>How do I host my chain using the CLI tool?</strong></h4><p>As a part of the campaign, you’re required to host your chain on a server and share your endpoints with us <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/karnotxyz/avail-campaign-listing">here</a>. However, there seems to be some confusion on how to go about this. To clarify this, we are sharing some basic steps we used to launch a node on AWS using the Madara CLI.</p><blockquote><p>WARNING: The CLI tool currently is to deploy quick devnets that are easy to test and play around with. Hence, it doesn’t make optimizations that are required for a production build. So while this setup might work for your devnet, we don’t recommend running this when you decide to run your mainnet</p></blockquote><ol><li><p>Firstly, we have made some patches to the CLI tool after the launch. So if you already have it installed, please update it using</p><pre data-type="codeBlock" text="git pull
cargo build --release
"><code>git pull
cargo build <span class="hljs-operator">-</span><span class="hljs-operator">-</span>release
</code></pre></li><li><p>Install the dependencies mentioned <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/karnotxyz/madara-cli/blob/main/docs/setup.md">here</a></p></li><li><p>Initialise your chain with</p><pre data-type="codeBlock" text="./target/release/madara init
"><code>./target<span class="hljs-operator">/</span>release<span class="hljs-operator">/</span>madara init
</code></pre></li><li><p>Currently, the CLI tool doesn’t support running in a detached mode. So we will use <code>screen</code> to start the Madara chain in a separate session.</p><pre data-type="codeBlock" text="screen -S madara
./target/release/madara run
"><code>screen <span class="hljs-operator">-</span>S madara
./target<span class="hljs-operator">/</span>release<span class="hljs-operator">/</span>madara run
</code></pre></li><li><p>Now that Madara is up and running, you can exit this screen session using <code>CTRL + A</code> <code>D</code></p></li><li><p>Now, in a separate session, start the explorer. When starting the explorer, pass an additional flag to specify the host that will be used to access it. If you’ve a domain name configured, this is where it should go. It could also be your plane IP address. For example, <code>--host=13.233.147.221</code>. (notice you don’t need to specify http/https)</p><pre data-type="codeBlock" text="screen -S explorer
./target/release/madara explorer --host=&lt;HOST_ADDRESS&gt;
"><code>screen <span class="hljs-operator">-</span>S explorer
./target<span class="hljs-operator">/</span>release<span class="hljs-operator">/</span>madara explorer <span class="hljs-operator">-</span><span class="hljs-operator">-</span>host<span class="hljs-operator">=</span><span class="hljs-operator">&#x3C;</span>HOST_ADDRESS<span class="hljs-operator">></span>
</code></pre></li><li><p>Again, exit the session using <code>CTRL + A</code> <code>D</code></p></li></ol><p>Your Madara chain is up and running now 🚀</p><h4 id="h-how-do-i-get-the-endpoints-needed-for-listing-my-chain" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0"><strong>How do I get the endpoints needed for listing my chain?</strong></h4><p>Now that your chain is up and running, the next step is to expose the endpoints needed to list the chain. Specifically, you need</p><ol><li><p><code>rpc_url</code>: A public endpoint for your app chain to make RPC calls (port 9944 by default)</p></li><li><p><code>explorer_url</code>: A public endpoint where your app chain explorer is visible (port 4000 by default)</p></li><li><p><code>metrics_endpoint</code>: A public endpoint for your prometheus metrics (port 9615 by default)</p></li></ol><p>If you followed the above part, then these endpoints are already available locally on your system. You just need to expose them for the outside world to use them. On AWS, you can do this by creating a security group with the following inbound rules</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/549d8083a19fbf8a01092742fff3aa1288d7265ff292c91e02a83ac25e92239e.png" alt="Inbound rules for a security group to expose the endpoints" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="">Inbound rules for a security group to expose the endpoints</figcaption></figure><p>If your service is running on <code>13.233.147.221</code> for example (this could be a domain name as well if you’ve it configured), then your endpoints will be</p><ol><li><p><code>rpc_url</code>: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://13.233.147.221:9944">http://13.233.147.221:9944</a></p></li><li><p><code>explorer_url</code>: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://13.233.147.221:4000">http://13.233.147.221:4000</a></p></li><li><p><code>metrics_endpoint</code>: <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="http://13.233.147.221:9615/metrics">http://13.233.147.221:9615/metrics</a></p></li></ol><blockquote><p>NOTE 1: You need to add <code>/metrics</code> at the end of the metrics endpointNOTE 2: Do NOT add a trailing <code>/</code> to the endpoint</p></blockquote><h4 id="h-i-am-running-out-of-avl-tokens-what-should-i-do" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">I am running out of AVL tokens, what should I do?</h4><p>We have changed the default block time from 6s to 20s. This should significantly reduce the costs for running the app chain. However, if you find yourself in the need of more tokens, do reach out to us on the Discord channel mentioned below.</p><h4 id="h-when-will-my-pr-get-merged" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">When will my PR get merged?</h4><p>Thanks to the community, we have got a very high number of PRs already. In order to make the process easier for everyone, we are added a Github workflow which would automatically make the necessary checks on your PR to ensure all your endpoints are live and working. If you’ve already created a PR, please rebase on the latest main commit.</p><h4 id="h-how-can-i-skip-the-hassle-of-hosting-the-node" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">How can I skip the hassle of hosting the node?</h4><p>You can ask use to do it 🫡</p><p>At Karnot, we excel at providing infrastructure for app chains so that you can focus on your core business logic. As a part of the Avail campaign, we are running these nodes free of cost for some limited users. If you’re interesting in this offering, please fill the form <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://forms.gle/xV8iVM9gEwByRdWDA">here</a>. However, we only have limited places for this and app chains that are serious on getting their solution to the market will be given priority over here.</p><h4 id="h-what-specs-do-i-need-to-run-my-node" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">What specs do I need to run my node?</h4><p>Ideally, 2 GB memory and 0.5 vCPU should be enough to run a devnet node. However, the Madara CLI tool currently builds the Madara image locally. This allows us to use the latest images and saves us the time of building and pushing docker images for multiple OS. While we do plan to optimize this eventually, currently this is the fastest way to play around with Madara. For my testing, we used an Ubuntu instance on AWS, we used an <code>t4g.xlarge</code> instance (4 vCPU, 16 GB memory and 50 GB storage).</p><h4 id="h-where-can-i-ask-questions" class="text-xl font-header !mt-6 !mb-3 first:!mt-0 first:!mb-0">Where can I ask questions?</h4><p>The best place to ask questions right now would be the <code>#developer-discussions</code> channel on the Avail Discord. You can access it <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://discord.com/invite/availproject">here</a>. Do avoid asking questions on the Madara telegram for now as we want to reserve that for more dev discussions. However, we will be launching a Madara Discord soon 👀. Follow us <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/MadaraStarknet">here</a> to remain updated!</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/9e76acc75fc8c8bf08e853a561d2d9e568c79704d0282ba9283f5752f5c5d91c.png" length="0" type="image/png"/>
        </item>
        <item>
            <title><![CDATA[Bringing Madara support to Avail's Clash of Nodes]]></title>
            <link>https://paragraph.com/@karnot/bringing-madara-support-to-avail-s-clash-of-nodes</link>
            <guid>FMWaVu1kellnkJRWOZnt</guid>
            <pubDate>Thu, 25 Jan 2024 08:50:55 GMT</pubDate>
            <description><![CDATA[In 2024, rollups have already established themselves as the quintessential scaling solution for Ethereum. However, primitive methods such as posting data on L1 can account for up to 95% of the average transaction cost. Solving this issue of scalable data availability is critical to building scalable rollups and user experiences. EIP 4844 proposes to resolve this by introducing blob transactions and reducing costs for DA on Ethereum itself. While 4844 is promising, given Ethereum&apos;s scale ...]]></description>
            <content:encoded><![CDATA[<p>In 2024, rollups have already established themselves as the quintessential scaling solution for Ethereum. However, primitive methods such as posting data on L1 can account for up to <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.starknet.io/en/roadmap/reduced-transaction-costs-via-volition-mode#:~:text=Currently%2C%20L1%20(Ethereum)%20data,both%20onchain%20and%20offchain%20data.">95% of the average transaction cost</a>. Solving this issue of scalable data availability is critical to building scalable rollups and user experiences.</p><p>EIP 4844 proposes to resolve this by introducing blob transactions and reducing costs for DA on Ethereum itself. While 4844 is promising, given Ethereum&apos;s scale and tech debt, we can be sure that a full-blown 4844 solution won’t happen anytime soon. We have proto-dank sharding, which is expected to reach mainnet this year; however, this would only be a half-baked solution in preparation for the actual 4844.</p><figure float="none" data-type="figure" class="img-center" style="max-width: null;"><img src="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/eac8b959c2ad33d74378e7e23e2b971674eac55e88006b12d26c81a4a912ef24.jpg" alt="" blurdataurl="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" nextheight="600" nextwidth="800" class="image-node embed"><figcaption HTMLAttributes="[object Object]" class="hide-figcaption"></figcaption></figure><p>As a result, we have alternate solutions like Avail, which aim to bring data availability to rollups cheaper and much faster. Avail approaches the challenges of being an efficient, available and powerful DA solution by emphasising security and integrity.</p><p>To ensure security, Avail builds on the resilient design choices it inherits from the Polkadot SDK, closely following the paradigms that govern liveness (fault tolerance and progress guarantee) and finality (immutability) on the L1 chain.</p><p>Further, Avail employs KZG commitments to maintain data integrity, ensuring reduced memory, bandwidth, and storage footprints while ensuring proofs retain succinctness. Moreover, by using light clients for sampling, Avail also achieves flexibility to scale block sizes dynamically.</p><p>Avail is very close to launching its mainnet and has its incentivised testnet underway. We are very happy to announce our “Clash of Nodes” campaign with Avail for the same!</p><h2 id="h-participating-in-clash-of-nodes" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"><strong>Participating in Clash of Nodes</strong></h2><p>Users must run a Madara app chain that uses Avail as a DA layer to participate in the Clash of Nodes campaign. While launching a Madara node can be difficult, we have streamlined the process to as simple as a few commands with our <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://mirror.xyz/karnot.eth/_Vbpyl05H1ZVhSXJNoioLWCgQjKZY56lPfuq87kc6io">new CLI tool</a> over here.</p><p><strong>Playing around with Madara and Avail</strong></p><p>Once your node is up and running locally, you can start playing around with it, deploy your contracts and make your first app chain MVP! Madara is completely compatible with all Starknet tools like ArgentX, Braavos, starknet.js, etc. So, using Madara should be as simple as using Starknet itself. If you face any issues, feel free to report them <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://discord.com/invite/availproject">here</a>. We also have a live bug bounty program <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://twitter.com/tx_track/status/1745029149289275787">running</a>.</p><p><strong>Deploying your chain</strong></p><p>Once you have tested your chain and contracts locally, it’s time to go live 🚀. We’ve two options available for you here.</p><ol><li><p><strong>Use Karnot</strong></p><p>Choosing Karnot as your RaaS provider abstracts the nitty-gritty of managing infrastructure, deployments, and configurations, allowing you to build and deploy seamlessly as we host your chain and explorer. With Avail incentivising early movers, quick adopters stand to have their app chain infrastructure costs paid by the Avail team. So, if you would like to proceed with this option, please fill out this <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://forms.gle/8cYP2d3PqMDZc5oj7">form</a>, and we will take it from there.</p></li><li><p><strong>Host it yourself</strong></p><p>For seasoned developers who prefer to control their infrastructure, Madara CLI allows you to run your own chain. To do this, you need to follow these steps.</p><ol><li><p>Use the Madara CLI to start your chain on a server. You would need to expose ports 9944 (RPC), 9615 (Prometheus) and 4000 (Explorer) so that they’re accessible to us. This is a good article on how to deploy a backend on <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://aws.plainenglish.io/deploy-your-server-to-aws-ec2-66f35fd0fca2">AWS EC2</a>.</p></li><li><p>By default, the Karnot CLI uses 0 as the Avail app_id. However, for this campaign, you must register a unique app_id for your app. Read the appendix on how to do the same.</p></li><li><p>Once you have an app_id registered, edit the file <code>~/.madara/app-chains/&lt;app_chain_name&gt;/da-config.json</code> to replace the 0 app_id with your new app_id. Once your chain is live, make sure your endpoints are publicly accessible. If you like, you can also use a custom domain, but that’s not necessary.</p></li><li><p>Now that your endpoints are working deploy your contracts on the chain and prepare them for your specific use case.</p></li><li><p>Finally, follow the instructions on the repo <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/karnotxyz/avail-campaign-listing">here</a> to get listed on the “Clash of Nodes” campaign.</p></li></ol></li></ol><h2 id="h-appendix" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"><strong>Appendix</strong></h2><h3 id="h-registering-an-app-id-on-avail" class="text-2xl font-header !mt-6 !mb-4 first:!mt-0 first:!mb-0"><strong>Registering an App Id on Avail</strong></h3><ol><li><p>Go to <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://goldberg.avail.tools/#/accounts">https://goldberg.avail.tools/#/accounts</a> and create an account on Avail. Keep the seed phrase safe.</p></li><li><p>Get funds on this new account using the Avail <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://docs.availproject.org/about/faucet/">faucet</a>.</p></li><li><p>Clone this <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://github.com/availproject/avail">repo</a>.</p></li><li><p><code>cd avail-js/examples/node-examples/</code></p></li><li><p><code>npm i</code></p></li><li><p>Edit the <code>avail-js/examples/config.ts</code> file.</p><ol><li><p>Edit the “<code>seed</code>” to the seed phrase you got in step (1).</p></li><li><p>Edit the endpoint to “<code>wss://goldberg.avail.tools:443/ws</code>”</p></li></ol></li><li><p>Edit the <code>src/create-app-id.ts</code> file</p><ol><li><p>Change appName on line 14 to something unique for your app.</p></li><li><p>Comment out line 26 (<code>process.exit(0)</code>). Without this, the app will exit before submitting your transaction to Avail. This should be fixed in the next release by Avail.</p></li></ol></li><li><p><code>npm run create-app-id</code></p></li><li><p>You would see a log like the one below. 164 will be your app_id.<code>dataAvailability.ApplicationKeyCreated:: [&quot;0x546573742061707020617364736164736164616461206173646173646173&quot;,&quot;5Ci3f87otQeRC2y5gitVvbsez6EwCinhJwaK78MU2fCjv6Q5&quot;,164]</code></p></li></ol>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/31498eaca9fde5870c4d0e6554b30f9d0164772a9190d5a34f5e7dd60cdfeb24.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Introducing Madara CLI]]></title>
            <link>https://paragraph.com/@karnot/introducing-madara-cli</link>
            <guid>SnTbU2WDhnYsn63sn8kA</guid>
            <pubDate>Thu, 25 Jan 2024 07:34:44 GMT</pubDate>
            <description><![CDATA[In the rapidly evolving web3 landscape, Madara envisions itself as a framework to build highly scalable and customisable app chains. However, navigating each step of configuration and setup for your node can be challenging. Introducing Madara CLI—a straightforward tool designed to overcome these challenges and streamline the entire app-chain development process. The Madara CLI is built to make it easier for developers to spin up local Madara nodes for development and testing purposes. It stre...]]></description>
            <content:encoded><![CDATA[<p>In the rapidly evolving web3 landscape, Madara envisions itself as a framework to build highly scalable and customisable app chains. However, navigating each step of configuration and setup for your node can be challenging. Introducing Madara CLI—a straightforward tool designed to overcome these challenges and streamline the entire app-chain development process.</p><p>The Madara CLI is built to make it easier for developers to spin up local Madara nodes for development and testing purposes. It streamlines the creation, setup, and initialisation of your node to as simple as</p><pre data-type="codeBlock" text="madara init
madara run
"><code>madara init
madara run
</code></pre><p>And that’s it! You’re good to go 🚀</p><div data-type="youtube" videoId="X36O8JkFKWA">
      <div class="youtube-player" data-id="X36O8JkFKWA" style="background-image: url('https://i.ytimg.com/vi/X36O8JkFKWA/hqdefault.jpg'); background-size: cover; background-position: center">
        <a href="https://www.youtube.com/watch?v=X36O8JkFKWA">
          <img src="{{DOMAIN}}/editor/youtube/play.png" class="play"/>
        </a>
      </div></div><p>Unpacking the features of Madara CLI:</p><ol><li><p><strong>Node Orchestration:</strong></p><p>As mentioned above, the Madara CLI allows you to launch Madara nodes seamlessly. You no longer need to worry about the different configurations and setup commands. The CLI takes care of that, so you can start within a few minutes.</p></li><li><p><strong>Node Management:</strong></p><p>As you begin testing with Madara, you will naturally find yourself playing around with different settings - DA layers, block times, genesis states and many other parameters. You will soon be overwhelmed with dozens of configurations and file systems. The Madara CLI creates a single aggregated interface in your terminal to make this easier. The <code>run</code> command shows you all the available app chains on your system so that you can select which one you want to start playing with!</p></li><li><p><strong>Unveiling Network Insights:</strong></p><p>When building on testnets, the explorer is usually the go-to tool for developers to see what’s happening on the chain. To provide the same experience, the Madara CLI allows you to seamlessly integrate the StarkCompass explorer, allowing users to inspect the entire node with minimal effort. Use the <code>explore</code> command to start an explorer locally!</p></li></ol><h2 id="h-roadmap" class="text-3xl font-header !mt-8 !mb-4 first:!mt-0 first:!mb-0"><strong>Roadmap</strong></h2><p>While this is our first version of the CLI tool, it’s enough for you to get kick-started with your Madara journey. As we progress and get more feedback, we will update the tool and add new features. For the moment, some items we plan on working on are</p><ol><li><p>Adding more DA layers</p></li><li><p>Version management</p></li><li><p>Better installation experience</p></li></ol><p>In conclusion, the CLI tool is a great fit if you seek a swift and hassle-free setup for Madara. To remain updated with future updates, follow us on Twitter.</p>]]></content:encoded>
            <author>karnot@newsletter.paragraph.com (Karnot)</author>
            <enclosure url="https://img.paragraph.com/cdn-cgi/image/format=auto/https://storage.googleapis.com/papyrus_images/e86cb1c5868f7ef1d1204dfcc596729296d38636a283e2bb31eeea62d3747f80.png" length="0" type="image/png"/>
        </item>
    </channel>
</rss>