Blog Article
Author
The Soroban Team
Publishing date
Soroban
Preview release
Smart contracts
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:
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.
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 --cost
option.
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.
The soroban-sdk now has an improved user experience and some new functionality. Specifically, it includes:
contractimport!
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 soroban-cli gen
command. For example: contractimport!(file = "contract.wasm")
;HelloClient::new(env, contract_id).hello(...)
env.events().publish(topics, data)
env.deployer().from_current_contract(salt).deploy(wasm)
env.ledger().sequence()
env.ledger().timestamp()
bigint! macro
for creating BigInts from Ethereum u256 style hex values. Thanks to @heytdep for the contribution that led to this feature. For example: bigint!(&env, 0xfded3f55dec47250a52a8c0bb7038e72fa6ffaae33562f77cd2b629ef7fd424d)
symbol! macro
for creating Symbols at compile time. For example: symbol!("a_str")
Binary
to Bytes
.The soroban-cli also gained some user experience improvements, and several new commands. Specifically:
soroban-cli serve
command was added. It runs a local RPC API server for web app development and testing. Currently it supports simulating, preflighting, and sending transactions.soroban-cli read
command was added. It retrieves data stored by contracts. This lets you inspect the current state of your contract while developing.soroban-cli gen
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.soroban-cli completion
command was added. It provides shell auto-completion in your shell. This command was contributed by Stellar community member @fdesjardins.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.