1. Home
  2. Cairo

Cairo

StarkNet overhauls Cairo programming language to drive developer adoption

Ethereum layer-2 scaling platform StarkNet has revamped its Cairo programming language to enable easier onboarding of new developers.

Ethereum layer-2 scaling platform StarkNet has overhauled its in-house Cairo coding language to make Web3 development accessible to developers.

An announcement shared with Cointelegraph outlined the upgrades to Cairo 1.0, which is touted to emulate characteristics of the popular programming language Rust. The overhaul intends to allow developers with general coding experience to begin building decentralized applications on StarkNet’s Ethereum layer-2 network.

StarkWare co-founder and president Eli Ben-Sasson told Cointelegraph that making layer-2 development more accessible to developers of varying backgrounds was the main reason for Cairo’s revamp:

“Primary drivers were safety and ease of use, and conducting the overhaul presented a terrific opportunity to remove the entry for developers with conventional language backgrounds.”

Technical specifications outlined in the Jan. 5 launch encompass a host of improvements to Cairo’s language. This includes improved syntax and language constructs, a holistic type system, intuitive libraries, optimized code and strong typing by demanding specification of data types.

StarkNet highlights Sierra as the main addition to Cairo’s overhaul, which stands for Safe Intermediate Representation. Sierra acts as a new intermediate representation layer between Cairo 1.0 and Cairo byte code.

As Ben Sasson explained, Sierra is an important aspect of ensuring a permissionless network. The upgrade enables reverted transactions to be included in StarkNet blocks, helping the protocol to avoid adding complex ‘crypto-economic mechanisms.’

Related: StarkNet makes Cairo 1.0 open source in first step toward community control

Ben Sasson said that Sierra will allow StarkNet to ‘inherit the full censorship-resistance of Ethereum’ and mainly protects against Sequencer Denial of Service (DoS) attacks.

As previously reported by Cointelegraph, Ben-Sasson pioneered ZK-STARK cryptography alongside other computer scientists. Zero-Knowledge Scalable Transparent Arguments of Knowledge is a proof system that encrypts and verifies transaction data to provide security, scalability and resistance to quantum computing.

According to StarkNet, Cairo is the fourth most popular smart contract language by total value locked. It is the base of applications that have processed over 300 million transactions, minted 90 million NFTs and facilitated $790 million worth of trades settled on Ethereum.

XRP jumps 25% as SEC may not pursue appeal after Gensler’s departure

StarkNet makes Cairo 1.0 open source in first step toward community control

StarkNet has prioritized scalability over composability and transparency. But it’s now working on making its tech open source.

Zero-knowledge (ZK)-Rollup tech company StarkWare has officially open sourced its new programming language compiler, Cairo 1.0, which will soon be supported on Ethereum layer-2 scaling solution StarkNet in Q1 2023. 

The news was announced by StarkWare — the company behind StarkNet — in a Nov. 25 Twitter post. StarkWare’s rollup technology and recursive proofs offer the potential to compress millions of transactions on L2 into a single transaction on Ethereum, however the project has been criticized for maintaining control over its IP, not least of all by its more open source focused competitor zkSync.

StarkWare described open sourcing Cairo as a “milestone move” in its quest to hand over more control and intellectual property rights to its community and developers. Cairo is a programming language written specifically to harness the power of zk rollups and validity proofs.

StarkWare stated that developers can now experiment with Cairo 1.0 by compiling and executing simple applications until it is fully supported on StarkNet in Q1 2023.

At that point Cairo 1.0 will enable faster feature development and allow for more community involvement, according to Starkware Exploration Lead and former Ethereum core developer Abdelhamid Bakhta.

“We’re continuing to open source the StarkNet tech stack, beginning with Cairo 1.0. We’re doing this in order to fulfill StarkNet's vision as a public good that anyone can use, and that the community can constantly improve,” he said.

“On a practical level this maximizes transparency about our code, and our coding process. And it strengthens the community’s ability to find bugs and improve the compiler. With each aspect of the tech stack that is open sourced, this sense of community involvement will grow and grow.”

Once in production, Cairo 1.0 will also enable blockchain developers to write and deploy smart contracts to StarkNet, according to StarkWare’s Medium post.

StarkWare added that because Cairo 1.0 makes every computation “provable,” StarkNet’s censorship resistance properties will be strengthened and it’ll also be better positioned to respond to Denial-of-Service attacks.

StarkWare’s STARK tech stack powers a number of Web3 projects including decentralized exchange (DEX) platform dYdX (although this is moving to its own chain on Cosmos), NFT-platform Immutable X and blockchain interoperability protocol Celer Network.

Related: 60 million NFTs could be minted in a single transaction — StarkWare co-founder

StarkNet has taken a gamble by using Cairo to speed up its solution, which is not natively compatible with the Ethereum Virtual Machine (EVM). However Ethereum software tooling firm Nethermind built a transpiler called Warp that converts Solidity code into Cairo code.

Competitor zkSync’s EVM-compatible mainnet is in the process of being launched.

But despite taking a more difficult path, StarkWare founder Eli Ben-Sasson recently told Cointelegraph that using custom built programming language like Cairo, as opposed to Solidity, was the only viable way to take full advantage of Ethereum scaling afforded by ZK rollups:

“I’m willing to bet that you won’t see a full blown ZK EVM that can put a million transactions inside a single proof on Ethereum. As we can easily do today and have been doing for months and years.”

The news comes as Starkware also recently deployed the new StarkNet token (STRK) on Ethereum on Nov. 17, which will be used for staking and voting purposes in addition to paying fees on the network.

XRP jumps 25% as SEC may not pursue appeal after Gensler’s departure

Decentralized exchange Uniswap v3 gets ‘Warp’ed’ onto StarkNet

Ethereum-native projects like Uniswap that are written in Solidity can now be transpiled to StarkNet via Nethermind’s new ‘Warp’ project

Ethereum development company Nethermind has announced it has “transpiled and compiled” decentralized exchange (DEX) Uniswap v3 on “Warp” — a project designed to allow Ethereum users to swap tokens on the more scalable Ethereum layer-2 network StarkNet. 

The milestone was announced by team lead Jorik Schellekens in an Oct. 9 Medium post.

Nethermind describes Warp as a “Solidity to Cairo Transpiler” which enables Ethereum-based projects written in Solidity to transition its codebase onto StarkNet, allowing them to capitalize on cheaper fees.

Transpiling is the process of taking source code written in one programming language and transforming it into another language that has a similar level of abstraction.

In this case, Warp transpiles Solidity code to Cairo — the programming language used to write applications on StarkNet.

The Warp plugin is still technically under development according to Schellekens, but he added that Nethermind will soon have “Uniswap’s entire test suite running against a Uniswap implementation deployed on StarkNet.”

The milestone came following StarkNet’s new “contract creation from other contracts” capability, which is what enabled Warp to successfully transpile and deploy every Solidity file from Uniswap v3.

Schellekens noted the significance of this feat given the sheer size of Uniswap’s codebase, allowing projects of all sizes to get onto StarkNet. 

“With Warp rapidly maturing, the barrier to entry for large and small projects alike to test out the capabilities of StarkNet is lowering.”

But Warp’s Solidity to Cairo translation hasn't been picture-perfect. Warp’s GitHub shows that there are still a number of Solidity functions that Nethermind developers haven’t figured out how to add to Cairo, while a few other key functions will either require “developer intervention” or will “likely never be supported” at all.

Related: StarkWare nets $100M as investors bank on layer-2 success

Nethermind said that they plan on advancing Warp’s features further to bring more Ethereum-based projects to StarkNet.

"We will continue working hard on features and repeat this experiment with a few other protocols, bringing new protocols to StarkNet at warp speed."

StarkWare, the company behind StarkNet, teamed up with Nethermind in Jul. 2021 to help build advanced features and infrastructure elements for StarkNet.

Nethermind and Warp are not affiliated with the decentralized exchange (DEX) Uniswap.

XRP jumps 25% as SEC may not pursue appeal after Gensler’s departure