> Developers Blog

Soroban: Preview Release #2

Today, we're excited to share the second preview release of Soroban™. Soroban is a new smart contracts platform designed for scalability and sensibility. We shared the first preview release last month. Since then, we've heard a ton of great feedback from developers experimenting with writing smart contracts. This has helped us to continue to refine the platform and add new features to extend its functionality. This is still an early version of the platform, and future updates may shift things around and break code you write today. As you'll see by looking at the list of changes below, we've made significant progress, and we're eager to hear what you think.

Here's what's new in this preview release:

Built-in Contracts

To make things easier for developers, Soroban will support a small number of built-in contracts designed to be fast, cheap to run, and provide useful core functionality. This release implements the machinery for deploying them, and includes an initial pass at the first built-in contract, the standard token contract. It's still in early development, but you can find details about its current state in the docs

Metering

This release expands metering to cover most of the contract environment’s functionality, in the form of inputs to abstract cost-models. This release also improves the code used to calibrate cost-models to true CPU costs. Currently the cost-models are not calibrated, nor are they subject to any limits. In the future, the cost-models will be fully calibrated and when run on production networks, subject to limits and fees. The measured cost-model inputs can be observed when running a contract via the CLI by passing the {% code-line %}--cost{% code-line-end %} option. 

Auth SDK (soroban-auth)

A new SDK included in the release contains functionality that most contracts will need to verify invocations to their contracts are signed by the appropriate signers. Contracts on Soroban can implement the authentication scheme they prefer, but this SDK will provide a default option that is compatible with Stellar accounts, Ed25519 signatures, and cross-contract calls. This SDK is under heavy revision, so expect improvements in the next preview release. Read more in the docs or take a look at an example

SDK Updates (soroban-sdk v0.0.4)

The soroban-sdk now has an improved user experience and some new functionality. Specifically, it includes:

  • The {% code-line %}contractimport!{% code-line-end %} macro, which imports a contract from its wasm file into another contract. Contracts can use this to integration test other contracts, import their types, and deploy them in factory contracts. The code generated by the macro is the same as that generated by the {% code-line %}soroban-cli gen{% code-line-end %} command. For example: {% code-line %}contractimport!(file = "contract.wasm"){% code-line-end %};
  • A generated client interface for contracts to use in tests. Find examples in the docs: {% code-line %}HelloClient::new(env, contract_id).hello(...){% code-line-end %}
  • Functions to emit events: {% code-line %} env.events().publish(topics, data) {% code-line-end %}
  • Functions for factory contracts to deploy contracts: {% code-line %} env.deployer().from_current_contract(salt).deploy(wasm) {% code-line-end %}
  • Functions for getting ledger number and timestamps. For example:
    {% code-line %}env.ledger().sequence()
    env.ledger().timestamp() {% code-line-end %}
  • The {% code-line %}bigint! macro{% code-line-end %} for creating BigInts from Ethereum u256 style hex values. Thanks to @heytdep for the contribution that led to this feature. For example: {% code-line %}bigint!(&env, 0xfded3f55dec47250a52a8c0bb7038e72fa6ffaae33562f77cd2b629ef7fd424d){% code-line-end %}
  • The {% code-line %}symbol! macro{% code-line-end %} for creating Symbols at compile time. For example: {% code-line %}symbol!("a_str"){% code-line-end %}
  • It also renames {% code-line %}Binary{% code-line-end %} to {% code-line %}Bytes{% code-line-end %}.

CLI Updates (soroban-cli v0.0.4)

The soroban-cli also gained some user experience improvements, and several new commands. Specifically:

  • The {% code-line %}soroban-cli serve{% code-line-end %} command was added. It runs a local RPC API server for web app development and testing. Currently it supports simulating, preflighting, and sending transactions.
  • The {% code-line %}soroban-cli read{% code-line-end %} command was added. It retrieves data stored by contracts. This lets you inspect the current state of your contract while developing.
  • The {% code-line %}soroban-cli gen{% code-line-end %} command was added. It generates code client-bindings for a contract. So far only Rust clients are supported and the output generated is the same as the contractimport! macro available in the SDK. JSON output is also supported which any other tool could translate.
  • The {% code-line %}soroban-cli completion{% code-line-end %} command was added. It provides shell auto-completion in your shell. This command was contributed by Stellar community member @fdesjardins.

Next Steps

The more we hear from you, the better. Over the next few months, as we work to shape Soroban into a batteries-included smart contracts platform that is sensible, developer-friendly, and built-to-scale, we could use your input. So whether you're a grizzled Soroban veteran or just getting started, head over to the docs. These resources are updated to match this new release, where you'll find detailed information about the nuts and bolts of Soroban, along with a getting started guide, tutorials, and examples. 

If you've played around a bit and you're ready to join the conversation about continued development, head to the Soroban channels on the Stellar Dev Discord, where SDF and ecosystem engineers are working in the open, together, to build the future of smart contracts.

Subscribe to developer updates

Thank you for subscribing! Please check your inbox to confirm your email address.

There was an error. Please try again.

More articles

News and insights for developers