How to deploy a Data Availability Server (DAS)
AnyTrust chains rely on an external Data Availability Committee (DAC) to store data and provide it on-demand instead of using its parent chain as the Data Availability (DA) layer. The members of the DAC run a Data Availability Server (DAS) to handle these operations.
In this how-to, you'll learn how to deploy a DAS that exposes:
- An RPC interface that the sequencer uses to store batches of data on the DAS.
- An HTTP REST interface that lets the DAS respond to requests for those batches of data.
For more information related to configuring a DAC, refer to the Introduction.
This how-to assumes that you're familiar with:
- The DAC's role in the AnyTrust protocol. Refer to Inside AnyTrust for a refresher.
- Kubernetes. The examples in this guide use Kubernetes to containerize your DAS.
How does a DAS work?
A Data Availability Server (DAS) allows storage and retrieval of transaction data batches for an AnyTrust chain. It's the software that the members of the DAC run in order to provide the Data Availability service.
DA servers accept time-limited requests to store data batches from the sequencer of an AnyTrust chain, and return a signed certificate promising to store that data during the established time. They also respond to requests to retrieve the data batches.
Configuration options
When setting up a DAS, there are certain options you can configure to suit your infrastructure needs:
Interfaces available in a DAS
There are two main interfaces that can be enabled in a DAS: an RPC interface to store data in the DAS, intended to be used only by the AnyTrust sequencer; and a REST interface that supports only GET operations and is intended for public use.
DA servers listen on two primary interfaces:
- Its RPC interface listens for
das_store
RPC messages coming from the sequencer. Messages are signed by the sequencer, and the DAS checks this signature upon receipt. - Its REST interface respond to HTTP GET requests pointed at
/get-by-hash/<hex encoded data hash>
. This uses the hash of the data batch as a unique identifier, and will always return the same data for a given hash.
Storage options
A DAS can be configured to use one or more of four storage backends:
- AWS S3 bucket
- Files on local disk
- (EXPERIMENTAL) Google Cloud Storage bucket
- (DEPRECATED) Badger database on local disk
The Google Cloud Storage option (set with google-cloud-storage
) is experimental and hasn't been tested thoroughly. It is recommended to not rely solely on this storage option and to use it alongside other storage options.
The local Badger DB storage option (set with local-db-storage
) has been deprecated and should be replaced with the local files storage option (set with local-file-storage
).
A migration tool has been included in Nitro to migrate all data from the local badger db to local files. You can activate it by using the parameter --data-availability.migrate-local-db-to-file-storage
.
If more than one option is selected, store requests must succeed to all of them for it to be considered successful, while retrieve requests only require one of them to succeed.
If there are other storage backends you'd like us to support, send us a message on Discord, or contribute directly to the Nitro repository.
Caching
An in-memory cache can be enabled to avoid needing to access underlying storage for retrieve requests.
Requests sent to the REST interface (to retrieve data from the DAS) always return the same data for a given hash, so the result is cacheable. It also contains a cache-control
header specifying that the object is immutable and to cache it for up to 28 days.
State synchronization
DA servers also have an optional REST aggregator which, when a data batch is not found in cache or storage, requests that batch to other REST servers defined in a list and stores that batch upon receiving it. This is how a DAS that misses storing a batch (the AnyTrust protocol doesn't require all of them to report success in order to post the batch's certificate to the parent chain) can automatically repair gaps in the data it stores, and also how a mirror DAS can sync its data. A public list of REST endpoints is published online, which the DAS can be configured to download and use, and additional endpoints can be specified in the configuration.
How to deploy the DAS
Step 0: Prerequisites
Gather the following information:
- The latest Nitro docker image:
offchainlabs/nitro-node:v3.4.0-d896e9c
- An RPC endpoint for the parent chain. It is recommended to use a third-party provider RPC or run your own node to prevent being rate limited.
- The SequencerInbox contract address in the parent chain.
- If you wish to configure a REST aggregator for your DAS, you'll need the URL where the list of REST endpoints is kept.