Crate data_anchor_api

Source
Expand description

§Data Anchor API

This crate defines the API interfaces used when interacting with the Data Anchor indexer service.

§API

The indexer service exposes data via a JSONRPC server. Here is an overview of the available methods:

§get_blobs

Retrieve a list of blobs for a given slot and blober pubkey. Returns an error if there was a database or RPC failure, and None if the slot has not been completed yet. If the slot is completed but no blobs were uploaded, an empty list will be returned.

§Signature
async fn get_blobs(&self, blober: Pubkey, slot: u64) -> RpcResult<Option<Vec<Vec<u8>>>>;

§get_blobs_by_blober

Retrieve a list of blobs for a given blober pubkey and time range. Returns an error if there was a database or RPC failure, and an empty list if no blobs were found.

§Signature
async fn get_blobs_by_blober(&self, blober: BlobsByBlober) -> RpcResult<Vec<Vec<u8>>>;

Parameters:

pub struct TimeRange {
    pub start: Option<DateTime<Utc>>,
    pub end: Option<DateTime<Utc>>,
}

pub struct BlobsByBlober {
    pub blober: Pubkey,
    #[serde(flatten)]
    pub time_range: TimeRange,
}

Which equals to the following options in JSON:

{
  "blober": "BAugq2PZwXBCw72YTRe93kgw3X6ghB3HfF7eSYBDhTsK"
}
{
  "blober": "BAugq2PZwXBCw72YTRe93kgw3X6ghB3HfF7eSYBDhTsK",
  "start": "2025-06-09T14:35:06.538958843Z"
}
{
  "blober": "BAugq2PZwXBCw72YTRe93kgw3X6ghB3HfF7eSYBDhTsK",
  "start": "2025-06-09T14:30:06.538958843Z",
  "end": "2025-06-09T14:35:06.538958843Z"
}

§get_blobs_by_payer

Retrieve a list of blobs for a given payer pubkey, network ID, and time range. Returns an error if there was a database or RPC failure, and an empty list if no blobs were found.

§Signature
async fn get_blobs_by_payer(&self, payer: BlobsByPayer) -> RpcResult<Vec<Vec<u8>>>;

Parameters:

pub struct BlobsByPayer {
    pub payer: Pubkey,
    pub network_name: String,
    #[serde(flatten)]
    pub time_range: TimeRange,
}

Which equals to the following options in JSON:

{
  "payer": "BAugq2PZwXBCw72YTRe93kgw3X6ghB3HfF7eSYBDhTsK",
  "network_name": "ping"
}
{
  "payer": "BAugq2PZwXBCw72YTRe93kgw3X6ghB3HfF7eSYBDhTsK",
  "network_name": "ping",
  "start": "2025-06-09T14:35:06.538958843Z"
}
{
  "payer": "BAugq2PZwXBCw72YTRe93kgw3X6ghB3HfF7eSYBDhTsK",
  "network_name": "ping",
  "start": "2025-06-09T14:30:06.538958843Z",
  "end": "2025-06-09T14:35:06.538958843Z"
}

§get_proof

Retrieve a proof for a given slot and blober pubkey. Returns an error if there was a database or RPC failure, and None if the slot has not been completed yet.

§Signature
async fn get_proof(&self, blober: Pubkey, slot: u64) -> RpcResult<Option<CompoundProof>>;

§get_proof_for_blob

Retrieve a compound proof that covers a particular blob. Returns an error if there was a database or RPC failure, and None if the blob does not exist.

§Signature
async fn get_proof_for_blob(&self, blob_address: Pubkey) -> RpcResult<Option<CompoundProof>>;

§Usage

To use the indexer API you can either use our pre-built CLI, Rust client, or if calling from any other language, simply create and send JSONRPC requests.

§curl example

curl "<INDEXER-URL>" -XPOST \
    -H 'Content-Type: application/json' \
    --data '{"jsonrpc":"2.0","id":1,"method":"get_blobs","params":["BAugq2PZwXBCw72YTRe93kgw3X6ghB3HfF7eSYBDhTsK",385430344]}'

Structs§

BloberData
A data structure representing a blober’s information, including the blober’s pubkey, the payer’s pubkey, and the network of the blober.
BlobsByBlober
Request parameters for retrieving blobs by a specific blober’s pubkey and a time range.
BlobsByPayer
Request parameters for retrieving blobs by a specific payer’s pubkey, network ID, and a time range.
PubkeyFromStr
A wrapper around a blober’s pubkey, used to identify a blober in RPC calls.
RelevantBloberInstructionWithPubkey
A deserialized relevant blober instruction, containing the blober pubkey and the instruction.
RelevantInstructionWithAccounts
A deserialized relevant instruction, containing the blob and blober pubkeys and the instruction.
TimeRange
A time range with optional start and end times, used for filtering time.
VersionedTransactionWithInnerInstructions

Enums§

CompoundProof
A compound proof that proves whether a blob has been published in a specific slot. See CompoundInclusionProof and CompoundCompletenessProof for more information.
LedgerDataBlobError
Errors that can occur when fetching blob data from the ledger.
RelevantBloberInstruction
Blober instructions that are relevant to the indexer.
RelevantInstruction
A relevant data_anchor_blober instruction extracted from a VersionedTransaction.

Traits§

IndexerRpcClient
Client implementation for the IndexerRpc RPC API.
IndexerRpcServer
Server trait implementation for the IndexerRpc RPC API.

Functions§

deserialize_blober_instructions
Deserialize blober instructions from a transaction, returning a vector of RelevantBloberInstructionWithPubkey.
deserialize_relevant_instructions
Deserialize relevant instructions from a transaction, given the indices of the blob and blober accounts in the transaction.
extract_relevant_instructions
Extract relevant instructions from a list of transactions.
get_account_at_index
Performs the double-lookup required to find an account at a given account index in an instruction. This is required because the accounts are not stored in the instruction directly, but in a separate account list. It is computed as payload.account_keys[instruction.accounts[index]].
get_blob_data_from_instructions
Extracts the blob data from the relevant instructions.