Marketplace has launched, further enabling blockchain developers! Learn more

Contents

eth_estimateGas RPC method

The eth_estimateGas EVM method is only supported on the Avalanche C-Chain.

Parameters:

  1. Object - Transaction object, where from field is optional and nonce field is ommited.
  2. Quantity or Tag - (optional) Integer block number, or the string 'latest', 'earliest' or 'pending', see the default block parameter.

Returns:

  1. Quantity - The estimated amount of gas used.

Code Examples:

To use the eth_estimateGas EVM method on the Avalanche C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.

require 'ethereum.rb'
client = Ethereum::HttpClient.new('http://sample-endpoint-name.network.quiknode.pro/token-goes-here/')
blockNumber = client.eth_estimate_gas({"from":"0x8D97689C9818892B700e27F316cc3E41e17fBeb9","to":"0xd3CdA913deB6f67967B99D67aCDFa1712C293601","value":"0x186a0"})
puts blockNumber["result"].to_i(16)
Ready to get started? Create a free account