POST v0/gas_estimate
Estimate gas usage for a Celestia transaction
This endpoint simulates a ‘MsgSend’ transaction execution to estimate gas usage on the requested Celestia network A safety buffer of 10% is added to the ‘gasUsed’
Request
Copied!
curl \
-X POST 'https://t.tech/v0/gas_estimate' \
-H 'Authorization: Bearer <YOUR API KEY>' \
-H 'Content-Type: application/json' \
-d '{"fromAddress": "REPLACE ME", "toAddress": "REPLACE ME", "amount": "REPLACE ME"}'package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://t.tech/v0/gas_estimate"
apiKey := "Your API Key" // Replace with your actual token
payload := map[string]interface{}{"fromAddress": "REPLACE ME", "toAddress": "REPLACE ME", "amount": "REPLACE ME",
}
jsonPayload, err := json.Marshal(payload)
if err != nil {
fmt.Println("Error marshalling JSON:", err)
return
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
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", features = ["json"] }
// serde_json = { version = "1.0" }
// tokio = { version = "1.46", features = ["macros", "rt-multi-thread"] }
use reqwest::{Client, header};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let url = "https://t.tech/v0/gas_estimate";
let api_key = "Your API Key"; // Replace with your actual token
let payload = json!({
"fromAddress": "REPLACE ME", "toAddress": "REPLACE ME", "amount": "REPLACE ME",
});
let res = client
.post(url)
.header(header::CONTENT_TYPE, "application/json")
.bearer_auth(api_key)
.json(&payload)
.send()
.await?;
let status = res.status();
let body = res.text().await?;
println!("Status: {}", status);
println!("Response: {}", body);
Ok(())
}Body Parameters
fromAddressstringrequired
The sender’s Celestia address
toAddressstringrequired
The recipient’s Celestia address
amountstringrequired
The amount to send in base denomination (utia)
memostringoptional
Transaction memo (optional, used for bridge metadata)
networkstringoptional
The Celestia network to simulate the transaction on. 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
bufferPercent — integerThe safety buffer percentage applied
gasLimit — integerThe recommended gas limit (gasUsed + safety buffer)
gasUsed — integerThe estimated gas usage for the transaction
Example Response
Copied!
{
"gasUsed": 68961,
"gasLimit": 75858,
"bufferPercent": 10
}