Developers

Soroban: The Smart Contract Platform Designed for Developers

Author

Stellar Development Foundation

Publishing date

Smart contracts

DeFi

Soroban

Tl;dr: Soroban, the Stellar smart contract platform, focuses on three critical pillars: Performance, Sustainability, Security. These factors are crucial for building scalable, efficient, and secure blockchain applications.

Three critical attributes form the "Holy Trinity" in smart contract platforms: performance, sustainability, and security. These three pillars informed the building of Soroban – the smart contract platform on Stellar – and the many design decisions made across the Stellar ecosystem to save time, money, and mental load when writing smart contracts.

Let's examine why these factors are crucial for any platform aiming for widespread adoption, how smart contracts on Stellar address each of them, and why they matter to builders.

Performace

SPEED MEETS SOPHISTICATION

Performance in blockchain isn't just about transactions per second (TPS). It's also the ability to handle complex, sophisticated smart contracts efficiently. And as we move towards more advanced use cases like roll-ups and zero-knowledge proofs, raw computational power becomes increasingly important.

With this in mind, Soroban needs to not only match the performance of today’s chain but also be built to account for future innovations. Below are some of the specific design decisions made to ensure that performance never suffers on Stellar.


Utilizes Rust and WebAssembly (Wasm) for superior performance

Soroban leverages Rust and WebAssembly (Wasm) to achieve superior performance. Rust's safety features and Wasm's simple, predictable instruction set provide a robust foundation for smart contract development. Unlike blockchain-specific languages like Solidity, Soroban benefits from the extensive ecosystem and ongoing improvements from the thousands of developers working on Rust and Wasm.

Implements conflict-free concurrency, ensuring efficient parallel transaction processing without conflicts.

One of Soroban's standout features is its implementation of conflict-free concurrency. Unlike the optimistic concurrency many blockchains use, Soroban is designed to ensure that transactions never conflict during execution. Conflict-free concurrency eliminates the need for developers to worry about parallel programming, and validators will avoid needing to retry or discard work due to conflicts. And it allows for true parallel execution, significantly increasing throughput without sacrificing consistency.

Introduces multi-dimensional fees to optimize block space usage.

Soroban also introduces multi-dimensional fees to optimize block space usage. This innovative approach allows for more efficient packing of transactions into blocks, potentially increasing TPS with better resource allocation without changing underlying hardware or increasing network costs. Soroban recognizes that computers can perform different types of work in parallel.

Key takeaway: Soroban's architecture enables building complex applications without worrying about performance bottlenecks.

Sustainability

FUTURE PROOF NETWORK

A truly sustainable platform maintains its performance as it scales without compromising cost-effectiveness. It's about more than just being fast today, but staying fast and affordable a decade from now.

Here are some of the design decisions made to ensure Stellar scales to meet builder expectations and user demand.

State archival solution to manage long-term data growth

Soroban's novel state archival solution addresses the challenge of an ever-growing blockchain state. It ensures the network can maintain performance even as data accumulates over time, a crucial factor for long-term viability. The focus can stay on building applications without worrying about how state growth might impact performance years down the line.

Ensuring Low, Stable Fees as Network Scales

Perhaps most importantly, Soroban benefits from the Stellar Consensus Protocol. Unlike Proof of Stake or Proof of Work, the Stellar Consensus Protocol’s Proof of Agreement is built on trust between validators, not monetary incentives. So unlike chains where validator incentives drive up fees, fees on Stellar – even as the network scales and adoption increases – are designed to remain low. For developers, this translates to a more predictable and stable fee structure and avoids the "fee spiral" we've seen happen in other blockchain ecosystems, where growing popularity can paradoxically make the network more expensive to use.

Key takeaway: Developers can confidently build on Soroban, knowing the platform is designed to scale cost-effectively.

Security

SECURING FINANCE’S FUTURE

Building new financial systems that will handle billions or even trillions of dollars in transactions is an awesome responsibility. A single vulnerability can lead to losses and erode user trust. This responsibility demands a platform that treats security as a core design principle.

Soroban aims to create an environment where writing secure smart contracts becomes the path of least resistance.

Rust, recognized as one of the most secure programming languages

Soroban's approach to security starts with its foundation in Rust, a language with:

  • Endorsements from cybersecurity experts
  • Strong memory safety guarantees, eliminating entire classes of vulnerabilities
  • Extensive tooling and compiler checks help catch potential issues early in the development process

No reentrancy, eliminating a significant attack vector

One of Soroban's key security features is its decision to not allow reentrancy. While reentrancy can be helpful in general programming, it can be dangerous in financial applications and has been responsible for some of the largest hacks in blockchain history.

  • Reentrancy attacks have been responsible for some of the largest hacks in blockchain history
  • While useful in general programming, reentrancy can be dangerous in financial applications
  • Soroban's design choice to disallow reentrancy significantly reduces the attack surface

Authorization-Required: Simplifying Security, Preventing Misuse

Soroban also implements an authorization-required framework that makes it easy to use in a secure fashion while also being hard to misuse. Unlike traditional smart contract platforms that often use broad, blanket authorizations, Soroban allows contracts to request specific, limited permissions. This granular approach significantly reduces the attack surface and protects users from potential exploits. Authorization can then be implemented with minimal code.

#[contracttype]
pub enum DataKey {
    Counter(Address),
}

#[contract]
pub struct IncrementContract;

#[contractimpl]
impl IncrementContract {
    /// Increment increments a counter for the user, and returns the value.
    pub fn increment(env: Env, user: Address, value: u32) -> u32 {
        // Requires `user` to have authorized call of the `increment` of this
        // contract with all the arguments passed to `increment`, i.e. `user`
        // and `value`. This will panic if auth fails for any reason.
        // When this is called, Soroban host performs the necessary
        // authentication, manages replay prevention and enforces the user's
        // authorization policies.
        // The contracts normally shouldn't worry about these details and just
        // write code in generic fashion using `Address` and `require_auth` (or
        // `require_auth_for_args`).
        user.require_auth();

        // This call is equilvalent to the above:
        // user.require_auth_for_args((&user, value).into_val(&env));

        // The following has less arguments but is equivalent in authorization
        // scope to the above calls (the user address doesn't have to be
        // included in args as it's guaranteed to be authenticated).
        // user.require_auth_for_args((value,).into_val(&env));

        // Construct a key for the data being stored. Use an enum to set the
        // contract up well for adding other types of data to be stored.
        let key = DataKey::Counter(user.clone());

        // Get the current count for the invoker.
        let mut count: u32 = env.storage().persistent().get(&key).unwrap_or_default();

        // Increment the count.
        count += value;

        // Save the count.
        env.storage().persistent().set(&key, &count);

        // Return the count to the caller.
        count
    }
}

This single line of code ensures that only the rightful owner can initiate a token transfer, dramatically simplifying the development of secure applications and reducing the chances of developer error.

  • Implements a more granular and specific authorization model compared to existing smart contract platforms
  • Allows contracts to request specific, limited permissions rather than blanket authorization
  • Helps protect users from potential exploits where malicious contracts could abuse broad permissions
  • Simplifies the development of secure applications with a single line of code, reducing the chances of developer error

Key takeaway: Soroban provides a foundation of security, allowing developers to focus on building features rather than constantly worrying about potential vulnerabilities.

The Holy Trinity

Bringing It All Together

While many blockchain platforms excel in one or two of these areas, Soroban aims to deliver on all three. This holistic approach does the heavy lifting for developers optimizing for performance, long-term sustainability, and security, giving developers a robust foundation to build with ease and confidence.

Check out the docs for yourself and join the discord to learn more.

Next Steps

Recommended Next Reads

Soroban Smart Contracts Overview

A developer-friendly, Rust-based smart contracts platform designed for scale and sensibility. Soroban seamlessly integrates with and works alongside…

Learn More

Article

Garand Tyson

Introducing State Archival: The Solution to State Bloat on Stellar

This article is part of a deep-dive series on the industry’s state bloat problem, which must be solved for blockchains to remain inexpensive, deliver…

View

Article

Garand Tyson

Scalability with State Archival on Stellar vs. Solana’s Avocado

A deep-dive on State Archival’s scalability features on the Stellar network and analyzes Solana’s less efficient version of State Archival called…

View

The Newsletters

THE EMAIL YOU ACTUALLY WANT TO READ

Hear it from us first. Sign up to get the real-time scoop on Stellar ecosystem news, functionalities, and resources.

By providing the contact information required in this form, you agree to be contacted by the Stellar Development Foundation (SDF) in order for us to inform you about our products and services. For more information on our privacy practices or how to unsubscribe, please refer to our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply