Skip to main content

0G Data Availability (DA): Integration


To submit data to the 0G DA, you must run a DA Client node and the Encoder node. The DA client interfaces with the Encoder for data encoding and the Retriever for data access.

Maximum blob size

Users can submit data blobs up to 32,505,852 bytes in length, which are then processed, encoded, and distributed across a network of DA nodes. The system employs a sophisticated data processing flow that includes padding, matrix formation, redundant encoding, and signature aggregation.

Fee Market

As the DA user, you pay a fee which is the (BLOB_PRICE) when submitting DA blob data.

Submitting Data

See example here https://github.com/0glabs/0g-da-example-rust/blob/main/src/disperser.proto

Hardware Requirements

The following table outlines the hardware requirements for different types of DA Client nodes:

Node TypeMemoryCPUDiskBandwidthAdditional Notes
DA Client8 GB2 cores-100 MBpsFor Download / Upload
DA Encoder----NVIDIA Drivers: 12.04 on the RTX 4090*
DA Retriever8 GB2 cores-100 MBpsFor Download / Upload

Standing up DA Client, Encoder, Retriever

DA Client Node Installation

1. Clone the DA Client Node Repo:

git clone https://github.com/0glabs/0g-da-client.git

2. Build the Docker Image:

cd 0g-da-client
docker build -t 0g-da-client -f combined.Dockerfile .

3. Set Environment Variables:

Create a file named envfile.env with the following content. Be sure you paste in your private key.

# envfile.env
COMBINED_SERVER_CHAIN_RPC=https://evmrpc-testnet.0g.ai
COMBINED_SERVER_PRIVATE_KEY=YOUR_PRIVATE_KEY
ENTRANCE_CONTRACT_ADDR=0x857C0A28A8634614BB2C96039Cf4a20AFF709Aa9

COMBINED_SERVER_RECEIPT_POLLING_ROUNDS=180
COMBINED_SERVER_RECEIPT_POLLING_INTERVAL=1s
COMBINED_SERVER_TX_GAS_LIMIT=2000000
COMBINED_SERVER_USE_MEMORY_DB=true
COMBINED_SERVER_KV_DB_PATH=/runtime/
COMBINED_SERVER_TimeToExpire=2592000
DISPERSER_SERVER_GRPC_PORT=51001
BATCHER_DASIGNERS_CONTRACT_ADDRESS=0x0000000000000000000000000000000000001000
BATCHER_FINALIZER_INTERVAL=20s
BATCHER_CONFIRMER_NUM=3
BATCHER_MAX_NUM_RETRIES_PER_BLOB=3
BATCHER_FINALIZED_BLOCK_COUNT=50
BATCHER_BATCH_SIZE_LIMIT=500
BATCHER_ENCODING_INTERVAL=3s
BATCHER_ENCODING_REQUEST_QUEUE_SIZE=1
BATCHER_PULL_INTERVAL=10s
BATCHER_SIGNING_INTERVAL=3s
BATCHER_SIGNED_PULL_INTERVAL=20s
BATCHER_EXPIRATION_POLL_INTERVAL=3600
BATCHER_ENCODER_ADDRESS=DA_ENCODER_SERVER
BATCHER_ENCODING_TIMEOUT=300s
BATCHER_SIGNING_TIMEOUT=60s
BATCHER_CHAIN_READ_TIMEOUT=12s
BATCHER_CHAIN_WRITE_TIMEOUT=13s

4. Run the Docker Node:

docker run -d --env-file envfile.env --name 0g-da-client -v ./run:/runtime -p 51001:51001 0g-da-client combined 

Configuration

FieldDescription
--chain.rpcJSON RPC node endpoint for the blockchain network.
--chain.private-keyHex-encoded signer private key.
--chain.receipt-wait-roundsMaximum retries to wait for transaction receipt.
--chain.receipt-wait-intervalInterval between retries when waiting for transaction receipt.
--chain.gas-limitTransaction gas limit.
--combined-server.use-memory-dbWhether to use mem-db for blob storage.
--combined-server.storage.kv-db-pathPath for level db.
--combined-server.storage.time-to-expireExpiration duration for blobs in level db.
--combined-server.log.level-fileFile log level.
--combined-server.log.level-stdStandard output log level.
--combined-server.log.pathLog file path.
--disperser-server.grpc-portServer listening port.
--disperser-server.retriever-addressGRPC host for retriever.
--batcher.da-entrance-contractHex-encoded da-entrance contract address.
--batcher.da-signers-contractHex-encoded da-signers contract address.
--batcher.finalizer-intervalInterval for finalizing operations.
--batcher.finalized-block-countDefault number of blocks between finalized block and latest block.
--batcher.confirmer-numNumber of Confirmer threads.
--batcher.max-num-retries-for-signNumber of retries before signing fails.
--batcher.batch-size-limitMaximum batch size in MiB.
--batcher.encoding-request-queue-sizeSize of the encoding request queue.
--batcher.encoding-intervalInterval between blob encoding requests.
--batcher.pull-intervalInterval for pulling from the encoded queue.
--batcher.signing-intervalInterval between slice signing requests.
--batcher.signed-pull-intervalInterval for pulling from the signed queue.
--encoder-socketGRPC host of the encoder.
--encoding-timeoutTotal time to wait for a response from encoder.
--signing-timeoutTotal time to wait for a response from signer.