POST v0/blob
Submit a Data Blob to Celestia
Submits a data blob to the Celestia blockchain.
Note: It generally takes between 6 and 30 seconds for a blob to be included. If you call this endpoint in synchronous mode, that’s approximately how long you can expect to receive a response. You may need to configure your default timeouts accordingly if you see your requests timing out, as some HTTP tools have a default timeout of 10 or 15 seconds. Alternatively, you can use “asynchronous”: true to get an immediate confirmation that Twinkle has received your request, and poll GET v0/blob/status for its inclusion status.
Request
curl \
-X POST 'https://t.tech/v0/blob' \
-H 'Authorization: Bearer <YOUR API KEY>' \
-H 'Content-Type: application/json' \
-d '{"namespace": 10fd38d19529f08c9771, "data": e9e5231a0f5eecba3401}'package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://t.tech/v0/blob"
apiKey := "Your API Key" // Replace with your actual token
payload := map[string]interface{}{"namespace": "d68043e4ee07137ac993", "data": "0933bcbc9379ad9891c5",
}
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/blob";
let api_key = "Your API Key"; // Replace with your actual token
let payload = json!({
"namespace": "9d88a9ebf9047c4b0192", "data": "814827d819fa9dbe1c0e",
});
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
namespaceThe namespace of the data blob you are posting. The namespace value must be exactly twenty characters of valid hexadecimal text. This corresponds to a V0 Celestia Namespace ID. Read more about namespace IDs at the Celestia Docs here.
dataThe actual data to be posted, encoded in hexadecimal format. On mainnet, blob sizes can be a maximum of 1973786 bytes (just under two mibibytes (MiB)). On mocha-4, max sizes can be 7850000 bytes (just under 8 MiB), though we suggest 7500000 bytes for the blob to reliably make it into the block on Celestia. Read more about maximum blob size on the Celestia Docs here.
asynchronousWhether or not to post the data blob asynchronously. If true, the request will confirm the data blob is in the mempool
of at least one celestia node, and it will be posted in the background. If false, the request will wait until the data
blob is included into the next available block before returning. Defaults to false. Note: an asynchronous request
will only return the twinkleRequestId, as the blob’s confirmation will not be finalized when we deliver a response.
Use GET /blob/status to query a blob’s inclusion status by twinkleRequestId.
networkThe 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.
authoredIf true, includes the signer’s public key in the blob to create an authored blob. Defaults to false if no
value is specified.
feePriorityHow much to incentivize Celestia processing for the transaction. Can be slow, normal, or fast. Defaults to
normal if no value is specified. Essentially serves as a multiplier to the gas price.
Response
blockExplorer — JSON objectblock — URIA block explorer link to the block in which the transaction containing the data blob was included.
transaction — URIA block explorer link to the transaction in which the data blob was included.
blockHeight — integerThe height of the block in which the Celestia transaction containing the data blob was included.
celestiaTransactionId — hexadecimal stringThe Celestia transaction in which the data blob was included.
commitment — stringgasFeeUsdCents — integertwinkleRequestId — uuid stringThe ID of your request in the Twinkle system, used to query its status.
Example Response
{
"twinkleRequestId": "dcff7a04-f32f-4e81-8229-e08331e0821c",
"blockHeight": 6344226,
"celestiaTransactionId": "147941040e63d7c35a6e9b46e0530a7874fc84bf52107cc32c322a4845e5051d",
"blockExplorer": {
"transaction": "https://celenium.io/tx/147941040e63d7c35a6e9b46e0530a7874fc84bf52107cc32c322a4845e5051d",
"block": "https://celenium.io/block/6344226"
},
"gasFeeUsdCents": 1,
"commitment": ""
}