Simulate sending a transaction.
Parameters
-
<string>
- Transaction, as an encoded string. The transaction must have a valid blockhash, but is not required to be signed. -
<object>
- (optional) Configuration object containing the following fields:-
sigVerify:
<bool> - if true the transaction signatures will be verified (default: false, conflicts withreplaceRecentBlockhash
) -
commitment:
<object> - (optional) Configures the commitment level of the blocks queried
Accepts one of the following strings: ["finalized"
,"confirmed"
,"processed"]
For more info, refer to this doc. -
encoding: <string>
- (optional) Encoding used for the transaction data. Either"base58"
(slow, DEPRECATED), or"base64"
. (default:"base58"
). -
replaceRecentBlockhash:
<bool> - (optional) if true the transaction recent blockhash will be replaced with the most recent blockhash. (default: false, conflicts withsigVerify
) -
accounts:
<object> - (optional) Accounts configuration object containing the following fields:-
encoding:
(optional) <string> - data encoding for each returned transactionAccepts one of the following strings:
["base64"
(default),"base64+zstd"
or"jsonParsed"
]
"jsonParsed"
encoding attempts to use program-specific parsers to make thetransaction.message.instructions
list more human-readable; if a parser cannot be found, the instruction falls back to default JSON. -
addresses:
<array of base-58 encoded strings> - An array of accounts to return
-
-
minContextSlot:
(optional) <number> - set the minimum slot that the request can be evaluated at.
-
Results
Tx Success
error:
<object | string | null> - Error if transaction failed, null if transaction succeededlogs:
<array | null> - Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure)accounts:
<array> | null> - array of accounts with the same length as theaccounts.addresses
array in the request<null>
- if the account doesn't exist or iferr
is not null<object>
- otherwise, a JSON object containing:lamports:
<u64>, number of lamports assigned to this accountowner:
<base-58 encoded string>, Pubkey of the program this account has been assigned todata:
<[string, encoding]|object>, data associated with the account, either as encoded binary data or JSON format{<program>: <state>}
, depending on encoding parameterexecutable:
<bool>, boolean indicating if the account contains a program (and is strictly read-only)rentEpoch:
<u64>, the epoch at which this account will next owe rent
unitsConsumed:
<u64 | undefined>, The number of compute budget units consumed during the processing of this transaction.
Example
Request
curl --location --request POST 'https://solana-mainnet.g.alchemy.com/v2/demo/' \
--header 'Content-Type: application/json' \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iAgICB0cmFuc2Zlcl9hdXRob3JpdHk6ICJwTWludFRaNUNFa0hVaGdydXJQZ29pTW50b0xnRndic0tkYnFOclhzcmR5IiwKICAgIGFjdGl2aXR5OiAxLCAKICAgIHBheV9wZXJpb2Q6IDYwNDgwMC4wMDAwMDAsIAogICAgcGF5X3JhdGU6IDguMDAwMDAwLAogICAgdGltZXN0YW1wOiAxNjU1MTg0ODYwLAogICAgbXVsdGlwbGllcjogMS4wLAogICAgbWF4X3BheW91dDogMTYuMDAwMDAwKQ==",
{
"encoding": "base64",
"commitment": "recent",
"sigVerify": false,
"accounts": {
"addresses": [
"9zyLN5CQwxWrEPit1sFy5DZ5xMqJfNQTLiqBVSfvPvWY",
"GtFMtrW31RdCeSdW4ot3jNVuoLtFywJGGTiF1Q8Uopky",
"pMintTZ5CEkHUhgrurPgoiMntoLgFwbsKdbqNrXsrdy",
"3d8SpnZntmGKtvUmhuak7KSu6XT7AUMinuUDma5hmiBX",
"9P68kbvW9KzPHsZTFq4yQrRVkYsf5CQFg9hVhyBZdpP2",
"BB7pctPeVCQPjXMGdkDX9ADT995gXCVLyHJUygpJPN2x",
"pSTAkE7Z2guBmSheg6tHdHk3rT1wmF1Mfuf52tnWeAd",
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
]
}
}
],
"id": "ea57afc0-7db8-4aa3-8ddb-a28c6099153c"
}'
Response
{
"jsonrpc": "2.0",
"result": {
"context": {
"slot": 137569919
},
"value": {
"accounts": [
null,
null,
null,
null,
null,
null,
null,
null
],
"err": "BlockhashNotFound",
"logs": [],
"unitsConsumed": 0
}
},
"id": "ea57afc0-7db8-4aa3-8ddb-a28c6099153c"
}