| Crates.io | nitro-da-client |
| lib.rs | nitro-da-client |
| version | 0.1.7 |
| created_at | 2025-04-25 13:12:20.759862+00 |
| updated_at | 2025-05-30 13:39:15.509753+00 |
| description | Contains blober client for interacting with the Blober program on Solana. |
| homepage | https://www.termina.technology |
| repository | https://github.com/nitro-svm/nitro-data-module |
| max_upload_size | |
| id | 1648979 |
| size | 470,337 |
This crate is a Rust client which handles interactions with the Nitro Blober on-chain program and with the Nitro DA indexer service in an optimized way.
All you need to do to get started with the client is add it to your project dependencies:
cargo add nitro-da-client
To start uploading and reading data, pass the configs into the client like the following:
let blober_client = BloberClient::builder()
.payer(payer)
.program_id(program_id)
.indexer_from_url(&indexer_url)
.await?
.build_with_config(config)
.await?;
payer is a Arc<Keypair> - a solana keypair you want to use with the clientprogram_id is the address of the blober on-chain program you want to interact withindexer_url is an optional parameter to provide if you are using our indexer serviceconfig is a solana_cli_config::Config object used to determine RPC details with which to send the transactionsUploading data once you have a blober client is as simple as:
let transaction_outcomes = blober_client.upload_blob(data, fee, blober_id, timeout).await?;
data is a slice of bytes (&[u8]) to uploadfee is a fee strategy for how much you want to send as the priority feeblober_id is the blober PDA (namespace) you want to upload totimeout is an optional parameter which specifies how long to wait before discarding a started data uploadThe transaction outcomes is a vector of
TransactionOutcomeenum structs which contain the success state (successfull, failed or unknown) and in case of success the transaction signature and slot at which the transaction landed.
To later retrieve the data that was uploaded, you can either do it from the ledger directly:
let blob = blober_client
.get_ledger_blobs_from_signatures(blober, signatures)
.await?;
Where the signatures are the list of signatures you got by sending the upload request.
let blobs = blober_client.get_ledger_blobs(slot, blober, lookback_slots).await?;
Where the slot is the slot at which the upload was finalized and lookback_slots is an optional parameter to limit how many slots before the slot
to fetch in the past.
Or from the indexer service with:
let blobs = blober_client.get_blobs(slot, blober).await?;
And getting the indexer proofs (these prove that the indexer is sending you valid data):
let proof = blober_client.get_slot_proof(slot, blober).await?;
For more details, check out the docs.