Skip to Content
Avail Nexus is now live! Check out our docs to get started.

Deploy Arbitrum Orbit with Avail DA

This guide follows the deployment of an Arbitrum Orbit chain (L3) with Arbitrum Sepolia (L2) as the base chain. You can follow the same steps with any other supported chains with the relevant contract addresses.

This guide is based on Arbitrum Orbit Quickstart 

Prerequisites

Docker

Avail

Arbitrum Sepolia

Download avail-nitro-node docker image

Step-1: Download the avail-nitro-node  image from docker hub

docker pull availj/avail-nitro-node:v2.2.1-upstream-v3.2.1

Deploy Rollup Contracts

Step-1: Clone the arbitrum-orbit-sdk  with AvailDA

git clone https://github.com/availproject/arbitrum-orbit-sdk.git git checkout avail-develop-upstream-v0.20.1 cd arbitrum-orbit-sdk

Install and build

npm i && npm run build

Step-2: Create .env file

Go to examples/create-avail-rollup-eth and create a copy of .env.example as .env file inside.

cd examples/create-avail-rollup-eth cp env.example .env

then edit the .env file for the following:

  • Set EVM account keys of settlement layer

    DEPLOYER_PRIVATE_KEY :- Orbit rollup owner, Rollup contract deployer BATCH_POSTER_PRIVATE_KEY -: Batch poster VALIDATOR_PRIVATE_KEY :- Validator
  • Set avail account info for DA submissions

    AVAIL_ADDR_SEED= AVAIL_APP_ID=
  • Set Fallback S3, if you want to enable S3 storage as a fallback for AvailDA (its an optional feature)

    • Fill these required details where make FALLBACKS3_ENABLE = true
    FALLBACKS3_ENABLE=true FALLBACKS3_ACCESS_KEY= FALLBACKS3_SECRET_KEY= FALLBACKS3_REGION= FALLBACKS3_OBJECT_PREFIX= FALLBACKS3_BUCKET=
  • Set parent chain rpc URL (other than infura will also works)

    PARENT_CHAIN_RPC=https://arbitrum-sepolia.infura.io/v3/YOUR_API_KEY

Step-3: Rollup contract deployment

  • Run avail orbit rollup deployment command

    npm run deploy-avail-orbit-rollup
  • Here is a sample response of logs that you may see:


    nitro-stack

  • You will get to see two files added nodeConfig.json and orbitSetupScriptConfig.json, which will be need in the next step to spin and set up Avail Orbit Rollup.

Before proceeding, let’s briefly review what just happened:

  1. You submitted a deployment transaction to an Orbit “factory” smart contract on the Arbitrum Sepolia testnet, the public L2 chain that your local Orbit chain will settle transactions to.
  2. This Orbit smart contract then initialized your Orbit chain’s base contracts with the values that you specified in the previous step, and deployed these base contracts to the Arbitrum Sepolia testnet.

Your Orbit chain’s base contracts are responsible for facilitating the exchange of information between your chain’s node(s) and its base chain’s nodes. This includes the batch posting of transactions from your Orbit chain to its base chain, the staking of tokens by your Orbit chain’s validators the challenge mechanism, bridging mechanisms, and more.

Spin up the avail orbit rollup chain using orbit-setup-script

Step-1: Download orbit-setup-script 

git clone https://github.com/availproject/orbit-setup-script.git cd orbit-setup-script

Step-2 :- Run your chain

Add the nodeConfig.json and orbitSetupScriptConfig.json in ./config , that you get after completing Deploy Rollup contracts

cd orbit-setup-script docker-compose up -d

A Nitro node and BlockScout explorer instance will be started. Visit http://localhost:4000/ to access your BlockScout explorer instance - this will allow you to view your chain’s transactions and blocks, which can be useful for debugging.

Step-3: Final Setup - Token bridge deployment

A Hardhat script that handles the following tasks:

  1. Fund the batch-poster and validator (staker) accounts on your underlying L2 chain.
  2. Deposit ETH into your account on the chain using your chain’s newly deployed bridge.
  3. Deploy your Token Bridge contracts on both L2 and local Orbit chains.
  4. Configure parameters on the chain.

To run this script, issue the following command from the root of the orbit-setup-script repository, replacing OxYourPrivateKey with the private key of the Owner account you used to deploy your chain’s contracts, and replacing http://localhost:8449 with the RPC URL of your chain’s node.

PRIVATE_KEY="0xYourPrivateKey" L2_RPC_URL="https://sepolia-rollup.arbitrum.io/rpc" L3_RPC_URL="http://localhost:8449" yarn run setup

Hurray!

Congratulations, Your local Orbit chain with Avail DA is now running.

Appendix A:- Use Arbitrum bridge for your local chain

After completing final setup, you can find two files network.json and outputInfo.json. Add in your avail orbit rollup testnet to the bridge . This will only be for local testing. Paste outputInfo.json configuration in setting section of bridge

Appendix B: Logging

Run this command in the root directory of your orbit setup script repo to view your chain’s logs:

docker-compose logs -f nitro

Appendix C: Depositing ETH/native token

If you need to deposit more ETH (or native tokens) into your Orbit chain account, run this command on the base directory of the setup script, replacing 0xYourPrivateKey with the private key of the originating account, and <AMOUNT> with the amount to send:

Using Arbitrum Sepolia:

PRIVATE_KEY="0xYourPrivateKey" L2_RPC_URL="https://sepolia-rollup.arbitrum.io/rpc" L3_RPC_URL="http://localhost:8449" AMOUNT="<AMOUNT>" yarn run deposit

Appendix D: Refunding (For testing environments)

Once you’re done with your local Orbit chain and want to refund any remaining balance from the batch poster and validator wallets, you can use the refund script by running:

PRIVATE_KEY="0xYourPrivateKey" L2_RPC_URL="<https://sepolia-rollup.arbitrum.io/rpc>" TARGET_ADDRESS="0xYourTargetAddress" yarn run refund

Make sure to replace "0xYourPrivateKey" with the private key of the wallet you used to deploy the rollup contracts, and "0xYourTargetAddress" with the address where you want to receive the refunded funds.

This will transfer any remaining balance from the batch poster and validator wallets to the specified target address.

Appendix E: Troubleshooting

You may see error getting latest batch count in your node’s output logs (from Appendix B). This is usually safe to ignore. It’s usually displayed when your Orbit chain’s base contract deployment isn’t yet finalized on the L1 chain. This finalization can take 15-20 minutes, but don’t worry - the deployment doesn’t need to be L1-finalized in order for your chain to function properly.

Learn more about customizing and using your Orbit chain from the Arbitrum Orbit Docs .

Last updated on