Base
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Base
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
eth_estimateGas simulates a transaction against current Base state and returns the amount of gas it would need to execute on-chain, without actually submitting it. Base is Coinbase's OP Stack rollup where ETH pays for gas, so the figure you get back is the L2 execution gas you must cover when the transaction lands. Send the request to https://base.therpc.io/YOUR_API_KEY (chain ID 8453) and the node runs the call, adds a small safety buffer, and hands back a hex gas estimate you can plug into the transaction's gas limit.
to and passing the deploy bytecode as data.eth_feeHistory.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | transaction | object | Sim | Transaction object. `to` is required for calls; omit `to` for contract deployments. Optional: `from`, `gas`, `gasPrice`/`maxFeePerGas`/`maxPriorityFeePerGas`, `value`, `data`. |
| 2 | blockTag | string | Não | Block state to simulate against. Defaults to `latest`.Padrão: latest |
| Tipo | Descrição |
|---|---|
| string | Hex-encoded gas estimate. The node typically adds a small safety buffer above the raw simulation result. |
Try it live in the Base playground.
| Código | Mensagem | Causa |
|---|---|---|
3 | execution reverted | The simulated transaction reverted; the estimate cannot be produced. |
-32000 | gas required exceeds allowance | Estimated gas exceeded the block gas limit or the supplied gas cap. |
-32602 | invalid argument | Malformed transaction object. |
3 or -32000) instead of a gas figure, so handle that path explicitly.Parâmetros
Transaction object. `to` is required for calls; omit `to` for contract deployments. Optional: `from`, `gas`, `gasPrice`/`maxFeePerGas`/`maxPriorityFeePerGas`, `value`, `data`.
"latest" | "pending" | hex block number