Soroban contracts are small programs written in the Rust programming language.
To build and develop contracts you need only a couple prerequisites:
If you use macOS, Linux, or another Unix-like OS, the simplest method to install
a Rust toolchain is to install
rustup with the following
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
If you use Windows, or need an alternative method of installing Rust, check out: https://www.rust-lang.org/tools/install
Install the target
rustup target add wasm32-unknown-unknown
Configure an Editor
Many editors have support for Rust. Visit the following link to find out how to configure your editor: https://www.rust-lang.org/tools
A popular editor is Visual Studio Code:
- Visual Studio Code editor.
- Rust Analyzer for Rust language support.
- CodeLLDB for step-through-debugging.
Install the Soroban CLI
The Soroban CLI can execute Soroban contracts in the same environment the contract will execute on network, however in a local sandbox.
Install the Soroban CLI using
cargo install --locked --version 20.0.0-rc2 soroban-cli
Report issues and share feedback about the Soroban CLI here.
soroban command and you should see output like below.
Build, deploy, & interact with contracts; set identities to sign with; configure networks; generate keys; and more.
CLI Reference: https://github.com/stellar/soroban-tools/tree/main/docs/soroban-cli-full-docs.md
Usage: soroban [OPTIONS] <COMMAND>
completion Print shell completion code for the specified shell
contract Tools for smart contract developers
config Read and update config
events Watch the network for contract events
lab Experiment with early features and expert tools
version Print version information
--global Use global config
-f, --filter-logs <FILTER_LOGS> Filter logs output. To turn on "soroban_cli::log::footprint=debug" or off "=off". Can also use env var `RUST_LOG`
-q, --quiet Do not write logs to stderr including `INFO`
-v, --verbose Log DEBUG events
--very-verbose Log DEBUG and TRACE events [aliases: vv]
--list List installed plugins. E.g. `soroban-hello`
-h, --help Print help (see more with '--help')
-V, --version Print version
Protip: You can use
soroban completion to generate shell completion for
zsh. You should absolutely try it out. It will feel like a super power!!
To enable autocomplete in the current bash shell, run:
source <(soroban completion --shell bash)
To enable autocomplete permanently in future bash shells, run:
echo "source <(soroban completion --shell bash)" >> ~/.bashrc
Users of non-bash shells may need to adapt the above commands to suit their needs.