This repository contains everything that's needed to start playing with Arbitrum chains: deployment of contracts, customizing and building your nitro node and starting up your chain.
-
Clone the repository
git clone https://github.com/OffchainLabs/chains-playground.git -
Install dependencies
pnpm installgit submodule update --init --recursive --force
Make a copy of the .env.example file and call it .env. Then, make sure you set a private key for the deployer, and the addresses of the final chain owner, batch poster and staker accounts. You can leave the rest of options with their default, or customize any of them.
Chain deployment can be performed only with a parent chain RPC. The script will perform the following operations:
- Deploy the core contracts
- Deploy the TokenBridge
- Transfer ownership to the specified chain owner address
- Show all contracts deployed and chain configuration
Run the following script
pnpm full-deploymentThis script will deploy the parent chain contracts using the specified RPC, and then retryable tickets to send the ownership transferring transactions.
If starting a chain elsewhere note that the node will wait for the contract deployments to reach a finalised state before starting up properly. eg on sepolia ~12 mins. It's ok to start the node during this period, it'll just wait for finalisation.
Once a node is running for the new chain, all retryable tickets execution can be checked with the following script
pnpm verify-deployment## Individual scripts
The full-deployment scripts make use of multiple scripts that perform individual actions
- Deploy core contracts:
pnpm deploy-chain - Deploy TokenBridge:
pnpm deploy-token-bridge - Transfer ownership:
pnpm transfer-ownership
These can be run individually
Once the chain contracts are all deployed, you can run a node for your chain.
Note that you'll need to set the BATCH_POSTER_PRIVATE_KEY and STAKER_PRIVATE_KEY env variables if you're running the batch poster and staker.
First build the node configuration with the following command:
pnpm build-node-configurationThen run your node with:
pnpm start-nodeWhen starting your nodes with pnpm start-node the following containers will start, depending on the mode used:
-
If the
$SPLIT_NODESenv variable is set to false, a singlenitrocontainer will start that runs a nitro node acting as the batch-poster, staker and regular rpc. -
If the
$SPLIT_NODESenv variable is set to true, the following containers will start:batch-poster: the sequencer/batch-poster for your chainstaker: the validator/staker for your chainrpc: a regular RPC node for your chain
-
Additionally, a
das-servercontainer will start if you're running an AnyTrust chain. This container will run a Data Availability Server.
You can manage each individual container with the following commands:
docker compose stop <container>: stops the specified containerdocker compose start <container>: starts the specified containerdocker compose restart <container>: restarts the specified containerdocker compose create <container>: creates the specified container (in case it's been removed)
Setting the env variable ENABLE_BLOCKSCOUT to true, will start the blockscout containers when running start-node.
Blockscout will be available at http://localhost/
The following scripts are also available
This will fund the batch poster and staker accounts with FUNDING_AMOUNT. It will also deposit the same amount to the deployer address on the Arbitrum chain.
pnpm initialize-chainTo clean up all data generated while running the chain, you can run the following command
pnpm cleanIf the parent chain is not supported in the Arbitrum Chain SDK, you can still deploy the RollupCreator and the TokenBridgeCreator and create a chain using those.
Make sure the submodules are up to date
git submodule update --init --force --recursiveBuild the nitro-contracts submodule
pnpm build-nitro-contractsModify the following env variable:
# MAX_DATA_SIZE should be 104857 for L3s and 117964 for L2s
MAX_DATA_SIZE=Run the rollup creator deployer script with:
pnpm deploy-rollup-creatorMake sure the submodules are up to date
git submodule update --init --force --recursiveBuild the token-bridge-contracts submodule
pnpm build-token-bridge-contractsModify the following env variable:
# BASECHAIN_WETH should be set to the WETH address of the parent chain
BASECHAIN_WETH=Run the rollup creator deployer script with:
pnpm deploy-token-bridge-creatorSet the following env variables:
ROLLUPCREATOR_FACTORY_ADDRESS=
WETH_ADDRESS=
# CHAIN_MAX_DATA_SIZE should be 104857 for L3s and 117964 for L2s
CHAIN_MAX_DATA_SIZE=And run the same process as described in Deploy an Arbitrum chain.