๐ต Base Chain RPC Methods & API Documentation
eth_estimateGas RPC Method
The eth_estimateGas method is used to estimate the amount of gas a transaction would consume if executed on the Base chain (an Ethereum L2 built by Coinbase). This estimation simulates the transaction and does not broadcast it to the blockchain.
โ ๏ธ
eth_estimateGasverifies that the sender (from) address has enough ETH to cover gas costs, even though the call itself doesn't consume gas.
Parameters
1. Transaction Call Object (required)
from(optional) โ Address sending the transaction.to(required) โ Address the transaction is sent to.gas(optional) โ Gas limit provided for the transaction execution.gasPrice(optional) โ Price per unit of gas (in hexadecimal Wei).maxPriorityFeePerGas(optional) โ Max fee per gas above the base fee.maxFeePerGas(optional) โ Max total fee per gas (base + priority), in Wei.value(optional) โ Amount of ETH to transfer (in hexadecimal Wei).data(optional) โ ABI-encoded function call. More info: Ethereum ABI Spec (opens in a new tab)
๐
maxPriorityFeePerGasandmaxFeePerGas(EIP-1559) must not be used withgasPricein the same transaction.
๐ You can convert
WeitoETHusing eth-converter.com (opens in a new tab). ETH on Base uses 18 decimals.
Returns
Returns the estimated gas (in hexadecimal) that the transaction would consume if sent.
Request Format
POST https://base-mainnet.chainnodes.org/YOUR-API-KEY
Example
Confusing? Ask blockchain developers in Chainnodes Telegram Chat (opens in a new tab)
- ๐ Replace
YOUR-API-KEYwith your personal key from the CHAINNODES Dashboard (opens in a new tab). - ๐ Replace
base-mainnetwith another supported Base network if needed.
curl https://base-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"eth_estimateGas",
"params": [{
"from": "0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503",
"to": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"gas": "0x30D40",
"gasPrice": "0x2E90EDD000",
"value": "0x0",
"data": "0xa9059cbb000000000000000000000000d6216fc19db775df9774a6e33526131da7d19a2c0000000000000000000000000000000000000000000000000000000005f5e100"
}],
"id": 1
}'
Sample Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xb411"
}๐ก Confusing?
Ask our experienced blockchain developers in Telegram
JSON-RPC API Documentation by CHAINNODES is based on Erigon node client. Contact us if you are interested in specific methods that are only available on geth, besu, Nethermind or reth