> ## Documentation Index
> Fetch the complete documentation index at: https://docs.theblockchainlibrary.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Soroban Hello World

> A minimal smart contract for Stellar's Soroban platform written in Rust.

# Soroban Hello World

A minimal smart contract for Stellar's Soroban platform written in Rust.

A minimal smart contract for Stellar's Soroban platform written in Rust.

## Explanation

Soroban is Stellar's smart contract platform. Contracts use no\_std Rust and the soroban\_sdk crate. Storage is accessed through env.storage(). The #\[contract] and #\[contractimpl] macros define the contract interface.

## Code

```rust theme={null}
#![no_std]
use soroban_sdk::{contract, contractimpl, symbol_short, Env, Symbol};

const COUNTER: Symbol = symbol_short!("COUNTER");

#[contract]
pub struct HelloContract;

#[contractimpl]
impl HelloContract {
    pub fn increment(env: Env) -> i32 {
        let mut count: i32 = env.storage().instance().get(&COUNTER).unwrap_or(0);
        count += 1;
        env.storage().instance().set(&COUNTER, &count);
        count
    }
}
```

***

**Canonical knowledge ID:** `code-example:soroban-hello-world`
