You can use the Data Module's Rust client or CLI tool to post data on-chain and retrieve it from the ledger or our indexer service.
We do not recommend using public RPC nodes for production because of their low rate limits and low stake, which makes transaction landing slower than private RPC nodes. Please reach out if you'd like help in setting up a private endpoint.
1
Prerequisite Setup
If your codebase is in Rust, please use the Rust client. Otherwise, we also provide a command line utility.
Configure solana-cli to use your preferred RPC and network e.g.solana config set --url https://api.devnet.solana.com for devnet.
Download nitro-da-cli .
curl -sSf https://nitro-da-cli.termina.technology/install.sh | sh
Run nitro-da-cli to see all the available commands and their options.
2
Select Blober Program ID
Make sure to use the correct program ID for mainnet and devnet:
Network
Program ID
Solana Mainnet
9i2MEc7s38jLGoEkbFszuTJCL1w3Uorg7qjPjfN8Tv5Z
Solana Devnet
2RWsr92iL39YCLiZu7dZ5hron4oexEMbgWDg35v5U5tH
3
Create Namespace
A namespace represents a data collection, and only your keypair is allowed to write data to it. To create a sample namespace called nitro on Solana devnet:
let blober_client = BloberClient::builder()
.payer(payer)
.program_id(program_id)
.indexer_from_url(&indexer_url)
.await?
.build_with_config(config)
.await?;
The payer is an Arc<Keypair> that points to the Solana keypair to use with the client
The program_id is the address of the on-chain blober program to interact with
The indexer_url is an optional parameter if using our indexer service
The config is a solana_cli_config::Config object that sets the transaction RPC details
This returns hex encoded bytes, so remember to hex decode it to get the data back in its original form.
6
Fetch Data from Indexer (Optional)
If you need the data to be stored for a longer time period than the ledger's lifetime of three days, you may want to use an indexer.
Please reach out if you'd like us to set up an indexer on your behalf.
To retrieve data from the indexer, all you need to provide is the slot number at which the blob was finalized. (You can find this value from the upload command above.)
let blobs = blober_client
.get_blobs(slot, blober)
.await?;