getting started
Quickstart
Deploy a counter contract to testnet and call it, start to finish in about a minute.
This walks you from a blank IDE to a deployed contract you can call. It uses the built-in Counter template, so there's nothing to paste.
Sign in
Open the IDE and sign in with Google, GitHub, or Discord. Your testnet
wallet is created and funded automatically, check the wallet widget in the top
bar to see its G… address and XLM balance.
Create a project from the Counter template
Open the project menu, choose New project, and pick the Counter template. You get a single-file crate:
#![no_std]
use soroban_sdk::{contract, contractimpl, symbol_short, Env};
#[contract]
pub struct CounterContract;
#[contractimpl]
impl CounterContract {
pub fn increment(env: Env) -> i32 {
let key = symbol_short!("counter");
let current: i32 = env.storage().instance().get(&key).unwrap_or(0);
let new_value = current + 1;
env.storage().instance().set(&key, &new_value);
new_value
}
pub fn get(env: Env) -> i32 {
let key = symbol_short!("counter");
env.storage().instance().get(&key).unwrap_or(0)
}
}Deploy
Click Deploy. WebSoroban compiles the crate to Wasm, then uploads and instantiates it, signing the transaction with your wallet. When it finishes, the console prints the contract id:
Compiled. WASM ready.
Deploying to Stellar testnet…
Contract deployed · CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSCThe deploy is signed by your testnet wallet and recorded on the project. You don't pick a network, it's always testnet.
Invoke `increment` (a signed write)
Open the Invoke panel (the contract console on the right). Select
increment. It takes no arguments. Because it changes state, it's a write: click
Invoke & sign. The return value is the new count:
1Invoke `get` (a read)
Select get and click Run (simulate). Reads don't sign or submit anything,
they simulate and return immediately:
1Run increment again and get returns 2. That's the full loop.
No local setup
You never installed Rust, the wasm32 target, or the Stellar CLI. Compilation
and signing happen on the server; your wallet's secret key never reaches the
browser.
What just happened#
- Compile turned
src/lib.rsinto awasm32v1-nonebinary. See Compile. - Deploy uploaded that Wasm and created a contract instance with a
C…id, signed by your wallet. See Deploy. - Invoke ran
incrementas a signed transaction andgetas a read-only simulation. See Invoke for how every argument type is entered.
Next#
- Add a second file and learn module resolution in The IDE.
- Understand the wallet, projects, and each action in Core concepts.
