For the complete documentation index, see llms.txt. This page is also available as Markdown.

zks_getL1GasPrice - Abstract

Example code for the zks_getL1GasPrice JSON-RPC method. Complete guide on how to use zks_getL1GasPrice JSON-RPC in GetBlock Web3 documentation.

Returns the L1 gas price that Abstract currently uses to compute the data-availability portion of transaction fees.

Parameters

This method takes an empty params array.

Request

curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "zks_getL1GasPrice",
    "params": [],
    "id": "getblock.io"
}'
example.js
const axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', { jsonrpc: '2.0', method: 'zks_getL1GasPrice', params: [], id: 'getblock.io' }, { headers: { 'Content-Type': 'application/json' } });
console.log(response.data.result);
example.py
import requests
response = requests.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', headers={'Content-Type': 'application/json'}, json={'jsonrpc': '2.0', 'method': 'zks_getL1GasPrice', 'params': [], 'id': 'getblock.io'})
print(response.json())
example.rs
use reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let res = client.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/").json(&json!({"jsonrpc":"2.0","method":"zks_getL1GasPrice","params":[],"id":"getblock.io"})).send().await?.json::<Value>().await?;
    println!("{}", res["result"]);
    Ok(())
}

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "0x3b9aca00"
}

Response Fields

Field
Type
Description

result

string

L1 gas price in wei (hex)

Use Cases

  • Fee Modelling: Factor L1 costs into fee estimates

  • Monitoring: Track the L1 fee component

Error Handling

Error
Message
Description

-32602 / Invalid params

Invalid params

A parameter was malformed

403 / RBAC: access denied

Access denied

The GetBlock access token is missing or incorrect

Last updated

Was this helpful?