The Good Tech Companies - Building dApps that Last: Why Cairo is the Winner Programming Language for Web3 Devs
Episode Date: November 14, 2024This story was originally published on HackerNoon at: https://hackernoon.com/building-dapps-that-last-why-cairo-is-the-winner-programming-language-for-web3-devs. Like th...e city itself - a learning gateway to complex histories, Cairo, the coding language, is opening new doors in the decentralised world Check more stories related to web3 at: https://hackernoon.com/c/web3. You can also check exclusive content about #web3-development, #web3-programming-languages, #cairo, #cairo-programming-language, #starknet, #starknet-in-devcon-2024, #good-company, #use-cases-for-cairo, and more. This story was written by: @starknetfoundation. Learn more about this writer by checking @starknetfoundation's about page, and for more stories, please visit hackernoon.com. Cairo is designed to be a highly optimized provable programming language, and it just so happens that STARKs are great for scaling Ethereum, too, because verifying a proof takes less time than executing the program with the same inputs. Hence, Starknet is quite literally written in Cairo with the goal of scaling Ethereum and building Web3 applications. Starknet enhances Ethereum’s scalability by enabling the network to handle a higher volume of transactions without the usual slowdown or high fees. It achieves this by posting only state differences to Ethereum and aggregating many Starknet state transition proofs together to create a single proof, meaning the proving cost is amortized across many users. This process relies on zero-knowledge proofs (ZKPs), allowing Ethereum to verify transactions securely without exposing each detail—similar to receiving a summary receipt. By processing transactions in bulk and only sharing essential data with Ethereum, Starknet’s use of Cairo not only cuts costs but also improves transaction speed.
Transcript
Discussion (0)
This audio is presented by Hacker Noon, where anyone can learn anything about any technology.
Building DAPPs that last. Why Cairo is the winner programming language for Web3 devs
by StarkNet Foundation. Info written by James Strudwick, Executive Director, StarkNet Foundation.
Greater than, to understand the world, you must understand Cairo.
This sentiment, often attributed to the Egyptian writer Naguib Mahfouz,
speaks to the significant role the ancient city played in shaping global culture,
politics, and history. Now, a coding language of the same name is becoming just as essential
to understanding the Web3 ecosystem. Like the city itself, a learning gateway to complex histories,
Cairo, the coding language, is opening new doors in
the decentralized world, driving innovation and accessibility. But what makes Cairo unique
compared to other programming tools? And why should Web3 developers invest time to master it?
Tip if you are willing to take the plunge and learn the best from the very best,
sign up to StarkNet's bootcamp and learn everything you need to know about Cairo.
What does Cairo do?
Cairo is designed to be a highly optimized provable programming language, and it just so happens that Starks are great for scaling Ethereum, too, because verifying a proof takes less time
than executing the program with the same inputs. Hence, StarkNet is quite literally written in
Cairo with the goal of scaling Ethereum and building Web3 applications.
StarkNet enhances Ethereum's scalability by enabling the network to handle a higher volume of transactions without the usual slowdown or high fees. It achieves this by posting only
state differences to Ethereum and aggregating many StarkNet state transition proofs together
to create a single proof, meaning the proving cost is amortized across many users. This process relies
on zero-knowledge proofs, ZKPs, allowing Ethereum to verify transactions securely without exposing
each detail, similar to receiving a summary receipt. By processing transactions in bulk
and only sharing essential data with Ethereum, StarkNet's use of Cairo not only cuts costs but
also improves transaction speed.'s use of Cairo not only cuts costs but also improves transaction speed.
Use cases for Cairo Cairo's efficiency and privacy features
make it indispensable for several Web3 applications.
In DeFi, Cairo enables platforms to manage high transaction volumes at a lower cost,
making services more accessible.
In the NFT space, Cairo supports the creation and transfer of digital collectibles with reduced
transaction fees, enhancing market accessibility and scalability. Additionally, with Cairo a
developer can efficiently verify other proving systems that already have privacy as a common
feature. While Cairo's powerful capabilities make it essential for advancing Ethereum and Web3,
its complexity presents a learning curve for developers. However, for those who master it, Cairo unlocks vast potential to drive the future
of decentralized applications. As a highly sought-after niche skill, Cairo is valued by
like-minded individuals who share a desire to create long-lasting applications that can drive
mass adoption forward in a meaningful way. They also gain insight into
Cairo's distinct advantages when compared to more popular and traditional programming languages.
Cairo vs. other programming languages. Take, for example, Rust. With its performance,
safety, and multi-platform capabilities, Rust is ideal for developers who want flexibility
across blockchain platforms and other applications. However, Cairo is better
suited than Rust for Ethereum scaling and specific blockchain applications because it was designed
with these use cases in mind. Rust lacks Cairo's specific capabilities for Ethereum scalability and
privacy, like transaction bundling and ZKPs. Cairo's integration with Starknet and Ethereum
makes it a more specialized tool for developers
focused on scaling and optimizing Ethereum-based applications.
Rust is more versatile and flexible across various blockchain platforms,
but it lacks the huge efficiency that Cairo delivers, which scales Ethereum.
Cairo vs. Solidity
As Ethereum's primary language for creating smart contracts,
Solidity IS designed to handle individual
transactions within the blockchain. Cairo complements Solidity by addressing Ethereum's
need for scalability by being an efficient language to verify proofs of computational integrity.
Cairo, being both a smart contract and programming language, means that it can be used for on-chain
and off-chain operations. In comparison, Solidity cannot aggregate blocks together as it can be used for on-chain and off-chain operations. In comparison, Solidity cannot
aggregate blocks together as it can't be used outside the EVM. By focusing on transaction
scalability, Cairo enhances the performance of Solidity-based smart contracts, making the two
languages complementary, with Cairo providing a crucial layer for handling high-volume blockchain
activity with native computational integrity. Cairo vs. Python While Python is known for its versatility
and ease of use across data science, machine learning, and web development, Cairo is a
specialized provable language focused on scaling Ethereum. Python's beginner-friendly design,
readability, and flexibility make it ideal for general-purpose applications,
but these strengths don't translate to blockchain-specific needs. While Python is suited to various industries, Cairo's performance
is tailored to the demands of Web3, making it better equipped for blockchain scalability and
transaction efficiency. Cairo vs C++, Java, C++ and Java are high-performance, general-purpose
languages used in applications such as gaming
and enterprise software, where speed and complex logic are required. However, Cairo, with its
provable nature and modern compiler architecture, can, in the context of a sequencer, execute
operations concurrently and is able to scale to thousands by aggregating execution proofs together,
constraining them all against the same set of rules that Ethereum verifies. This gives Cairo great security, as someone can't produce a block
without it complying with the StarkNetOS rules. Cairo is also uniquely tailored for the Ethereum
blockchain, specifically designed to handle the demands of decentralized finance and high
transaction throughput. While C++ and Java excel in traditional, centralized environments,
Cairo's ability to be a developer-friendly provable language, manage bulk transactions
off-chain, and verify them securely makes it a superior choice for blockchain scaling,
where general-purpose languages like C++ and Java fall short. The other aspect of C++ and Java is
that they are antiquated with large user bases,
and they want to keep the language mostly the same. This is where Cairo comes in as something different with the ability to adopt new ideas and technologies, further demonstrating its
superiority. Why Cairo matters for Web3 developers
Cairo is a top-tier language when it is the right tool for the job, specifically if you want to
scale Ethereum, but if you want super-efficient, non-verifiable, memory-safe programs then Rust should be your go-to.
However, as demand for Ethereum applications grows, so does the need for solutions that
reduce costs and improve speed, making Cairo a key player in the Web3 ecosystem.
Developers can overcome the limitations of traditional coding languages in blockchain
and bring applications to life that operate at scale and at lower costs. While it may not yet
be as widespread as other languages, Cairo is crucial for the future of Web3. Just as Cairo,
the city, is a bridge to understanding complex histories, Cairo, the coding language,
is a bridge to a more accessible, efficient, and decentralized future.
Does it take time to master?
Yes.
Can you do it?
We want you to.
But anything worth doing, anything that will set you apart from the mundane and make you
great, requires dedication and effort.
Cairo was not built in a day.
Web3 won't be either.
However, with a skilled team of developers, the future holds tremendous potential for
a better society
for everyone. Tip if you are willing to take the plunge and learn the best from the very best,
sign up to Starknet's bootcamp and learn everything you need to know about Cairo.
N thank you for listening to this HackerNoon story, read by Artificial Intelligence.
Visit HackerNoon.com to read, write, learn and publish.