eth
eth_estimateGas
Estimates the amount of gas required to execute a transaction. The transaction is not actually sent to the network. The estimate may be higher than the actual gas used because of EVM mechanics and nod
Estimates the amount of gas required to execute a transaction. The transaction is not actually sent to the network. The estimate may be higher than the actual gas used because of EVM mechanics and node safety margins.
Parameters
| # | Type | Description |
|---|---|---|
| 1 | object | Transaction call object. |
The transaction call object supports these fields:
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | The address the transaction is directed to. |
from | string | No | The address the transaction is sent from. |
value | string | No | Value transferred in wei (hex). |
data | string | No | Encoded function call data. |
gas | string | No | Gas limit (hex). Used as an upper bound for the estimate. |
Returns
string -- The estimated gas amount as a hexadecimal string.
Example
Estimate gas for a simple PLS transfer:
curl -s -X POST https://rpc.pulsechain.box \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"to": "0x0000000000000000000000000000000000000000",
"value": "0xde0b6b3a7640000"
}],
"id": 1
}'
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5208"
}
TRY IT
Notes
- A simple PLS (native token) transfer always costs exactly 21000 gas (
0x5208). - Contract interactions will return higher estimates depending on the complexity of the execution.
- If the call would revert, the method returns an error with the revert reason (if available).
- The
fromfield is optional but may affect the estimate if the contract logic depends onmsg.sender. - It is good practice to add a small buffer (e.g., 10-20%) to the estimate when setting the gas limit for a real transaction, as actual execution may vary.
eth_feeHistory
Returns historical gas fee data, including base fees and priority fee percentiles, for a range of recent blocks. Introduced in EIP-1559.
eth_chainId
Returns the chain ID of the network the node is connected to. The chain ID is used in transaction signing to prevent replay attacks across different networks.
