---
updatedAt: 2025-09-18T22:19:03.000Z
agentTools:
  projectIndex: https://docs.nodereal.io/llms.txt
---

# eth_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain.

> 📘 Supported on both BNB Smart Chain and opBNB Chain.

The format of a BNB Smart Chain endpoint:\
`https://bsc-mainnet.nodereal.io/v1/{{apiKey}}`

`https://bsc-testnet.nodereal.io/v1/{{apiKey}}`

The format of an opBNB Chain endpoint:

`https://opbnb-mainnet.nodereal.io/v1/{{apiKey}}`

`https://opbnb-testnet.nodereal.io/v1/{{apiKey}}`

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "eth_estimateGas",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://bsc-mainnet.nodereal.io/v1"
    }
  ],
  "paths": {
    "/{apiKey}": {
      "post": {
        "summary": "eth_estimateGas",
        "description": "Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain.",
        "tags": [],
        "parameters": [
          {
            "name": "apiKey",
            "in": "path",
            "schema": {
              "type": "string",
              "default": "64a9df0874fb4a93b9d0a3849de012d3"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer",
                        "default": 1
                      },
                      "jsonrpc": {
                        "type": "string",
                        "default": "2.0"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "properties": {
                      "method": {
                        "type": "string",
                        "default": "eth_estimateGas",
                        "enum": [
                          "eth_estimateGas"
                        ]
                      },
                      "params": {
                        "type": "array",
                        "minItems": 2,
                        "maxItems": 2,
                        "items": {
                          "oneOf": [
                            {
                              "allOf": [
                                {
                                  "type": "object",
                                  "description": "The transaction call object",
                                  "properties": {
                                    "from": {
                                      "type": "string",
                                      "description": "20 Bytes - The address the transaction is sent from."
                                    },
                                    "to": {
                                      "type": "string",
                                      "description": "20 Bytes - The address the transaction is directed to",
                                      "example": "0xd46e8dd67c5d32be8058bb8eb970870f07244567"
                                    },
                                    "gasPrice": {
                                      "type": "string",
                                      "description": "Integer of the gasPrice used for each paid gas.\n<br/><strong>NOTE:</strong> most of our users <b>(95%+)</b> never set the gasPrice on eth_call.\n"
                                    },
                                    "value": {
                                      "type": "string",
                                      "description": "Integer of the value sent with this transaction"
                                    },
                                    "data": {
                                      "type": "string",
                                      "description": "Hash of the method signature and encoded parameters"
                                    }
                                  },
                                  "required": [
                                    "to"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "gas": {
                                      "type": "string",
                                      "description": "Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions. \n</br><strong> NOTE: </strong>this parameter has a cap of <b>550</b> Million gas per request. Reach out to us at support@alchemy.com if you want to increase this limit!\n"
                                    }
                                  }
                                }
                              ]
                            },
                            {
                              "type": "string",
                              "description": "String - Either the hex value of a **block number** OR One of the following **block tags**: \n  * `pending` - A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool. Intuitively, you can think of these as blocks that have not been mined yet.\n  * `latest` - The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions.\n  * `safe` - The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination. Intuitively, this block is “unlikely” to be re-orged. **Only available on Ethereum Mainnet and Goerli**.\n  * `finalized` - The most recent crypto-economically secure block, that has been accepted by >2/3 of validators. Cannot be re-orged outside of manual intervention driven by community coordination. Intuitively, this block is very unlikely to be re-orged. **Only available on Ethereum Mainnet and Goerli**.\n  * `earliest` - The lowest numbered block the client has available. Intuitively, you can think of this as the first block created.\n",
                              "example": "finalized"
                            }
                          ]
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "x-readme": {
          "explorer-enabled": false,
          "samples-languages": [
            "javascript",
            "curl",
            "python",
            "go"
          ]
        },
        "responses": {
          "200": {
            "description": "Returns the amount of gas used.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "jsonrpc": {
                          "type": "string"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "result": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "operationId": "eth-estimateGas"
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```