{"id":6124,"date":"2023-06-21T14:07:41","date_gmt":"2023-06-21T14:07:41","guid":{"rendered":"https:\/\/metaschool.so\/articles\/?p=6124"},"modified":"2023-06-22T06:54:36","modified_gmt":"2023-06-22T06:54:36","slug":"starknet-alpha-and-cairo-1-0-release-news","status":"publish","type":"post","link":"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/","title":{"rendered":"Starknet Alpha &#038; Cairo 1.0 Have Arrived"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_56_1 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#Whats_the_news\" title=\"What\u2019s the news?\">What\u2019s the news?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#What_do_builders_on_Starknet_need_to_know\" title=\"What do builders on Starknet need to know?\">What do builders on Starknet need to know?<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#1_Genesis_block\" title=\"1. Genesis block\">1. Genesis block<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#2_Wallet_update\" title=\"2. Wallet update\">2. Wallet update<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#3_No_need_for_migration\" title=\"3. No need for migration\">3. No need for migration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#4_Forced_transactions\" title=\"4. Forced transactions\">4. Forced transactions<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#Why_the_shift_to_Cairo_10\" title=\"Why the shift to Cairo 1.0?\">Why the shift to Cairo 1.0?<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#1_Speed\" title=\"1. Speed\">1. Speed<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#2_Security\" title=\"2. Security\">2. Security<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#3_Expressiveness\" title=\"3. Expressiveness\">3. Expressiveness<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#What_to_expect\" title=\"What to expect.\">What to expect.<\/a><ul class='ez-toc-list-level-3'><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#1_Updated_syntax\" title=\"1. Updated syntax\">1. Updated syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#2_New_tools\" title=\"2. New tools\">2. New tools<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/metaschool.so\/articles\/starknet-alpha-and-cairo-1-0-release-news\/#3_Ownership_and_references\" title=\"3. Ownership and references\">3. Ownership and references<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<p>Metamorphosis. Transfiguration. Reincarnation. Rebirth. The newer versions of the Starknet blockchain (now Alpha v0.11.2) and its native language Cairo (now Cairo 1.0) are here with a bang and they\u2019re calling it <strong>Regenesis<\/strong> (which is so fitting \ud83d\ude0d you&#8217;ll know why as you read on).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/screenshot-1024x546.png\" alt=\"starknet regenesis poster\" class=\"wp-image-6129\" width=\"1024\" height=\"546\" srcset=\"https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/screenshot-1024x546.png 1024w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/screenshot-300x160.png 300w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/screenshot-150x80.png 150w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/screenshot-768x410.png 768w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/screenshot.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Source: Starknet\/Twitter<\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-s-the-news\"><span class=\"ez-toc-section\" id=\"Whats_the_news\"><\/span>What\u2019s the news?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Earlier this year in January 2023, StarkWare Industries announced the first public version of Cairo 1.0. Before that, in September 2022, they shared their detailed Regenesis plan for the <a href=\"https:\/\/metaschool.so\/blockchains\/starknet\" target=\"_blank\" rel=\"noreferrer noopener\">Starknet blockchain<\/a> motivated by Cairo 1.0.<\/p>\n\n\n\n<p>For starters, the updated programming language native to Starknet, Cairo 1.0 is everything that Cairo v0 was BUT also everything that it isn\u2019t. By that we mean it takes several aspects of Cairo v0 but builds upon it with newer, improved features in Cairo 1.0.<\/p>\n\n\n\n<p>As for Starknet, the blockchain has gone through 9 version updates so far. The latest version update known as Starknet Alpha or v0.11.2 is live on the mainnet. It took place on May 31st, 2023 and now requires its users to work with Cairo 1.0-based contracts only.<\/p>\n\n\n\n<p>\ud83d\udd2e <em>Also, we updated our course from Cairo v0 to Cairo 1.0 to match the occasion. Check it out.<\/em><\/p>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button aligncenter is-style-primary\"><a class=\"wp-block-button__link\" href=\"https:\/\/metaschool.so\/courses\/create-erc20-token-on-starknet-in-cairo-language\" target=\"_blank\" rel=\"noreferrer noopener\">Create ERC-20 Token in Cairo 1.0 on Starknet<\/a><\/div>\n<\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-do-builders-on-starknet-need-to-know\"><span class=\"ez-toc-section\" id=\"What_do_builders_on_Starknet_need_to_know\"><\/span>What do builders on Starknet need to know?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>After the Starknet Regenesis, the following changes are expected to take place within the blockchain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-genesis-block\"><span class=\"ez-toc-section\" id=\"1_Genesis_block\"><\/span>1. Genesis block<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Apart from being compatible with Cairo 1.0-based contracts, Starknet will start from a new <a href=\"https:\/\/metaschool.so\/articles\/genesis-block-meaning\/\">genesis block<\/a> with an existing state.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-wallet-update\"><span class=\"ez-toc-section\" id=\"2_Wallet_update\"><\/span>2. Wallet update<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>For the users of the current older version of Starknet to benefit from the newer version, they simply need to update their Starknet wallet.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-no-need-for-migration\"><span class=\"ez-toc-section\" id=\"3_No_need_for_migration\"><\/span>3. No need for migration<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Developers who are <a href=\"https:\/\/metaschool.so\/courses\/build-your-own-web3-twitter-dapp-with-solidity\" target=\"_blank\" rel=\"noreferrer noopener\">building dApps<\/a> aboard Starknet will be required to port their contracts and dApps to Cairo 1.0. Porting will require following a simple upgrade guideline provided by the organization. There is no migration involved. No restart or clean slate either. Everything is streamlined. Applications that follow the given guidelines will be permitted to launch on the Alpha mainnet without any problem.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-twitter wp-block-embed-twitter\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\"><p lang=\"en\" dir=\"ltr\">No need for state reset.<br><br>No need to migrate your dApp.<br><br>StarkNet Alpha will be brought to production smoothly.<br><br>Our Regenesis process preserves history and prevents downtime for dApps. <a href=\"https:\/\/t.co\/bvPzjmNQBl\" target=\"_blank\">pic.twitter.com\/bvPzjmNQBl<\/a><\/p>&mdash; Starknet \ud83d\udc49\ud83d\udc48 (@Starknet) <a href=\"https:\/\/twitter.com\/Starknet\/status\/1583037836516679680?ref_src=twsrc%5Etfw\" target=\"_blank\" rel=\"noopener\">October 20, 2022<\/a><\/blockquote><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-forced-transactions\"><span class=\"ez-toc-section\" id=\"4_Forced_transactions\"><\/span>4. Forced transactions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Cairo 1.0 will support gas metering. This means that Starknet Regenesis will lead to a more <a href=\"https:\/\/metaschool.so\/gastracker\">intuitive gas fee market<\/a>. Gas metering will also allow forced transactions from <a href=\"https:\/\/metaschool.so\/articles\/layer-1-blockchain\/\">Layer 1<\/a> which will enhance the censorship resistance capabilities of the blockchain.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-the-shift-to-cairo-1-0\"><span class=\"ez-toc-section\" id=\"Why_the_shift_to_Cairo_10\"><\/span>Why the shift to Cairo 1.0?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There is no doubt that newer programming languages have been fangirling over the Rust programming language, but not many have had the guts to pivot. Although Cairo v0 was also inspired by Rust, Cairo 1.0 shares more similarities with Rust.<\/p>\n\n\n\n<p>And while Starknet Regenesis is in line with the changes in Cairo v0, it is important to understand why Cairo\u2019s newer version happens to again use Rust as an inspiration.<\/p>\n\n\n\n<p>Cairo\u2019s version update was triggered by a few significant reasons. These reasons include:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-speed\"><span class=\"ez-toc-section\" id=\"1_Speed\"><\/span>1. Speed<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Despite the fact that the Starknet blockchain had handled $790 billion worth of trades and processed over 300 million transactions, Cairo v0 was not inherently a fast language. 300 million transactions in 2 years is not a great number. There are more transactions, some 1.1 trillion, carried out on <a href=\"https:\/\/metaschool.so\/courses\/writing-your-first-hello-world-contract-in-solidity\" target=\"_blank\" rel=\"noreferrer noopener\">smart contracts written on Solidity<\/a> in a year alone.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-rich is-provider-twitter wp-block-embed-twitter\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\"><p lang=\"en\" dir=\"ltr\">GGs to the old game!<br><br>Cairo 1.0, a more expressive and easier-to-learn language than Solidity, is here to extend the power of Ethereum, not replace it. <br><br>A legendary expansion pack! \ud83e\udd84 \ud83c\udf89\ud83d\udd2e<\/p>&mdash; Starknet \ud83d\udc49\ud83d\udc48 (@Starknet) <a href=\"https:\/\/twitter.com\/Starknet\/status\/1670786034387255296?ref_src=twsrc%5Etfw\" target=\"_blank\" rel=\"noopener\">June 19, 2023<\/a><\/blockquote><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script>\n<\/div><\/figure>\n\n\n\n<p>So the optimization of Cairo 1.0 and the change in its syntax allow it to write more and better smart contracts which will now subsequently increase the overall throughput of the applications deployed on the Starknet blockchain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-security\"><span class=\"ez-toc-section\" id=\"2_Security\"><\/span>2. Security<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Cairo v0 had security vulnerabilities, memory leaks, and race conditions. This is another reason that triggered the advent of Cairo 1.0. It&#8217;s a strongly-typed language which provides more ownership and has a new type system.<\/p>\n\n\n\n<p>It also has Sierra which is a new intermediate representation layer that ensures that each run code is proven. This increases security and helps prevent DOS attacks.<\/p>\n\n\n\n<p>Moreover, apart from the genesis block and wallet update, Cairo 1.0 will allow Starknet to include reverted transactions in blocks. This will allow sequencers to be paid on the execution of reverted transactions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-expressiveness\"><span class=\"ez-toc-section\" id=\"3_Expressiveness\"><\/span>3. Expressiveness<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Cairo v0 was not an expressive language. It was not easy to write concise and expressive codes on it. Cairo 1.0 has new functions that do the needful. These functions include but are not limited to pattern matching, nested functions, and generics.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-to-expect\"><span class=\"ez-toc-section\" id=\"What_to_expect\"><\/span>What to expect.<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>What can developers expect of Cairo? While there have been a number of backend updates on the Cairo programming language, the major front-end update is the change in the syntax. You may expect some familiar concepts if you have been using Rust, since Cairo 1.0 is very similar to Rust both syntax-wise and concepts-wise.<\/p>\n\n\n\n<p>On the backend, you may expect faster compilation, a better interface, ease of writing code, and an increase in overall speed and safety. Here are some pointers that give you a sneak peek into the latest Cairo version:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-updated-syntax\"><span class=\"ez-toc-section\" id=\"1_Updated_syntax\"><\/span>1. Updated syntax<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The syntax of Cairo 1.0 is quite similar to that of Rust. Thus, you may expect familiar concepts and functions. An example is that of traits. It is a concept that allows sharing of a certain behavior across types. While traits don\u2019t exactly behave the same way in Cairo as they do in Rust, there is a similarity.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"354\" src=\"https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/code01.png\" alt=\"rust and cairo similarities code\" class=\"wp-image-6128\" srcset=\"https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/code01.png 720w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/code01-300x148.png 300w, https:\/\/metaschool.so\/articles\/wp-content\/uploads\/2023\/06\/code01-150x74.png 150w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><figcaption>Rust like match expressions in Cairo 1.0 \/ Source: <a href=\"http:\/\/www.starknet.io\" target=\"_blank\" rel=\"noreferrer noopener\">Starknet.io<\/a><\/figcaption><\/figure><\/div>\n\n\n\n<p>Then there are generics. You can use generics in traits by specifying the generic type in the trait definition. For example, a code that defines a trait called Comparable can be used to compare any two values of the same type.<\/p>\n\n\n\n<p>Other concepts like mutable variables and return statements that were previously found in Rust and can now be found in Cairo 1.0 too.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-new-tools\"><span class=\"ez-toc-section\" id=\"2_New_tools\"><\/span>2. New tools<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You may also expect a considerable improvement in the overall tooling. Cairo 1.0 has a range of tools which include code liner, debugger, etc. Moreover, there are dictionaries and a blazing-fast compiler, and much more.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-ownership-and-references\"><span class=\"ez-toc-section\" id=\"3_Ownership_and_references\"><\/span>3. Ownership and references<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Cairo 1.0 also has ownership which is similar to Rust. How ownership works is that when doing assignments (let x = y), the ownership of the variable is transferred, which is known as a move. A variable that was moved can&#8217;t be accessed later in the scope, and the compiler will throw an Variable was previously moved error. This removes the margin of error while coding and increases efficiency.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Finally<\/strong>, <\/p>\n\n\n\n<p>All in all, Cairo 1.0 served as a motivation for Starknet to undergo the changes and become Starknet Alpha with its v0.11.2 update. Together, the new dynamic duo in town are here to enhance the security, scalability, and speed of the Ethereum blockchain. So, are you ready to <a href=\"https:\/\/metaschool.so\/courses\/create-erc20-token-on-starknet-in-cairo-language\" target=\"_blank\" rel=\"noreferrer noopener\">write a smart contract on Starknet Alpha with Cairo 1.0<\/a>?<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":6136,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[17],"tags":[36,318,317],"class_list":["post-6124","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blockchain","tag-blockchain-applications","tag-cairo-programming-language","tag-starknet-blockchain"],"_links":{"self":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/6124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/comments?post=6124"}],"version-history":[{"count":15,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/6124\/revisions"}],"predecessor-version":[{"id":6143,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/posts\/6124\/revisions\/6143"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/media\/6136"}],"wp:attachment":[{"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/media?parent=6124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/categories?post=6124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/metaschool.so\/articles\/wp-json\/wp\/v2\/tags?post=6124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}