Skip to main content

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.

info

This interface is used by the signature tool, and merchants generally do not need to call it.

Request

Body

    chainId int32required

    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

    address stringrequired

    Owner address

    Note: The address of the wallet that initiates the transaction

    contractAddress stringrequired

    Contract address of the transaction

    encodedFunction stringrequired

    Possible values: Value must match regular expression ^0x[a-fA-F0-9]*$

    Encoded contract function call data

    functionSelector stringrequired

    Possible values: Value must match regular expression ^[a-zA-Z0-9_]+\([a-zA-Z0-9,]*\)$

    Contract function declaration

    Format: function_name(parameter_type)

Responses

OK

Schema

    code int32required

    Status code

    msg stringrequired

    Status message on success or error message on failure

    description string

    Detailed description when error

    data

    object

    required

    chainId stringrequired

    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

    contractAddress stringrequired

    Contract address called by the transaction

    gasLimit int64required

    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

    • 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.
    gasPrice int64required

    Current unit price of the network fee

    nonce int64

    Transaction nonce

    Only transactions on the Ethereum chain will return this field

    hexTransaction string

    Hexadecimal form of the transaction data

    Only transactions on the Tron chain will return this field

    txHash string

    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

Loading...