Starknet Quantum Leap: Major Throughput Improvements are Here!
Published on: July 5, 2023

Starknet Quantum Leap: Major Throughput Improvements are Here!

Starknet is about to break through the TPS barrier

TL;DR

  • Starknet alpha V0.12.0 is deployed on testnet
  • Starknet achieved a remarkable 10x increase in throughput by implementing the Sequencer in Rust. This was driven by a close collaboration between StarkWare and LambdaClass
  • A smoother user experience will be provided as the `PENDING` status for transactions has been removed
  • A new syscall has been introduced, allowing easy retrieval of past block hashes
  • Starknet alpha V0.12.0 will support a new Cairo syntax that focuses on safety
  • The network upgrade to this version will undergo a community vote, ensuring widespread participation and input

Introduction

We are excited to announce the release of Starknet Alpha V0.12.0. This version is a significant milestone which will mark the beginning of a major leap forward in providing enhanced performance and scalability. This version is another step in Starknet’s journey to scale Ethereum, with a focus on addressing throughput and latency. To tackle these challenges, we targeted Starknet’s Sequencer, as much of the limit to throughput is determined by its performance.
The development of Starknet Alpha V0.12.0 is largely the result of a productive and enjoyable year-long collaboration between LambdaClass and StarkWare. We are proud to build Starknet with the LambdaClass team.

This version, being a major one, will be up for a community vote. We invite the community to participate in shaping the future of Starknet.

Performance – Throughput is Here!

This version focuses on performance, and specifically on improved throughput, resulting in a significant 10X increase. The throughput has surged from an average of 30K Cairo steps per second (CSPS) on v0.11.0, to an impressive 220K CSPS in this latest version. This remarkable achievement results from targeted optimizations that underpin the efficiency of the Starknet Sequencer, as previously shared in our performance roadmap. Three key ingredients have contributed to this improvement in Starknet’s performance: Cairo-rs, Blockifier, and Papyrus, and they all benefit from the power of Rust.

The first improvement to the Sequencer is the integration of Cairo-rs, a highly efficient Cairo runner written in Rust and developed by LambdaClass. By leveraging the power of Rust, Cairo-rs has enhanced the execution of Cairo contracts, resulting in a more streamlined experience for users.

Additionally, the introduction of the Blockifier, a Rust-based block execution logic, has played a crucial role in improving throughput. By optimizing transaction execution time this implementation has effectively reduced wait times and alleviated network congestion, The inclusion of Papyrus, a local storage solution, has contributed to the efficient management of the Sequencer’s local state. This enhancement has further optimized the overall system performance and responsiveness.

This is Merely the First Step

The Sequencer optimizations in this version are far from the end of the road to performance improvements.

cairo_native

Starknet will integrate LambdaClass’s cairo_native compiler, which will enable the execution of Cairo contracts in a more efficient manner. By allowing contracts to run in “native code” such as Rust, rather than executing within the Cairo environment, we anticipate even greater efficiency and performance gains for Starknet.

Parallelization

Starknet’s previous Pythonic Sequencer introduced the parallelization of transactions, which significantly improved its performance. However, it’s important to note that the Sequencer initial implementation in Rust, included in the V0.12.0 release, does not yet include parallelization. The ongoing development efforts are focused on parallelizing transaction execution within the block, in the spirit of block-STM. Drawing from the successful demonstrations in the Pythonic implementation, this optimization will further enhance the throughput of Starknet, enabling it to efficiently handle increased transaction volumes.

No More Pending Transactions

In previous versions, the `PENDING` status denoted valid blocks that were executed by the Sequencer but were not yet full, indicating additional transactions could still be added. However, in this latest release, the `PENDING` status has been replaced with ACCEPTED_ON_L2, reflecting the finality status of transactions. This change simplifies the transaction confirmation process and provides users with a smoother experience. 

get_block_hash Syscall

Another addition in Starknet Alpha V0.12.0 is the introduction of the `get_block_hash` syscall. This new system call allows developers to retrieve the hash of a specific Starknet block within the range of `[first_v0_12_0_block, current_block-10]`. The signature of this syscall is `fn get_block_hash(u64 block_number) -> felt252`.

The error message associated with this scenario is: `Block number out of range.`

To implement this change, the operating system will write, at the beginning of every block, a mapping under `address = 0x1` with `current_block – 10` as the key and its corresponding hash as the value.

With the `get_block_hash` syscall, developers can conveniently retrieve block hashes, which are essential components for constructing and validating storage proofs. These proofs enable efficient cross-chain data access and enhance the trustworthiness of blockchain data even without the need for reliance on third-party oracles. By obtaining the block hash through this syscall, developers can accurately reference a specific block’s state, transactions or any other information committed in the block header

Cairo – Improved Contract Syntax

In this version, we’re introducing significant improvements to the smart contract syntax. The new syntax focuses on safety and lays the foundations for extensibility. Safety in this context means being more explicit on the external-facing components of the contract (interface/storage/events), which gives developers a better idea of what to expect when interacting with the contract. Extensibility, which will be finalized in a later version, allows contracts to use components from external libraries. This is a key feature of any smart contract language and will address a significant issue in the Starknet dev community. For an exhaustive treatment of the motivation and changes, see the Cairo Roadmap blog post and the community forum post.

While the new compiler version includes breaking changes, you can keep using the older compiler version (v1.1.0) and deploy the resulting contracts on Starknet for the next six months. This reflects our new compiler upgrade protocol for breaking changes: following new compiler versions, contracts compiled by the old compiler version will continue to be accepted for at least six months, in order to allow the community to adjust. Of course, once a Cairo contract (not Cairo 0) is declared on Starknet, it will remain available for deployment and interaction indefinitely.

What’s next?

Short-Term Goals: Version 0.12.1

In the short term, Starknet is focused on enhancing user experience and transaction reliability. The next version, 0.12.1, will introduce another significant improvement: the inclusion of failed transactions in the block. Up until now, failed transactions were not included in the block, and thus the Sequencer could not charge a fee and advance the nonce for them. This created UX problems for developers. They could not rely on the nonce advancing, forcing them to continuously monitor transaction status before sending a new one. This change also protects the Sequencer from users spamming the system with failed transactions without paying for them. This update aims to provide users with a smoother and more seamless experience when interacting with Starknet.

Long-Term Vision: Throughput, Latency, and Costs

Looking ahead, Starknet’s overarching vision is to achieve substantial scalability both in scale and cost. The next priority on the agenda is to reduce transaction costs dramatically.

By driving down costs, Starknet aims to make transactions more affordable and inclusive, thereby enabling a broader range of use cases and empowering developers and users. The commitment to cost reduction aligns with Starknet’s mission to provide a scalable, flexible, and cost-effective infrastructure for decentralized applications.

Starknet Alpha V0.12.0 Vote

Starknet Governance Phase 1 focuses on major Starknet protocol upgrades.
Every major Starknet version upgrade is first deployed on Testnet, giving the Starknet community a few days to examine and test the upgraded version. During this examination period, a Snapshot proposal is opened, allowing the community to vote on whether to approve the upgraded version for Mainnet deployment.

If the proposal gains a majority of ‘YES’ votes during the voting period, it passes, and Starknet Mainnet will be upgraded accordingly.

The Starknet Alpha V0.12.0 vote is now live!
Everyone is invited to sign up for the notification service on Starknet’s Snapshot space. Check out the Delegate Profile Thread & the Delegation discovery to either become a delegate or select one, and discuss Starknet alpha v0.12.0 proposal on the  Community forum.

Summary

Starknet Alpha V0.12.0 focuses on enhancing performance and user experience. The new version introduces a Rust-based implementation of the Sequencer, improving throughput by 10X and reducing transaction latency. Other features include a new compiler version, removal of the pending transaction status, and the addition of a block hash syscall. 

Starknet developers are empowered to code solutions that make a difference. Start your Cairo development journey, read the Cairo docs, register for Cairo Basecamp, or go through the tutorials. Want to stay up to date with all version updates? Sign up for our Starknet Developers Newsletter.

 

 

 


About LambdaClass

LambdaClass is an engineering-centered company with 10 years in the industry working in distributed systems, compilers, ML and cybersecurity. Throughout their history, they’ve supported projects that offer technical challenges and that make a difference in the world, choosing projects and partners mainly on the basis of shared goals and approaches with their creators or founders

ON THIS PAGE

Contact us