Skip to main content

simulateTransaction RPC Method

Simulate sending a transaction

params

object optional Configuration object containing the following fields:

commitment

The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.

sigVerify

If true the transaction signatures will be verified (conflicts with replaceRecentBlockhash)

replaceRecentBlockhash

If true the transaction recent blockhash will be replaced with the most recent blockhash (conflicts with sigVerify)

minContextSlot

The minimum slot that the request can be evaluated at

encoding
  • Values: base58 base64

  • Default: base58

    Encoding used for the transaction data. Values: base58 (slow, DEPRECATED), or base64.

innerInstructions

If true the response will include inner instructions. These inner instructions will be jsonParsed where possible, otherwise json.

accounts

Accounts configuration object containing the following fields:

  • addresses: An array of accounts to return, as base-58 encoded strings
  • encoding: Encoding for returned Account data. Note: jsonParsed encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data. If jsonParsed is requested but a parser cannot be found, the field falls back to base64 encoding, detectable when the returned accounts.data field is type string.

result

object The result will contain:

err

Error if transaction failed, null if transaction succeeded. See TransactionError definitions

logs

Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute

accounts

Array of accounts with the same length as the accounts.addresses array in the request. Each element is either:

  • null - if the account doesn't exist or if err is not null
  • An object containing:
    • lamports: <u64>- number of lamports assigned to this account
    • owner: <string> - base-58 encoded Pubkey of the program this account has been assigned to
    • data: <[string, encoding]|object> - data associated with the account, either as encoded binary data or JSON format {<program>: <state>}
    • executable: <bool> - boolean indicating if the account contains a program
    • rentEpoch: <u64> - the epoch at which this account will next owe rent
unitsConsumed

The number of compute budget units consumed during the processing of this transaction

returnData

The most-recent return data generated by an instruction in the transaction, containing:

  • programId: <string> - the program that generated the return data, as base-58 encoded Pubkey
  • data: <[string, encoding]> - the return data itself, as base-64 encoded binary data
innerInstructions

Defined only if innerInstructions was set to true. The value is a list of inner instructions.

cURL

curl https://us-seattle.openverse.network/api -s -X \
POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "simulateTransaction",
"params": [
"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=",
{
"encoding": "base64"
}
]
}

Response

{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 218 },
"value": {
"err": null,
"accounts": null,
"logs": [
"Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri invoke [1]",
"Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri consumed 2366 of 1400000 compute units",
"Program return: 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri KgAAAAAAAAA=",
"Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success"
],
"returnData": {
"data": ["Kg==", "base64"],
"programId": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"
},
"unitsConsumed": 2366
}
},
"id": 1
}