Prerequisites
Before you begin, make sure you have:- Erst installed and available in your PATH
- A transaction hash from a failed Soroban transaction
- Access to a Stellar RPC endpoint (default: public testnet)
If you don’t have a failed transaction handy, you can use one from testnet for this tutorial.
Basic debugging workflow
Debug a transaction
The simplest way to debug a transaction is to provide its hash:For example, on testnet:This command will:
- Fetch the transaction envelope from the Stellar network
- Retrieve the ledger state at the time of execution
- Simulate the transaction locally
- Display detailed error traces and diagnostic events
The
--network flag defaults to testnet. Use --network mainnet for mainnet transactions.Explore with interactive mode
For complex transactions, use the interactive trace viewer:Or use the shorthand:The interactive mode provides:
- Search functionality - Press
/to search through traces - Tree navigation - Expand/collapse nodes with arrow keys
- Syntax highlighting - Color-coded contract IDs, functions, and errors
- Fast navigation - Jump between search matches with
n/N - Help overlay - Press
?orhfor keyboard shortcuts
Analyze the results
Erst displays:
- Transaction execution trace
- Contract invocation hierarchy
- Error messages with context
- Resource consumption metrics
- Diagnostic events from the VM
- Red-highlighted errors in the trace
- Contract IDs where failures occurred
- Function names in the call stack
- Error codes and messages
Common debugging scenarios
- Network transactions
- Offline analysis
- Local WASM testing
Debug a transaction from testnet or mainnet:The transaction data is automatically cached for offline analysis.
Performance profiling
Generate interactive flamegraphs to visualize where your contract spends time and memory:<tx-hash>.flamegraph.html) with:
- Hover tooltips showing function details
- Click-to-zoom for focusing on specific call stacks
- Search/highlight to find frames by name
- Dark mode support
- HTML format
- SVG format
Managing sessions
Save debugging sessions to resume work later or share with your team:List sessions
View all saved sessions:This displays session IDs, transaction hashes, timestamps, and status.
Cache management
Erst caches transaction data to improve performance and enable offline analysis.~/.erst/cache
The cache uses an LRU (Least Recently Used) strategy to manage disk space automatically.
Advanced options
Override ledger timestamp
Test how your contract behaves at different points in time:Time window simulation
Run simulations across a time range:Getting help
erst doctor command diagnoses common configuration issues and provides recommendations.
Example workflow
Here’s a complete workflow for debugging a failed transaction:Troubleshooting
Transaction not found
If Erst can’t find your transaction:- Verify the transaction hash is correct
- Check you’re using the right network (
--network testnetor--network mainnet) - Ensure the RPC endpoint is accessible
- Try a custom RPC with
--rpc <url>
Simulation errors
If simulation fails:- Run diagnostics:
erst doctor - Check Rust simulator is built:
cd simulator && cargo build --release - Clear cache and retry:
erst cache clear --force - Enable verbose output:
erst debug <tx-hash> --verbose
Network timeouts
If you experience network timeouts:- Use a faster RPC endpoint with
--rpc - Check your internet connection
- Try again later (RPC may be temporarily unavailable)
Next steps
Now that you’ve debugged your first transaction, explore:Interactive trace viewer
Learn advanced trace navigation techniques
Performance profiling
Optimize contract performance with flamegraphs
Session management
Advanced session workflows and team collaboration
Contributing
Help improve Erst on GitHub