Skip to main content

eth_gasPrice

Returns the current gas price on Astar in wei.

Why Astar? Build on Polkadot's leading dApp hub supporting EVM, WASM, and upcoming PolkaVM environments with EVM + WASM + PolkaVM support, Build2Earn developer rewards, dApp Staking, and Soneium cross-layer integration.

Use Cases#

The eth_gasPrice method is essential for:

  • Transaction pricing - Set appropriate gas prices
  • Cost estimation - Calculate transaction costs before sending
  • Gas monitoring - Track network congestion
  • DeFi operations - Optimize costs for cross-chain DeFi, multi-VM smart contracts, and XCM-enabled interoperability with Ethereum and Cosmos

Parameters#

This method accepts no parameters.

Request#

{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}

Returns#

TypeDescription
QUANTITYCurrent gas price in wei (hexadecimal)

Response#

{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3b9aca00"
}

Note: 0x3b9aca00 = 1 Gwei (1,000,000,000 wei)

Code Examples#

curl -X POST https://api-astar.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'

Error Handling#

Error CodeMessageDescription
-32603Internal errorNode error