Product

Earn with DeFi

Support

Company

Starknet Cairo Upgrade: The One Crucial Change

Starknet's Quantum Leap upgrade could transform one of the slowest Layer 2 crypto rollups into the fastest, and it’s all because of a major modification to the engine.
Starknet
• Jul 12, 2023
4 min read
Starknet Cairo Upgrade: The One Crucial Change

The Starknet Cairo upgrade (v.0.12.), which went live today, has the potential to create one of the biggest speed gains ever seen in crypto. In fact, the increase is so drastic that crypto commentators have dubbed it ‘the Starknet Quantum Leap’.

Up to now, Starknet has been processing less than 2 transactions per second (TPS). That’s even slower than the Ethereum mainnet, even though Starknet’s core function is to relieve congestion on the overworked Layer 1 blockchain.

However, Starknet’s Cairo Upgrade may ultimately increase transaction throughput by 20x or more. And it’s all to do with the sequencer, the entry-point to the network’s validation engine.

By upgrading the sequencer, Starknet has removed a major bottleneck at the heart of its back-end and ensured users’ transactions get batched, proven and finalized more quickly.   

Why is the Starknet sequencer so crucial?

Like all Layer 2 zero-knowledge (validity) rollups, Starknet proves transactions in bulk (or ‘rolls them up’) and sends them to Layer 1 Ethereum, which verifies them and posts a record on-chain. So transactions get all the security of Layer 1 with the dynamic scalability of Layer 2.

 

Here’s how the proof system works on Starknet:

  • First, the sequencer arranges a bunch of transactions in the correct order. It processes them, produces a series of actions or state changes (for example, updating users’ balances) and then sends the transactions to the prover.
  • The prover, a program developed by StarkWare, checks each transaction to ensure it is valid, and produces a mathematical proof of the state change before and after the transaction. Then the prover sends a single record containing a proof for all transactions in the batch, known as a validity proof, back to Layer 1.
  • The Ethereum Layer 1 verifier, a smart contract, sets the prover a series of mathematical challenges to demonstrate it has followed the correct steps for each transaction. 

Here’s a diagram to illustrate the structure:

The sequencer is the heart of the Starkware machine and a major focus of the Quantum Leap upgrade.
Credit: StarkWare

Essentially, the Starknet sequencer performs a similar role to block proposers and validators on Layer 1 Ethereum. It processes the transactions, chains them together and then generates a block. In fact the sequencer is crucial for several reasons:

  1. It ensures that every transaction is executed in a manner consistent with Starknet’s current state.
  2. It prevents double-spending, whereby a user can spend their asset twice.
  3. It ensures the prover can process transactions in the correct order, with minimal inefficiency.

But what’s been the problem with the Starknet sequencer?

Starknet wrote its original sequencer in Python, a programming language which long precedes the emergence of blockchains. Python went live in 1991, a full 18 years before Bitcoin, and is not a production-grade language for high-performance systems. So the Starknet sequencer has been unable to handle transactions at sufficient speed, creating bottlenecks before they get to the prover.

Over the past few months, Starknet devs have been working on a brand-new sequencer, built in the quick and flexible Rust language rather than Python.

Rust vs Python: Why Starknet has changed language with the Cairo Upgrade

As a scripting language, Python avoids the compilation step when converted into computer-readable bytecode. However, this means code has to be interpreted instead, which can create a drag, compounded by the fact that Python uses dynamic types. So the language isn’t particularly fast when performing certain cryptography functions, particularly encoding and decoding.

Rust, on the other hand, compiles automatically, and it has no garbage collector feature (which can be a serious drain when using Python and other languages). This means it’s extremely fast, and ideal for blockchain development. In fact it’s already the bedrock of several blockchains including Solana and Polkadot.

These speed gains will be magnified by a new and optimized:

  1. Blockifier, the transaction-executing component of the sequencer which creates state diffs and blocks.
  2. Cairo Virtual Machine, which enables contracts written in Cairo to be executed on the Starknet network.
  3. Local state management system, using Papyrus, which harnesses the power of a local database and a simple key/value storage structure.

All of them written in Rust.

As StarkWare notes in its own Medium post on the Cairo Upgrade, the original Python-based sequencer was an adaptation of the infrastructure used to build StarkEx, a SaaS product designed to work with specific-use projects, such as crypto exchanges and NFT marketplace applications. The new Rust-based sequencer, in contrast, is “built especially for the requirements of a decentralized, highly performant network.”

Are there any other changes that will affect the Starknet Cairo Upgrade?

Actually, the sequencer upgrade is part of a whole bunch of changes, some still to come. These include reducing the amount of time drained by invalid transactions and enabling the Starknet network to run more efficiently. 

But don’t worry, we’ll cover these in subsequent posts. In the current round of upgrades (Starknet v.012.0), the switch to Rust, combined with gains such as the new Blockifier, Cairo VM and local state management, is the key development you need to know about. 

Here is a brief overview of the Starknet roadmap for 2024:

Starknet Roadmap 2024

You won’t be able to see it on the front-end, but you’ll definitely feel it.

Is there a token for Starknet?

Yes, there is. You can find all the information about the Starknet token in this article, including its tokenomics and how to purchase STRK.

Want to experience the benefits of the Quantum Leap for yourself?

Starknet’s Cairo Upgrade will allow you to make trades, enter and exit yield positions and mint NFTs more quickly.

To sample the benefits for yourself, try running some sample transactions on Goerli, the Starknet testnet, using our own wallet, Braavos. Goerli replicates Starknet’s real-life conditions, but the tokens have no real-world value. So you can explore the ecosystem’s possibilities in a Sandbox environment, with no risk or financial commitment.

Here’s how to do this:

  1. Download Braavos if you haven’t already (it’s a software wallet so will download as an extension on your preferred browser, or mobile OS).
  2. Go and get some Goerli tokens. We recommend getting them from the Starknet faucet.
  3. Try some different transactions inside the Braavos wallet. You could try:
    1. Swapping some tokens inside the wallet.
    2. Creating a domain name.
    3. Going to the gallery of dApps and interacting with a specific protocol.

And if you have any questions about Quantum Leap, Starknet or anything else, reach out to us on Twitter and we’ll be happy to help.

Motty Lavie

Motty Lavie

Be The First To Know

Subscribe now and receive monthly updates and interesting news about Braavos and Starknet ecosystem.