Overview
A debugging session stores:- Complete transaction data (envelope, metadata)
- Simulation results (events, logs, traces)
- Analysis context (network, timestamps)
- Session metadata (creation time, access history)
- Resume debugging work after interruption
- Share debugging context with team members
- Build a searchable history of investigated transactions
- Analyze patterns across multiple debugging sessions
Quick start
Session commands
Save current session
Save the active debugging session to disk:You must run
erst debug <tx-hash> first to create an active session.Custom session ID
Specify a memorable ID instead of auto-generated:abc123-20260301143022
List all sessions
View all saved sessions, ordered by most recently accessed:Resume a session
Restore a previously saved session:- Full session ID:
abc123-20260301143022 - Partial ID prefix:
abc123 - Transaction hash:
abc123def456... - Fuzzy match: Closest matching ID
Resuming a session loads all transaction data and simulation results, allowing you to continue analysis without re-fetching from the network.
Delete a session
Remove a saved session permanently:Session storage
Location
Sessions are stored in a local SQLite database:Schema
Each session record contains:| Field | Type | Description |
|---|---|---|
id | string | Unique session identifier |
tx_hash | string | Transaction hash |
network | string | Network name (mainnet, testnet) |
envelope_xdr | string | Base64-encoded transaction envelope |
sim_response_json | string | JSON-encoded simulation response |
created_at | timestamp | Session creation time |
last_access_at | timestamp | Last access/modification time |
status | string | Session status (saved, resumed) |
schema_version | int | Session data schema version |
Automatic cleanup
Sessions are automatically cleaned up based on: Time-to-live (TTL):- Default: 30 days
- Sessions older than TTL are deleted
- Configurable via environment variable
- Default: 100 sessions
- Oldest sessions deleted when limit exceeded
- Cleanup uses LRU (Least Recently Used) strategy
Common workflows
Save and share with team
# SQLite query to export session
sqlite3 ~/.erst/sessions.db "SELECT * FROM sessions WHERE id='token-exploit-2026-03-01'" > session.json
Resume interrupted work
When you resume a session, Erst uses cached data instead of fetching from the network, making analysis instant.
Build investigation history
erst debug tx1... && erst session save --id exploit-attempt-1
erst debug tx2... && erst session save --id exploit-attempt-2
erst debug tx3... && erst session save --id exploit-attempt-3
Clean up old sessions
Manually trigger cleanup:Session compatibility
Schema versioning
Sessions include a schema version number. When you update Erst:- Compatible versions: Sessions load normally
- Incompatible versions: You’ll see a warning and may need to re-debug the transaction
Forward compatibility
Newer Erst versions can read older sessions when possible. Breaking changes are documented in release notes.Migration
If schema migration is needed, Erst provides migration commands:Advanced usage
Query sessions directly
Access the SQLite database for custom queries:Backup sessions
Back up your session database:Export session for reporting
Extract session data for external analysis:Troubleshooting
No active session
erst debug <tx-hash> first to create a session before saving.
Session not found
- Check session ID with
erst session list - Verify spelling of session ID
- Session may have been cleaned up (check TTL)
- Try providing full session ID instead of prefix
Database locked
- Close other Erst processes accessing sessions
- Wait a moment and try again
- Check file permissions on
~/.erst/sessions.db
Schema version mismatch
- Update Erst to the latest version
- Re-debug the transaction with current Erst version
- Check migration documentation in release notes
Implementation details
Source files
Session management is implemented in:internal/cmd/session.go- CLI commandsinternal/session/store.go- Database operationsinternal/session/schema.go- Data structures
Functions
Key functions:SetCurrentSession()- Stores active session from debug commandGetCurrentSession()- Retrieves current session if anyStore.Save()- Persists session to databaseStore.Load()- Retrieves session by IDStore.List()- Lists all sessionsStore.Delete()- Removes sessionStore.Cleanup()- Runs LRU cleanup
internal/cmd/session.go:24, internal/cmd/session.go:29
Best practices
Use descriptive IDs
Use descriptive IDs
Custom IDs make sessions easier to find:Better than auto-generated:
abc123-20260301143022Save after important findings
Save after important findings
Save sessions when you discover something important:This creates a reference point you can return to.
Clean up regularly
Clean up regularly
Delete sessions you no longer need:Keeps the session list manageable.
Back up before major updates
Back up before major updates
Before updating Erst to a new major version:Protects against schema compatibility issues.
Next steps
Debugging failed transactions
Learn how to create sessions during debugging
Cache management
Understand how caching complements sessions
Using flamegraphs
Save profiling data in sessions