Estimate Transaction
API Documentation: Estimate Transaction
Overview
This API endpoint allows you to retrieve estimate gas used, suggest gas price and suggest gas fee for an Ethereum transaction.
- HTTP Method: POST
- Endpoint:
/api/v1/wallet/eth/send/transaction/estimate
Request Body Parameters
walletId
(required): this will be used to determine which key used to sign. The type is string.to
(required): The recipient’s Ethereum address, specified in standard Ethereum address format.data
(required): The data associated with the transaction. If no specific data is provided, use 0x to indicate an empty transaction.nonce
(required): The sender’s nonce, which is a number representing the number of transactions sent from the sender’s address. This should be an integer.gasFeeCap
(required): The maximum gas fee (in gwei) the sender is willing to pay for the transaction, represented as a number (maxFeePerGas).gasTipCap
(required): The maximum tip fee (in gwei) the sender is willing to provide as a priority fee to miners, represented as a number (maxPriorityFeePerGas).gas
(required): The amount of gas (in units) required for the transaction to be processed. This should be specified as a number.value
(required): The amount of Ether (in wei) to be transferred in the transaction. The value should be represented as an integer in wei (the smallest unit of Ether).
Example Request Body
{
"walletId" : "...",
"to": "0x69DDcdE165b784c059cC3E9DFA1cdc374cd6F3C3",
"data": "0x",
"nonce": 1,
"gasFeeCap": 20000000000, // 20 gwei
"gasTipCap": 10000000000, // 10 gwei
"gas": 21000,
"value": 1000000000000000000, // 1 Ether (in wei)
}
Request
Request Headers
X-CLIENT-ID
: (required): Client ID which was generated when register in Xellar TSS API Service Dashboard.X-SIGNATURE
: (required): Calculated signature, please refer to Authorization section.X-TIMESTAMP
: (required): Request timestamp in RFC3339 format.
Example Request Syntax
curl -X POST -H "Content-Type: application/json" -H "x-client-id: $YOUR_CLIENT_ID" -H "x-client-secret: $YOUR_CLIENT_SECRET" -d '{
"walletId" : "...",
"to": "0x69DDcdE165b784c059cC3E9DFA1cdc374cd6F3C3",
"data": "0x",
"nonce": 1,
"gasFeeCap": 20000000000,
"gasTipCap": 10000000000,
"gas": 21000,
"value": 1000000000000000000
}' <BASE_URL>/api/v1/wallet/eth/send/transaction/estimate
Response
The response will include a JSON object with the following properties:
status
(number): The HTTP status code of the response (e.g., 200 for success).message
(string): A message providing additional information about the operation.data
(object): An object containing the request information.data.gasEstimation
(number): The gas estimation needed to execute a specific transaction based on the current pending state of the backend blockchain.data.suggestGasPrice
(number): The the currently suggested gas price to allow a timely execution of a transaction.data.gasFeeEstimation
(number): The multiplication of gasFeeEstimation and suggestGasPrice.
Example Response
{
"status": 200,
"message": "Transfer Transaction Estimation Successfully",
"data": {
"gasEstimation": 21000,
"suggestGasPrice": 3564020892,
"gasFeeEstimation": 74844438732000
}
}