Validate transactions before submission with pre-flight checks that detect reversion conditions with 99.7% accuracy.
Overview
Transaction simulation executes transactions against current blockchain state without actually submitting them to the network. This pre-flight validation prevents wasted gas from failed transactions and provides detailed insight into transaction outcomes.
How simulation works
Molt402 uses eth_call to simulate transaction execution:
Fetch current blockchain state (balances, nonces, contract storage)
Execute transaction logic against state snapshot
Detect reversion conditions, state changes, and gas consumption
Return detailed simulation results
Accuracy: 99.7% of simulations accurately predict on-chain behavior. The 0.3% edge cases involve time-dependent contracts or external oracle calls.
const result = await client.execute({
instruction: "Transfer 100 ETH to 0x1234...",
simulate: true
})
if (!result.simulationResult?.success) {
// Error: Insufficient balance
// Required: 100 ETH + gas
// Available: 50 ETH
}
const result = await client.execute({
instruction: "Swap 1000 USDC for WETH on Uniswap",
simulate: true
})
// Simulation detects missing approval
if (result.simulationResult?.error?.code === "INSUFFICIENT_ALLOWANCE") {
// Need to approve USDC spending first
await client.execute({
instruction: "Approve Uniswap router to spend 1000 USDC"
})
}
const result = await client.execute({
action: "call",
contract: "0x1234...",
method: "withdraw",
params: [1000],
simulate: true
})
if (!result.simulationResult?.success) {
console.log(`Revert reason: ${result.simulationResult.error.reason}`)
// "Withdrawal amount exceeds available balance"
}
const result = await client.execute({
instruction: "Execute complex multi-step operation",
simulate: true
})
if (result.simulationResult?.gasUsed > "30000000") {
console.error('Transaction gas exceeds block limit')
}