Links

eth_gasPrice

Returns the current price per gas in wei.

Parameters

None

Returns

QUANTITY(hex string) - integer of the current gas price in wei.

Example

Request

curl
TypeScript
curl https://api.blockvision.org/v1/<api key> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 73
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
​
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.OPT_MAINNET)
​
// Access standard Ethers.js JSON-RPC node request
bv.getGasPrice().then(console.log)

Result

{
"jsonrpc": "2.0",
"id": 73,
"result": "0x4444aa725"
}