HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
API Reference

eth_estimateGas

Get the required energy through triggerConstantContract.

Parameters
object - The transaction call object, the items in it as below

Item NameData TypeDescription
fromDATA, 20 Bytesaddress of the sender
toDATA, 20 Bytesaddress of the receiver
gasQUANTITYunused.
gasPriceQUANTITYunused.
valueQUANTITYInteger of the value sent with this transaction
dataDATAHash of the method signature and encoded parameters.

Returns
The amount of energy used.

Example

curl -X POST '47.95.206.44:50545/jsonrpc' --data '{
	"jsonrpc": "2.0",
	"id": 1,
	"method": "eth_estimateGas",
	"params": [{
		"from": "0x41F0CC5A2A84CD0F68ED1667070934542D673ACBD8",
		"to": "0x4170082243784DCDF3042034E7B044D6D342A91360",
		"gas": "0x01",
		"gasPrice": "0x8c",
		"value": "0x01",
		"data": "0x70a08231000000000000000000000041f0cc5a2a84cd0f68ed1667070934542d673acbd8"
	}]
}'

Result

{"jsonrpc":"2.0","id":1,"result":"0x0"}