Skip to main content

/v1/transactions/simulate

The output of the transaction will have the exact transaction outputs and events that running an actual signed transaction would have. However, it will not have the associated state hashes, as they are not updated in storage. This can be used to estimate the maximum gas units for a submitted transaction.

To use this, you must:

  • Create a SignedTransaction with a zero-padded signature.
  • Submit a SubmitTransactionRequest containing a UserTransactionRequest containing that signature.

To use this endpoint with BCS, you must submit a SignedTransaction encoded as BCS. See SignedTransaction in types/src/transaction/mod.rs.

Parameters

  • estimate_gas_unit_price : (boolean) - If set to true, the gas unit price in the transaction will be ignored and the estimated value will be used
  • estimate_max_gas_amount : (boolean)- If set to true, the max gas value in the transaction will be ignored and the maximum possible gas will be used
  • estimate_prioritized_gas_unit_price: (boolean)- If set to true, the transaction will use a higher price than the original estimate.

Example

Request

curl --request POST \
--url https://aptos-mainnet.blastapi.io/<project-id>/v1/transactions/simulate?estimate_max_gas_amount=false&estimate_gas_unit_price=false&estimate_prioritized_gas_unit_price=false' \
--header 'Content-Type: application/json' \
--data '{
"sender": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 ",
"sequence_number": "32425224034",
"max_gas_amount": "32425224034",
"gas_unit_price": "32425224034",
"expiration_timestamp_secs": "32425224034",
"payload": {
"type": "entry_function_payload",
"function": "0x1::aptos_coin::transfer",
"type_arguments": [
"string"
],
"arguments": [
null
]
},
"signature": {
"type": "ed25519_signature",
"public_key": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 ",
"signature": "0x88fbd33f54e1126269769780feb24480428179f552e2313fbe571b72e62a1ca1 "
}
}'