A command-line debugger for Soroban smart contracts on the Stellar network. Debug your contracts interactively with breakpoints, step-through execution, state inspection, and budget tracking.
- Step-through execution of Soroban contracts
- Set breakpoints at function boundaries
- Inspect contract storage and state
- Track resource usage (CPU and memory budget)
- View call stacks for contract invocations
- Interactive terminal UI for debugging sessions
- Support for cross-contract calls
git clone https://github.com/Timi16/soroban-debugger.git
cd soroban-debugger
cargo install --path .cargo install soroban-debuggerDebug a contract by specifying the WASM file and function to execute:
# Array arguments
soroban-debug run --contract token.wasm --function transfer --args '["Alice", "Bob", 100]'
# Map argument (JSON object)
soroban-debug run --contract token.wasm --function update --args '{"user":"Alice","balance":1000}'Start an interactive debugging session:
soroban-debug interactive --contract my_contract.wasmThen use commands like:
sorstep- Execute next instructioncorcontinue- Run until next breakpointiorinspect- Show current statestorage- Display contract storagebudget- Show resource usageqorquit- Exit debugger
Execute a contract function with the debugger:
soroban-debug run [OPTIONS]
Options:
-c, --contract <FILE> Path to the contract WASM file
-f, --function <NAME> Function name to execute
-a, --args <JSON> Function arguments as JSON array
-s, --storage <JSON> Initial storage state as JSON
-b, --breakpoint <NAME> Set breakpoint at function nameStart an interactive debugging session:
soroban-debug interactive [OPTIONS]
Options:
-c, --contract <FILE> Path to the contract WASM fileView contract information without executing:
soroban-debug inspect [OPTIONS]
Options:
-c, --contract <FILE> Path to the contract WASM filesoroban-debug run \
--contract token.wasm \
--function transfer \
--args '["user1", "user2", 100]'Pass JSON objects as Map arguments:
# Flat map argument
soroban-debug run \
--contract token.wasm \
--function update_user \
--args '{"user":"ABC","balance":1000}'
# Nested map argument
soroban-debug run \
--contract token.wasm \
--function update_user \
--args '{"user":"ABC","balance":1000,"metadata":{"verified":true,"level":"premium"}}'
# Mixed-type values in map
soroban-debug run \
--contract dao.wasm \
--function create_proposal \
--args '{"title":"Proposal 1","votes":42,"active":true,"tags":["important","urgent"]}'Output:
> Debugger started
> Paused at: transfer
> Args: from=user1, to=user2, amount=100
(debug) s
> Executing: get_balance(user1)
> Storage: balances[user1] = 500
(debug) s
> Executing: set_balance(user1, 400)
(debug) storage
Storage:
balances[user1] = 400
balances[user2] = 100
(debug) c
> Execution completed
> Result: Ok(())
soroban-debug run \
--contract dao.wasm \
--function execute \
--breakpoint verify_signature \
--breakpoint update_statesoroban-debug run \
--contract token.wasm \
--function mint \
--storage '{"balances": {"Alice": 1000}, "total_supply": 5000}'soroban-debug run --contract complex.wasm --function expensive_operation
> Budget: CPU 45000/100000 (45%), Memory 15KB/40KB (37%)
> Warning: High CPU usage detectedDuring an interactive debugging session, you can use:
Commands:
s, step Execute next instruction
c, continue Run until breakpoint or completion
n, next Step over function calls
i, inspect Show current execution state
storage Display all storage entries
stack Show call stack
budget Show resource usage (CPU/memory)
args Display function arguments
break <function> Set breakpoint at function
list-breaks List all breakpoints
clear <function> Remove breakpoint
help Show this help message
q, quit Exit debugger
When your contract transaction fails without clear error messages, use the debugger to step through execution and identify where and why it fails.
Verify that your contract is reading and writing storage correctly by inspecting storage state at each step.
Identify which operations consume the most CPU or memory to optimize your contract's resource usage.
Debug interactions between multiple contracts by following the call stack through contract boundaries.
Quickly test different input scenarios interactively without redeploying your contract.
git clone https://github.com/Timi16/soroban-debugger.git
cd soroban-debugger
cargo build --releasecargo testcargo run --example simple_token- Rust 1.75 or later
- Soroban SDK 22.0.0 or later
Contributions are welcome! Please feel free to submit issues and pull requests.
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
cargo test - Submit a pull request
This project follows standard Rust formatting:
cargo fmt
cargo clippyLicensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
- Soroban Documentation: https://soroban.stellar.org/docs
- Stellar Developer Discord: https://discord.gg/stellardev
- Issue Tracker: https://github.com/Timi16/soroban-debugger/issues
- CHANGELOG - Release history and changes
Built for the Stellar ecosystem to improve the Soroban smart contract development experience.
docker build -t soroban-debugger:local .docker run --rm -v "$(pwd):/contracts" ghcr.io/your-org/soroban-debug run --contract /contracts/token.wasm --function transferdocker run --rm -it -v "$(pwd):/contracts" ghcr.io/your-org/soroban-debug interactive --contract /contracts/token.wasmdocker compose run --rm soroban-debug run --contract /contracts/token.wasm --function transfer