GET v0/gas_price
Get the Celestia gas price
Gets the minimum gas price on the requested Celestia network
Request
Copied!
curl \
-H 'Authorization: Bearer <YOUR API KEY>' \
'https://t.tech/v0/gas_price'package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://t.tech/v0/gas_price"
apiKey := "Your API Key" // Replace with your actual token
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println("Status:", resp.Status)
fmt.Println("Response:", string(body))
}// Cargo.toml dependencies:
// [dependencies]
// reqwest = { version = "0.12" }
// tokio = { version = "1.46", features = ["macros", "rt-multi-thread"] }
use reqwest::{Client, header};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let url = "https://t.tech/v0/gas_price";
let api_key = "Your API Key"; // Replace with your actual token
let res = client
.get(url)
.bearer_auth(api_key)
.send()
.await?;
let status = res.status();
let body = res.text().await?;
println!("Status: {}", status);
println!("Response: {}", body);
Ok(())
}Query Parameters
networkstringoptional
The Celestia network to which the data blob should be posted. Can be either mainnet or mocha-4. Defaults to
mainnet if no value is specified. Read more about networks on the Celestia Docs here.
Response
JSON object
gasPrice — floatThe current gas price of the selected Celestia network.
Example Response
Copied!
{
"gasPrice": 0.002
}