Skip to content
Soroban DevKit

Examples

Run sdkt against real fixtures.

Every example below uses artifacts that ship in this repository. Commands are copy-pasteable; outputs are from real runs.

Fixtures used: us_old.wasm (198 B, transfer + mint), us_new.wasm (530 B, hello + increment), examples/sample_token/src/lib.rs.

Inspect a contract WASM

Inspectionbeginner

Read the compiled artifact: size, SHA-256, custom sections, exports, and the contract spec. No network, no account.

wasm inspect — us_old.wasm
$ sdkt wasm inspect us_old.wasm
Size: 198 bytes
SHA-256: 05befa136e7f0829a5051d97b032f355a…
Functions: 2
  - fn transfer(1) -> 0
  - fn mint(1) -> 0
Events: 1

Audit contract source

securitybeginner

Static analysis of Soroban Rust source. The repo ships a contract with one deliberately unguarded entrypoint so the analyzer produces a deterministic finding.

audit — sample_token
$ sdkt audit examples/sample_token/src/lib.rs
Severity: 1 critical, 0 warning, 0 info

  [critical] AUTH-001  [SampleToken::admin_action]
  Function `SampleToken::admin_action` looks privileged
  but does not call require_auth()

Diff an upgrade

upgrade safetybeginner

Compare two WASM artifacts and get a breaking-change verdict before you deploy. The repo ships an old and a new fixture pair.

diff — us_old → us_new
$ sdkt diff --old-wasm us_old.wasm --new-wasm us_new.wasm --upgrade-safety
Compatible: NO

Breaking:
  - Removed function: mint()
  - Removed function: transfer()
  - Removed event: Transfer
  - Removed type: Point

Non-breaking:
  - Added function: hello()
  - Added function: increment()

Run a fuzz campaign

fuzzingintermediatemain only

Declare an expectation, run the campaign, then replay the recorded artifact. Both commands are on main — build from source.

fuzz campaign + replay
$ sdkt fuzz campaign us_new.wasm --seed 42 --cases 4 \
    --expect-error hello:Auth:6 --artifact-dir ./artifacts
executed=4 passed=2 expected_errors=0 findings=2 skipped=0
FINDING case0000 hello RETURN_MISMATCH (minimized_complexity=10)
evidence: completed=true findings=2 minimized=2 deterministic=true

$ sdkt fuzz replay ./artifacts/finding-case0000-return_mismatch.json \
    --wasm us_new.wasm
REPRODUCED reason=RETURN_MISMATCH

A finding is evidence of a declaration mismatch, not a vulnerability claim. The --expect-error hello:Auth:6 flag declares that hello must fail with auth error code 6; the campaign reports a RETURN_MISMATCH because the observed result differs from that declaration. Pilot totals (45/45, 12/12, 11/11 REPRODUCED) come from three specific external contracts, not a universal guarantee — see fuzz-real-contract-evidence.md.

In the repository

Files that back the docs.

These ship in the repo and back the offline smoke test (scripts/smoke_examples.sh).

sample_token/src/lib.rs

audit

A minimal Soroban contract. transfer is correctly guarded; admin_action is deliberately unguarded so sdkt audit produces a deterministic AUTH-001 finding. Analyzed as Rust source only — it does not need to be compiled.

examples/sample_token/src/lib.rs

sample_scval.b64

decode

A single valid base64-encoded ScVal ({"bool": false}) for demonstrating sdkt decode --type ScVal without needing a network.

decode — sample_scval.b64
$ sdkt decode "$(cat examples/sample_scval.b64)" --type ScVal
{
  "bool": false
}

More examples live in the repository.

The testnet walkthrough (identity → fund → deploy → invoke → events), CI/CD integration, and the compatibility matrix are all documented in docs/.