Transaction Simulation
Preview transaction results on deployed contracts before submitting to the network.
What is Simulation?
Simulation lets you execute transactions against real, deployed contracts without actually committing them to the blockchain. It's like a dry run for your transactions.
Use Cases
- Preview method call results before signing
- Test interactions with live contracts
- Debug failing transactions
- Estimate execution costs accurately
- Verify transaction groups work correctly
How Simulation Works
When you simulate a transaction:
- The transaction is built with all parameters
- It's sent to the Algorand node's simulate endpoint
- The node executes it against current blockchain state
- Results are returned without modifying the blockchain
Note
Simulation uses the current blockchain state. Results may differ if state changes between simulation and submission.
Using Simulation
From the Explorer
- Find a contract in the Explorer
- Select a method to call
- Fill in the parameters
- Click Simulate instead of Call
From the Transaction Composer
- Build your transaction or group
- Click Simulate in the action bar
- Review the simulated results
- If satisfied, click Submit to send for real
Simulation Results
Transaction Success/Failure
Shows whether each transaction in the group would succeed or fail, with error messages for failures.
Return Values
For ABI method calls, see the decoded return value.
State Changes
Preview what state would be modified:
- Global state changes
- Local state changes
- Box storage changes
Logs
View any log messages emitted by the contract during execution.
Inner Transactions
See any inner transactions that would be created by the contract.
Resource Usage
- Opcode budget - How much budget was used
- Fee - Transaction fee that would be charged
Debugging with Simulation
When a transaction fails, simulation helps you understand why:
- Error message - Shows the assert message or error
- Program counter - Where in the program it failed
- Stack trace - Execution trace up to failure
Tip
Compare the simulation trace with your source code to identify the failing assertion or operation.
Limitations
- State changes - Between simulation and execution, state may change
- Timing - Timestamp and round number will differ
- Randomness - VRF-based operations may produce different results
Simulation vs Ghost Testing
Ghost Testing
- Tests undeployed contracts
- You control initial state
- No network required
- Best for development
Simulation
- Tests deployed contracts
- Uses real blockchain state
- Requires network connection
- Best for production verification