DA Client API

Table of Contents

Top

disperser.proto

BatchHeader

FieldTypeLabelDescription

batch_root

The root of the merkle tree with the hashes of blob headers as leaves.

quorum_numbers

All quorums associated with blobs in this batch.

quorum_signed_percentages

The percentage of stake that has signed for this batch. The quorum_signed_percentages[i] is percentage for the quorum_numbers[i].

reference_block_number

The Ethereum block number at which the batch was created. The Disperser will encode and disperse the blobs based on the onchain info (e.g. operator stakes) at this block number.

BatchMetadata

FieldTypeLabelDescription

batch_header

signatory_record_hash

The hash of all public keys of the operators that did not sign the batch.

fee

The fee payment paid by users for dispersing this batch. It's the bytes representation of a big.Int value.

confirmation_block_number

The Ethereum block number at which the batch is confirmed onchain.

batch_header_hash

This is the hash of the ReducedBatchHeader defined onchain, see: https://github.com/0glabs/0g-data-avail/blob/master/contracts/src/interfaces/IZGDAServiceManager.sol#L43 The is the message that the operators will sign their signatures on.

BlobHeader

FieldTypeLabelDescription

commitment_root

Merkle root of KZG commitments of blob.

data_length

The length of the blob in symbols (each symbol is 31 bytes).

blob_quorum_params

repeated

The params of the quorums that this blob participates in.

data_root

The data merkle root

epoch

Signers epoch

quorum_id

Signers quorum id

BlobInfo

BlobInfo contains information needed to confirm the blob against the ZGDA contracts

FieldTypeLabelDescription

blob_header

blob_verification_proof

BlobQuorumParam

FieldTypeLabelDescription

quorum_number

The ID of the quorum.

adversary_threshold_percentage

Same as SecurityParams.adversary_threshold.

quorum_threshold_percentage

Same as SecurityParams.quorum_threshold.

chunk_length

The length of each chunk.

BlobStatusReply

FieldTypeLabelDescription

status

The status of the blob.

info

The blob info needed for clients to confirm the blob against the ZGDA contracts.

BlobStatusRequest

BlobStatusRequest is used to query the status of a blob.

FieldTypeLabelDescription

request_id

BlobVerificationProof

FieldTypeLabelDescription

batch_id

batch_id is an incremental ID assigned to a batch by ZGDAServiceManager

blob_index

The index of the blob in the batch (which is logically an ordered list of blobs).

batch_metadata

inclusion_proof

inclusion_proof is a merkle proof for a blob header's inclusion in a batch

quorum_indexes

indexes of quorums in BatchHeader.quorum_numbers that match the quorums in BlobHeader.blob_quorum_params Ex. BlobHeader.blob_quorum_params = [ { quorum_number = 0, ... }, { quorum_number = 3, ... }, { quorum_number = 5, ... }, ] BatchHeader.quorum_numbers = [0, 5, 3] => 0x000503 Then, quorum_indexes = [0, 2, 1] => 0x000201

DisperseBlobReply

FieldTypeLabelDescription

result

The status of the blob associated with the request_id.

request_id

The request ID generated by the disperser. Once a request is accepted (although not processed), a unique request ID will be generated. Two different DisperseBlobRequests (determined by the hash of the DisperseBlobRequest) will have different IDs, and the same DisperseBlobRequest sent repeatedly at different times will also have different IDs. The client should use this ID to query the processing status of the request (via the GetBlobStatus API).

DisperseBlobRequest

FieldTypeLabelDescription

data

The data to be dispersed. The size of data must be <= 512KiB.

security_params

repeated

Security parameters allowing clients to customize the safety (via adversary threshold) and liveness (via quorum threshold). Clients can define one SecurityParams per quorum, and specify multiple quorums. The disperser will ensure that the encoded blobs for each quorum are all processed within the same batch.

target_row_num

The number of rows that encoded blob split into. The number will be aligned to the next power of 2 and be bounded by blob size.

RetrieveBlobReply

RetrieveBlobReply contains the retrieved blob data

FieldTypeLabelDescription

data

RetrieveBlobRequest

RetrieveBlobRequest contains parameters to retrieve the blob.

FieldTypeLabelDescription

batch_header_hash

blob_index

SecurityParams

SecurityParams contains the security parameters for a given quorum.

FieldTypeLabelDescription

quorum_id

The ID of the quorum. The quorum must be already registered on EigenLayer. The ID must be in range [0, 255].

adversary_threshold

The max percentage of stake within the quorum that can be held by or delegated to adversarial operators.

Clients use this to customize the trust assumption (safety).

Requires: 1 <= adversary_threshold < 100 | | quorum_threshold | uint32 | | The min percentage of stake that must attest in order to consider the dispersal is successful.

Clients use this to customize liveness requirement. The higher this number, the more operators may need to be up for attesting the blob, so the chance the dispersal request to fail may be higher (liveness for dispersal).

Requires: 1 <= quorum_threshld <= 100 quorum_threshld > adversary_threshold + 10.

Note: The adversary_threshold and quorum_threshold will directly influence the cost of encoding for the blob to be dispersed, roughly by a factor of 100 / (quorum_threshold - adversary_threshold). See the spec for more details: https://github.com/0glabs/0g-data-avail/blob/master/docs/spec/protocol-modules/storage/overview.md Currently it's required that the difference must be at least 10. |

BlobStatus

NameNumberDescription

UNKNOWN

0

PROCESSING

1

PROCESSING means that the blob is currently being processed by the disperser

CONFIRMED

2

CONFIRMED means that the blob has been dispersed to DA Nodes and the dispersed batch containing the blob has been confirmed onchain

FAILED

3

FAILED means that the blob has failed permanently (for reasons other than insufficient signatures, which is a separate state)

FINALIZED

4

FINALIZED means that the block containing the blob's confirmation transaction has been finalized on Ethereum

INSUFFICIENT_SIGNATURES

5

INSUFFICIENT_SIGNATURES means that the quorum threshold for the blob was not met for at least one quorum.

Disperser

Disperser defines the public APIs for dispersing blobs.

Method NameRequest TypeResponse TypeDescription

DisperseBlob

This API accepts blob to disperse from clients. This executes the dispersal async, i.e. it returns once the request is accepted. The client could use GetBlobStatus() API to poll the the processing status of the blob.

GetBlobStatus

This API is meant to be polled for the blob status.

RetrieveBlob

This retrieves the requested blob from the Disperser's backend. This is a more efficient way to retrieve blobs than directly retrieving from the DA Nodes (see detail about this approach in api/proto/retriever/retriever.proto). The blob should have been initially dispersed via this Disperser service for this API to work.

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby

double

double

double

float

float64

double

float

Float

float

float

float

float

float32

float

float

Float

int32

Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.

int32

int

int

int32

int

integer

Bignum or Fixnum (as required)

int64

Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.

int64

long

int/long

int64

long

integer/string

Bignum

uint32

Uses variable-length encoding.

uint32

int

int/long

uint32

uint

integer

Bignum or Fixnum (as required)

uint64

Uses variable-length encoding.

uint64

long

int/long

uint64

ulong

integer/string

Bignum or Fixnum (as required)

sint32

Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.

int32

int

int

int32

int

integer

Bignum or Fixnum (as required)

sint64

Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.

int64

long

int/long

int64

long

integer/string

Bignum

fixed32

Always four bytes. More efficient than uint32 if values are often greater than 2^28.

uint32

int

int

uint32

uint

integer

Bignum or Fixnum (as required)

fixed64

Always eight bytes. More efficient than uint64 if values are often greater than 2^56.

uint64

long

int/long

uint64

ulong

integer/string

Bignum

sfixed32

Always four bytes.

int32

int

int

int32

int

integer

Bignum or Fixnum (as required)

sfixed64

Always eight bytes.

int64

long

int/long

int64

long

integer/string

Bignum

bool

bool

boolean

boolean

bool

bool

boolean

TrueClass/FalseClass

string

A string must always contain UTF-8 encoded or 7-bit ASCII text.

string

String

str/unicode

string

string

string

String (UTF-8)

bytes

May contain any arbitrary sequence of bytes.

string

ByteString

str

[]byte

ByteString

string

String (ASCII-8BIT)

Last updated