rollup_gasPrices
Returns the L2 gas-price oracle data that Unichain uses to compute total fees. The payload mirrors Optimism Bedrock networks and includes:
gasPrice
— Total gas price Unichain applies to transactions.l1GasPrice
— Current L1 gas price component applied to calldata.l2GasPrice
— The execution gas component on Unichain itself.baseFeeScalar
,blobBaseFeeScalar
,overhead
— Scalars used by the sequencer when combining L1/L2 costs.
Use this method when you must break down L1 calldata charges, size cross-chain deposits, or monitor Unichain fee dynamics beyond what eth_gasPrice
exposes.
Parameters
This method accepts no parameters.
Returns
An object describing the current Unichain gas oracle state. Each field is returned as a hexadecimal string representing wei.
Implementation Example
- cURL
- JavaScript
curl -X POST https://api-unichain-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "rollup_gasPrices",
"params": [],
"id": 1
}'
const response = await fetch('https://api-unichain-mainnet.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'rollup_gasPrices',
params: [],
id: 1
})
});
const data = await response.json();
console.log(data.result);
Response Example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"gasPrice": "0x9184e72a000",
"l1GasPrice": "0x4a817c800",
"l2GasPrice": "0x9184e72a",
"baseFeeScalar": "0x1f4",
"blobBaseFeeScalar": "0x0",
"overhead": "0xaae60"
}
}
Need help? Contact our support team or check the Unichain documentation.