get_gas_price

Returns the RPC provider's current legacy gas-price estimate as an exact UINT256 value in Wei.

Example

Needs RPC · RPC required

1
WITH observed AS MATERIALIZED (
2
SELECT get_gas_price($client) AS gas_price_wei
3
)
4
SELECT
5
gas_price_wei,
6
format_units(gas_price_wei, 9) AS gas_price_gwei,
7
gas_price_wei > 0::UINT256 AS is_positive
8
FROM observed;
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

get_gas_price(CLIENT) # RPC required

Reads one current gas-price observation through the supplied client.

Inputs

Name Type Use
client CLIENT

Attached live CLIENT used for the current gas-price observation.

required positional

Returns

Name Type
gas_price_wei UINT256

Current gas price in Wei. Exact UINT256 quantity returned by eth_gasPrice. Use format_units(gas_price_wei, 9) to display Gwei.

Guidance

Observation boundary

The result reflects the provider's current estimate and can change between calls.

Persist one result when downstream calculations must share the same observation.

This is a legacy gas-price estimate; EIP-1559 fee selection also depends on base fee and priority fee.

Category and tags

Category
Chain reads
Tag
RPC