<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cairo Lang Archives - ShiftMag</title>
	<atom:link href="https://shiftmag.dev/tag/cairo-lang/feed/" rel="self" type="application/rss+xml" />
	<link>https://shiftmag.dev/tag/cairo-lang/</link>
	<description>Insightful engineering content &#38; community</description>
	<lastBuildDate>Mon, 27 Nov 2023 09:10:27 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://shiftmag.dev/wp-content/uploads/2024/08/cropped-ShiftMag-favicon-32x32.png</url>
	<title>Cairo Lang Archives - ShiftMag</title>
	<link>https://shiftmag.dev/tag/cairo-lang/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Cairo language and Starknet: Why do they exist?</title>
		<link>https://shiftmag.dev/cairo-starknet-blockchain-2156/</link>
		
		<dc:creator><![CDATA[ShiftMag]]></dc:creator>
		<pubDate>Thu, 23 Nov 2023 16:58:08 +0000</pubDate>
				<category><![CDATA[Sponsored]]></category>
		<category><![CDATA[Web3]]></category>
		<category><![CDATA[blockchain]]></category>
		<category><![CDATA[Cairo Lang]]></category>
		<category><![CDATA[SpaceShard]]></category>
		<category><![CDATA[Starknet]]></category>
		<guid isPermaLink="false">https://shiftmag.dev/?p=2156</guid>

					<description><![CDATA[<p>Learn why Cairo Lang was invented, how it can help in the blockchain world, and as a general-purpose language. </p>
<p>The post <a href="https://shiftmag.dev/cairo-starknet-blockchain-2156/">Cairo language and Starknet: Why do they exist?</a> appeared first on <a href="https://shiftmag.dev">ShiftMag</a>.</p>
]]></description>
										<content:encoded><![CDATA[<figure class="wp-block-post-featured-image"><img fetchpriority="high" decoding="async" width="1200" height="630" src="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-lang-starknet.png?x94846" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" style="object-fit:cover;" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-lang-starknet.png 1200w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-lang-starknet-300x158.png 300w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-lang-starknet-1024x538.png 1024w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-lang-starknet-768x403.png 768w" sizes="(max-width: 1200px) 100vw, 1200px" /></figure>


<p class="wp-block-paragraph">Let&#8217;s imagine we live in a country that wants to explore space! So, how does this exploration start? By having that country&#8217;s engineers do various calculations and experiments, for example, how to save fuel? What is the best launch window? What would be the best trajectory of our rocket?</p>



<p class="wp-block-paragraph">To solve some of these questions, these <strong>engineers developed algorithms and programs</strong> that help give answers&#8230; They use one of the typical programming languages, let&#8217;s say, for example, Rust language!</p>



<figure class="wp-block-image size-full"><img decoding="async" width="970" height="252" src="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet1.png?x94846" alt="" class="wp-image-2157" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet1.png 970w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet1-300x78.png 300w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet1-768x200.png 768w" sizes="(max-width: 970px) 100vw, 970px" /></figure>



<p class="wp-block-paragraph">All was fine and well until they realized that, for some calculations,<strong> they needed a supercomputer!</strong> But they don&#8217;t have such a machine!</p>



<p class="wp-block-paragraph">And to add insult to injury, the only country with this supercomputer is the rival country!!</p>



<figure class="wp-block-image size-full"><img decoding="async" width="950" height="280" src="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet2.png?x94846" alt="" class="wp-image-2158" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet2.png 950w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet2-300x88.png 300w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet2-768x226.png 768w" sizes="(max-width: 950px) 100vw, 950px" /></figure>



<p class="wp-block-paragraph"><strong>What can they do?</strong> If they send our algorithms to the rival&#8217;s supercomputer, how can they be sure there was no tampering or sabotage with the calculations?</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="601" height="401" src="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet3.png?x94846" alt="" class="wp-image-2159" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet3.png 601w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet3-300x200.png 300w" sizes="auto, (max-width: 601px) 100vw, 601px" /></figure>



<p class="wp-block-paragraph">And the answer is &#8211; unfortunately, it is not possible to know (verify) this… But wait a minute! Engineers are the ones who constantly work on inventing and building something you need, right?</p>



<h2 class="wp-block-heading"><span id="solution-cairo-language"><strong>Solution: Cairo Language</strong></span></h2>



<p class="wp-block-paragraph">Fast forward a few months, and we have a solution! It is a <strong>new programming language called Cairo!</strong></p>



<p class="wp-block-paragraph"><strong>But how does this new language help?</strong></p>



<p class="wp-block-paragraph">Well, Cairo creates a <strong>provable</strong> program, meaning a cryptographic proof is generated alongside the result of the computation. But, one more thing that is very important, or crucial, is that the process of proof verification can detect cheating or malfunctioning without re-execution!! In other words, a regular computer can<strong> keep a supercomputer honest!</strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="994" height="435" src="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet4.png?x94846" alt="" class="wp-image-2160" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet4.png 994w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet4-300x131.png 300w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet4-768x336.png 768w" sizes="auto, (max-width: 994px) 100vw, 994px" /></figure>



<p class="wp-block-paragraph">This is possible by relatively complex math (polynomial equations that satisfy certain constraints) and cryptography!</p>



<p class="wp-block-paragraph">The Cairo language was invented by an Israeli company called <a href="https://starkware.co/" target="_blank" rel="noreferrer noopener">Starkware</a> as the <strong>first general-purpose provable language</strong>, and we will shortly see how <a href="https://www.cairo-lang.org/resource-guide/" target="_blank" rel="noreferrer noopener">Cairo</a> can be used in other interesting ways that were not possible before!</p>



<h2 class="wp-block-heading"><span id="the-blockchain-scaling-problem"><strong>The blockchain scaling problem</strong></span></h2>



<p class="wp-block-paragraph">The famous blockchain scaling trilemma says that <strong>we cannot have optimal Scalability, Security, and Decentralization properties in a blockchain</strong> at the same time.</p>



<p class="wp-block-paragraph">This is why various blockchains sacrifice one of these three properties in favor of the other two, based on their use cases.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="342" height="276" src="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet5.png?x94846" alt="" class="wp-image-2161" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet5.png 342w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet5-300x242.png 300w" sizes="auto, (max-width: 342px) 100vw, 342px" /></figure>



<p class="wp-block-paragraph">The most popular blockchain, <a href="https://ethereum.org/en/" target="_blank" rel="noreferrer noopener">Ethereum</a>, has sacrificed Scalability because of its design, that values decentralization and security. This resulted in very high fees during periods of high activity on Ethereum (especially during the bull market)!</p>



<p class="wp-block-paragraph">On Ethereum, as we can see in the picture, a block producer creates some transactions, and then all the nodes in the network must validate these transactions!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="943" height="428" src="https://shiftmag.dev/wp-content/uploads/2023/11/ethereum-block.png?x94846" alt="" class="wp-image-2162" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/ethereum-block.png 943w, https://shiftmag.dev/wp-content/uploads/2023/11/ethereum-block-300x136.png 300w, https://shiftmag.dev/wp-content/uploads/2023/11/ethereum-block-768x349.png 768w" sizes="auto, (max-width: 943px) 100vw, 943px" /></figure>



<p class="wp-block-paragraph">To tackle this problem, various solutions have been considered, and it seems like one of them has emerged that solves this problem pretty nicely &#8211; the so-called<strong> Layer 2s or Rollups</strong>!</p>



<p class="wp-block-paragraph">The point of &#8220;rollups&#8221; is to <strong>perform the bulk of the activity outside the original chain</strong>, meaning &#8211; process transactions off the main chain, batch, compress (replace data with computation), and deliver the transaction data to the main chain &#8211; Ethereum. This means we can take hundreds of transactions away from Ethereum to a Layer 2 chain, <strong>compress them into just one transaction</strong>, and send them back to Ethereum.</p>



<p class="wp-block-paragraph">In this way, Ethereum provides Security and Decentralization, and Layer 2 chains provide Scalability!</p>



<p class="wp-block-paragraph">But, you may ask, how does this story relate to our already-introduced Cairo language??</p>



<h2 class="wp-block-heading"><span id="starknet"><strong>Starknet</strong></span></h2>



<p class="wp-block-paragraph">Starkware <strong>created its own Layer 2 blockchain</strong>, <a href="https://www.starknet.io/en" target="_blank" rel="noreferrer noopener">Starknet</a>, where you can write smart contracts using the new Cairo language!</p>



<p class="wp-block-paragraph">Let&#8217;s see how Starknet and Cairo help scale Ethereum!</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1004" height="558" src="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet6.png?x94846" alt="" class="wp-image-2163" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet6.png 1004w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet6-300x167.png 300w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet6-768x427.png 768w" sizes="auto, (max-width: 1004px) 100vw, 1004px" /></figure>



<p class="wp-block-paragraph">So the idea is that with the power of Cairo Smart contracts, we can do whatever we want on Layer 2 (Starknet), and when we are done, we send only one transaction to Ethereum… But this time, together with proof! If you pay attention, you will see in the picture below that it takes <strong>much less time to validate this proof than to execute the hundreds of original transactions!</strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1011" height="508" src="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet7.png?x94846" alt="" class="wp-image-2164" srcset="https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet7.png 1011w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet7-300x151.png 300w, https://shiftmag.dev/wp-content/uploads/2023/11/cairo-starknet7-768x386.png 768w" sizes="auto, (max-width: 1011px) 100vw, 1011px" /></figure>



<p class="wp-block-paragraph">This can <strong>save us a ton of money on transaction fees</strong> and enable many more transactions than was originally possible on Ethereum itself, thus helping us solve the scalability problem!</p>



<p class="wp-block-paragraph">Yay!</p>



<h2 class="wp-block-heading"><span id="summary"><strong>Summary</strong></span></h2>



<p class="wp-block-paragraph">In this article, we explored why Cairo Lang was invented, how it can help in the blockchain world, and as a general-purpose language. We learned about L2-s/rollups, particularly Starknet, and how they help scale the Ethereum blockchain.</p>



<p class="wp-block-paragraph">But this is just the tip of the iceberg! <br>If you want to learn more about Starknet, here&#8217;s where you can start:</p>



<ul class="wp-block-list">
<li><a href="https://www.spaceshard.io/blog/learning-starknet-community-edu-resources" target="_blank" rel="noreferrer noopener">Learning about Starknet &#8211; Community, Hub &amp; Edu Resources</a></li>



<li><a href="https://www.spaceshard.io/blog/starknet-developer-tools" target="_blank" rel="noreferrer noopener">Tools for developers on Starknet</a></li>
</ul>
<p>The post <a href="https://shiftmag.dev/cairo-starknet-blockchain-2156/">Cairo language and Starknet: Why do they exist?</a> appeared first on <a href="https://shiftmag.dev">ShiftMag</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 

Served from: shiftmag.dev @ 2026-05-31 14:21:08 by W3 Total Cache
-->