Prerequisites: You need a Risk API key
and familiarity with the Transaction
Simulator endpoint. You
should also know how to construct Solana transactions using
@solana/kit or
equivalent.When to Simulate
Step 1: Prepare and Encode the Transaction
Build your Solana transaction using any SDK and encode it as base64 or base58.Step 2: Submit for Simulation
Single Transaction
Batch Simulation
Use batch simulation when you have multiple transactions to validate - either independent transactions or a sequence of dependent operations.When to Use Each
Step 3: Analyze the Response
The simulation response contains several sections. Here’s what to check and in what order:Check for Errors First
If theerror field is present, the transaction would fail onchain. Other
fields may be incomplete.
Review Asset Transfers
Theasset_transfers array shows all token and SOL movements per account. Each
entry represents a balance change for a specific account and asset.
Debit from the sender and
a Credit to the recipient. For swaps or complex transactions, you’ll see
multiple entries across different mints and accounts.
Check Balance Changes
Thelamport_changes array shows the net SOL balance change for each address
involved in the transaction.
Review State Changes
Theexpected_state_changes object maps each affected account to an array of
state changes. Each change includes a humanReadableDiff for display, a
suggestedColor (CREDIT or DEBIT), and rawInfo with structured data about
the change type.
SOL_TRANSFER, Native SOL transfersSPL_TRANSFER, Token transfers, swaps, mints, burns- Account creations, closures, and other token operations
Check Transaction Costs
Fee Confidence Levels
Step 4: Check Transaction Risk
Thetransaction_risk section provides risk analysis for all accounts involved
in the transaction.
riskScore(1-10) andriskLevel(e.g., “Extremely high risk”)numHops, Distance to nearest malicious addressreasoning, Explanation of why the address is flaggedmaliciousAddressesFound, List of connected malicious addresses with their categories (Hack, Scam, etc.)
Risk analysis is performed on the main transaction level. Embedded
transactions (e.g., Squads multisig operations) and nested instruction data
are not currently included in risk scoring.
Debugging Common Failures
Using Logs for Debugging
Thetransaction_logs array contains the complete execution logs from the
Solana runtime. Search for "Program log: Error" or "failed" to pinpoint the
failing instruction:
Complete Simulation Workflow
What’s Next
Simulate Solana Transaction
Full endpoint reference with response schema details.
Wallet Integration
Integrate simulation into a wallet send flow with address screening.