Skip to main content

How to Deploy an AnyTrust chain using the Orbit SDK

This section explains how to initiate an AnyTrust Orbit chain using Arbitrum's Orbit SDK.

UNDER CONSTRUCTION

This document is under construction and may change significantly as we incorporate style guidance and feedback from readers. Feel free to request specific clarifications by clicking the Request an update button at the top of this document.

info

See the "set-valid-keyset" example in the Orbit SDK repository for additional guidance.

About AnyTrust Orbit

AnyTrust chains implement the Arbitrum AnyTrust protocol, an alternative to the Arbitrum Rollup protocol. AnyTrust reduces transaction fees by introducing a minor trust assumption in the form of a permissioned set of parties responsible for managing data availability. For an overview of Orbit chain types, please refer to the Orbit SDK introduction.

Deployment steps

The deployment process of AnyTrust chains is very similar to that of Rollup chains, but with some differences that we'll discuss in this guide.

Here are the steps involved in the deployment process:

  1. Setting up the chain parameters
  2. Deploying your AnyTrust chain
  3. Getting the AnyTrust Orbit chain information after deployment
  4. Setting valid keyset on parent chain

The deployment of an AnyTrust Orbit chain involves defining and setting up the Data Availability Committee (DAC) keyset. This keyset includes keys from the appointed members of the DAC. They are required to ensure the chain's data availability and integrity. Once you have selected your committee members and gathered their keys, the Orbit SDK helps you configure these keys into a keyset. This keyset is then embedded into the chain, serving as a verification mechanism.

Let's go through each deployment step:

1. Setting up the chain parameters

Similarly to the Rollup chain, you'll need to prepare the AnyTrust chain configuration, including the core contracts and operational parameters that govern the chain's functionality, focusing on parameters specific to AnyTrust chains.

struct Config {
uint64 confirmPeriodBlocks;
uint64 extraChallengeTimeBlocks;
address stakeToken;
uint256 baseStake;
bytes32 wasmModuleRoot;
address owner;
address loserStakeEscrow;
uint256 chainId;
string chainConfig;
uint64 genesisBlockNum;
ISequencerInbox.MaxTimeVariation sequencerInboxMaxTimeVariation;
}

You can create the chainConfig parameter within the Config using prepareChainConfig. You can find more details on that function here.

import { prepareChainConfig } from '@arbitrum/orbit-sdk';

const chainConfig = prepareChainConfig({
chainId: 123_456,
arbitrum: {
InitialChainOwner: deployer,
DataAvailabilityCommittee: true,
},
});

Other than the required chainId and arbitrum.InitialChainOwner params, arbitrum.DataAvailabilityCommittee needs to be set to true for AnyTrust.

2. Deploying your AnyTrust chain

After configuring your chain with the createRollupPrepareDeploymentParamsConfig API, the next step is to use the createRollupPrepareTransactionRequest API. This API is designed to take the parameters defined in the RollupDeploymentParams, along with the configuration generated by the createRollupPrepareDeploymentParamsConfig API, to prepare a transaction request. This request is then used to invoke the createRollup function of the RollupCreator contract, which effectively deploys and initializes the core contracts of your AnyTrust Orbit chain.

For instance, to deploy using the Orbit SDK with a Config equal to config, a single batch poster in [batchPoster], and a single validator in [validator], the process would look like this:

import { createRollupPrepareTransactionRequest } from '@arbitrum/orbit-sdk';

const request = await createRollupPrepareTransactionRequest({
params: {
config,
batchPosters: [batchPoster],
validators: [validator],
},
account: deployer_address,
publicClient,
});

After creating the raw transaction, you can sign and broadcast it to the network.

3. Getting the AnyTrust Orbit chain information after deployment

To extract detailed information about your AnyTrust Orbit chain post-deployment, you can use the same API and steps as you would for a Rollup Orbit chain. Here's a reminder of the example:

import { createRollupPrepareTransactionReceipt } from '@arbitrum/orbit-sdk';

const data = createRollupPrepareTransactionReceipt(txReceipt);

In this example, txReceipt refers to the transaction receipt you received after deploying the AnyTrust chain. By inputting this receipt into the createRollupPrepareTransactionReceipt function, you can access comprehensive data about your deployment, including details about the core contracts and configuration settings.

4. Setting valid keyset on parent chain

The final step is to set up a valid keyset for your Data Availability Committee (DAC) on the parent chain. See How to configure a DAC for instructions.

Once created, your keyset needs to be established on your Orbit chain's SequencerInbox contract on the parent chain. To facilitate this, we provide an API in Orbit SDK named setValidKeysetPrepareTransactionRequest. This API requires specific information you can gather at step three. This includes the upgradeExecutor and sequencerInbox addresses of your Orbit chain, the generated keyset for your committee, and the owner's account.

Here's an example of how you can use the Orbit SDK to write your keyset:

const txRequest = await setValidKeysetPrepareTransactionRequest({
coreContracts: {
upgradeExecutor: 'upgradeExecutor_address',
sequencerInbox: 'sequencerInbox_address',
},
keyset,
account: deployer.address,
publicClient: parentChainPublicClient,
});

In this example, upgradeExecutor_address and sequencerInbox_address are placeholders for the Orbit chain's contract addresses. keyset is the keyset you generated for your committee, and deployer.address refers to the owner's account address.

Once you've created the transaction request using the above API, the next step is to sign and send the transaction. This transaction writes the keyset to the parent chain, enabling it to recognize and verify the valid keyset for your AnyTrust Orbit chain.