sidebar_position | title |
---|---|
1 |
Setup |
Soroban contracts are small programs written in the Rust programming language.
To build and develop contracts you need only a couple prerequisites:
- A Rust toolchain
- An editor that supports Rust
- Soroban CLI
If you use macOS, Linux, or another Unix-like OS, the simplest method to install
a Rust toolchain is to install rustup
. Install rustup
with the following
command.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
And install the wasm32-unknown-unknown
target.
rustup target add wasm32-unknown-unknown
If you use Windows, or need an alternative method of installing Rust, check out:
https://www.rust-lang.org/tools/install
Many editors have support for Rust. Visit the following link to find out how to
configure your editor:
https://www.rust-lang.org/tools
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
.
cargo install --locked --version 0.0.4 soroban-cli
:::caution
The soroban-cli
is in early development. Report issues
here.
:::
Run the soroban-cli
command and you should see output like below.
soroban-cli
❯ soroban-cli
soroban-cli 0.0.4
https://soroban.stellar.org
USAGE:
soroban-cli <SUBCOMMAND>
OPTIONS:
-h, --help Print help information
SUBCOMMANDS:
invoke Invoke a contract function in a WASM file
inspect Inspect a WASM file listing contract functions, meta, etc
read Print the current value of a contract-data ledger entry
serve Run a local webserver for web app development and testing
deploy Deploy a WASM file as a contract
gen Generate code client bindings for a contract
version Print version information
completion Print shell completion code for the specified shell