curl --request POST \
--url https://nd-907-114-772.p2pify.com/b9b0fb92029d58b396139a9e89cf479b \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": []
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}curl --request POST \
--url https://nd-907-114-772.p2pify.com/b9b0fb92029d58b396139a9e89cf479b \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": []
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}Cronos API method that returns the current gas base fee of the network. The gas price is the quantity of the native token the transaction’s sender must pay per unit of gas consumed. The value returned is in Wei.Documentation Index
Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
Use this file to discover all available pages before exploring further.
nonequantity — the integer value of the current gas base fee, returned in Weieth_gasPrice code examplesconst { Web3 } = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);
async function getGasPrice() {
const baseFee = await web3.eth.getGasPrice();
const feeInGwei = web3.utils.fromWei(baseFee, "gwei")
console.log(`The base gas fee is: ${baseFee} Wei`);
console.log(`The base gas fee is: ${feeInGwei} Gwei`);
}
getGasPrice()
eth_gasPrice to calculate the total gas value to send with a transaction based on the base and priority fee system. Ethereum’s London hard fork implemented This concept with EIP-1559.
EIP-1559 aimed to solve the problem of network congestion by implementing a dynamic fee market mechanism, which adjusts the fee required to process a transaction based on network demand. With the current system, the total gas price comprises a base fee determined by the network’s load and a priority fee added by the user.
eth_gasPrice method returns the base fee.Was this page helpful?