Estimate transaction fee
POST/transaction/estimate
Submit the function and parameters to estimate the fee for calling the smart contract. The return is transaction information including network fee and transaction hash, but it will not actually initiate the transaction.
This interface is used by the signature tool, and merchants generally do not need to call it.
Request
- application/json
Body
Chain ID
This is the platform internal ID, not the chain ID on the chain or from the wallet, can be obtained from Get Chain List interface
Owner address
Note: The address of the wallet that initiates the transaction
Contract address of the transaction
Possible values: Value must match regular expression ^0x[a-fA-F0-9]*$
Encoded contract function call data
Possible values: Value must match regular expression ^[a-zA-Z0-9_]+\([a-zA-Z0-9,]*\)$
Contract function declaration
Format: function_name(parameter_type)
Responses
- 200
- 401
- 403
- 404
OK
- application/json
- Schema
- Example (from schema)
- Example
Schema
- For Ethereum, the estimated amount of native tokens consumed by the transaction is (gasLimit * gasPrice) / 10^18 ETH.
- For Tron, the estimated amount of native tokens consumed by the transaction is gasLimit / 10^6 TRX.
- If the native token balance in the caller's wallet address is insufficient, the contract function execution will fail, and the consumed network fee will not be returned.
Status code
Status message on success or error message on failure
Detailed description when error
data
object
required
Possible values: Value must match regular expression ^0x[a-fA-F0-9]+$
Real chain ID
The chain ID declared by the blockchain to the outside world, format is a hexadecimal string
Contract address called by the transaction
Estimated network fee required by the blockchain to execute this transaction
This value is only an estimate and does not guarantee consistency with the final consumed network fee
Current unit price of the network fee
Transaction nonce
Only transactions on the Ethereum chain will return this field
Hexadecimal form of the transaction data
Only transactions on the Tron chain will return this field
Transaction hash
Only transactions on the Tron chain will return this field
This transaction hash is a predicted value, used for signature, and does not indicate that it has been published on the blockchain
{
"code": 0,
"msg": "string",
"description": "string",
"data": {
"chainId": "string",
"contractAddress": "string",
"gasLimit": 0,
"gasPrice": 0,
"nonce": 0,
"hexTransaction": "string",
"txHash": "string"
}
}
{
"code": 200,
"msg": "success",
"data": {
"gasPrice": 420,
"gasLimit": 7809984,
"txHash": "0xca9f2e41f0f59f83e237c8ad2b95c73ade7da07f659034026b64522be22a905b",
"hexTransaction": "0x0af5020a029e9f220801d2113c177d62ed40e8989fdbe5315ad002081f12cb020a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e74726163741295020a1541e33ccff0de3ce13636f66a507f6e3cdf7a963562121541fdb2c4d5364d061fcf941af600a45564d2d2033022e4018d80ff0a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000098ea51342dabbb928ae1e576bd39eff8aaf070a8c600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000005f11063c669a79ec55d2008de2f754fd4a37ce0000000000000000000000000000000000000000000000000000000000989680000000000000000070fac59bdbe5319001c0d7dc032a00",
"chainId": "0xcd8690dc",
"contractAddress": "TZ6e7fuFHX1E7uhpAFcCHmSzBfaBtb6spS"
}
}
Unauthorized
Forbidden
Not Found