How to deploy an AnyTrust chain using the Orbit SDK
It is highly recommended to work with a Rollup-as-a-Service (RaaS) provider if you intend to deploy a production chain. You can find a list of RaaS providers here.
Creating a new Orbit chain involves deploying a set of contracts on the parent chain of your chain. This page explains how to deploy an AnyTrust Orbit chain using the Orbit SDK. See the Overview for an introduction to the process of creating and configuring an Orbit chain.
Before reading this guide, we recommend that you're familiar with the general process for creating new chains explained in the introduction and the first section of How to deploy a Rollup chain.
About AnyTrust
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. You can learn more about the AnyTrust protocol in this page.
How to create a new AnyTrust chain using the Orbit SDK
AnyTrust chains' deployment process is very similar to that of Rollup chains, but with some differences that we'll discuss in this guide.
The Orbit SDK includes an example script for creating an Orbit chain. We recommend that you first understand the process described in this section and then check the create-rollup-eth script.
Here are the steps involved in the deployment process:
- Create the chain configuration object
- Deploy the AnyTrust Orbit chain
- Understand the results obtained
- Set the DAC keyset in the SequencerInbox
1. Create the chain configuration object
The How to deploy a Rollup chain guide explains the configuration structure that we need to craft and send to the RollupCreator
contract when we wish to create a new chain. We recommend becoming familiar with that section before continuing.
The only difference between both types of chain is that the AnyTrust chain sets the arbitrum.DataAvailabilityCommittee
flag to true
, to indicate that the chain will use a Data Availability Committee (DAC).
Below is an example of how to use createRollupPrepareDeploymentParamsConfig
and the prepareChainConfig
methods to craft the needed configuration:
import { createPublicClient, http } from 'viem';
import { createRollupPrepareDeploymentParamsConfig } from '@arbitrum/orbit-sdk';
const parentChainPublicClient = createPublicClient({
chain: parentChain,
transport: http(),
});
const createRollupConfig = createRollupPrepareDeploymentParamsConfig(parentChainPublicClient, {
chainId: 123_456,
owner: 0x123...890,
chainConfig: prepareChainConfig({
chainId: 123_456,
arbitrum: {
InitialChainOwner: 0x123...890,
DataAvailabilityCommittee: true,
},
}),
});
2. Deploy the AnyTrust Orbit chain
With the crafted configuration, we can call the createRollup
method, which will send the transaction to the RollupCreator
contract and wait until it is executed.
Below is an example of how to use createRollup
using the createRollupConfig
crafted in the previous step:
import { createPublicClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { createRollup } from '@arbitrum/orbit-sdk';
const deployer = privateKeyToAccount(deployerPrivateKey);
const parentChainPublicClient = createPublicClient({
chain: parentChain,
transport: http(),
});
const createRollupResults = await createRollup({
params: {
config: createRollupConfig,
batchPosters: [batchPoster],
validators: [validator],
},
account: deployer,
parentChainPublicClient,
});
3. Understand the returned data
After calling createRollup
, an object of type CreateRollupResults
is returned with the following fields:
type CreateRollupResults = {
// The transaction sent
transaction: CreateRollupTransaction;
// The transaction receipt
transactionReceipt: CreateRollupTransactionReceipt;
// An object with the addresses of the contracts created
coreContracts: CoreContracts;
};
4. Set the DAC keyset in the SequencerInbox
The final step is to set up the keyset of your Data Availability Committee (DAC) on the SequencerInbox contract. This process involves setting up the Data Availability Servers (DAS) and generating the keyset with all DAS' keys. See How to configure a DAC to learn more about setting up a DAC.
The Orbit SDK includes an example script for setting up the keyset in the SequencerInbox. We recommend that you first understand the process described in this section and then check the set-valid-keyset script.
The Orbit SDK includes a setValidKeyset
function to help set the keyset in the SequencerInbox. From the last step, you can gather the sequencerInbox
and upgradeExecutor
addresses and pass them to the function along with the keyset
, a public client of the parent chain, and a wallet client of an account that has executor privileges in the UpgradeExecutor
contract (to learn more about UpgradeExecutor
, see Ownership structure and access control).
Below is an example of how to use setValidKeyset
using the parameters described above:
import { createPublicClient, createWalletClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { setValidKeyset } from '@arbitrum/orbit-sdk';
const deployer = privateKeyToAccount(deployerPrivateKey);
const parentChainPublicClient = createPublicClient({
chain: parentChain,
transport: http(),
});
const deployerWalletClient = createWalletClient({
account: deployer,
chain: parentChain,
transport: http(),
});
const transactionReceipt = await setValidKeyset({
coreContracts: {
upgradeExecutor: '0xUpgradeExecutor',
sequencerInbox: '0xSequencerInbox',
},
keyset: generatedKeyset,
publicClient: parentChainPublicClient,
walletClient: deployerWalletClient,
});
This function will send the transaction and wait for its execution, returning the transaction receipt.
5. Next step
Once the chain's contracts are created, you can move to the next step: configure your Orbit chain's node.