eth_estimateGas
Introduction
This API returns an estimation of gas for a given transaction. It consumes 87 CUs.
Parameter Description
The parameters are the same as those of eth_call, but they are all optional. If no gas is specified, geth uses the block gas limit from the pending block as an upper bound. As a result, the returned estimate might not be enough to execute the call/transaction when the amount of actual gas needed is higher than the pending block gas limit.
Parameter |
Type |
Description |
---|---|---|
from |
String |
The address from which the transaction is sent. |
to |
String |
The address to which the transaction is directed. |
gas |
Integer |
The integer of gas provided for the transaction execution. |
gasPrice |
Integer |
The integer of gasPrice used for each paid gas encoded as hexadecimal. |
value |
Integer |
The integer of value sent with this transaction encoded as hexadecimal. |
data |
String |
The hash of the method signature and encoded parameters. For more information, see the Contract ABI description in the Solidity documentation. |
Block number |
String |
A hexadecimal block number, or the string (earliest, latest, or pending). |
Return Value
An estimation of gas for a given transaction.
Request
curl https://your-http-endpoint/v1/<API-KEY> \ -X POST \ -H "Content-Type: application/json" \ --data '{"method":"eth_estimateGas","params":[{"from":"0x8D97689C9818892B700e27F316cc3E41e17fBeb9","to":"0xd3CdA913deB6f67967B99D67aCDFa1712C293601","value":"0x186a0"}],"id":1,"jsonrpc":"2.0"}'
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot