This endpoint will return the block header from the designated Celestia network. A valid API key is required to access this endpoint. The header contains information about the block, such as its version, time, and hashes of various components.
// 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/header";
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(())
}