TypeScript SDK for building Arbitrum chains.
Make sure you are using Node.js v18 or greater.
pnpm add @arbitrum/chain-sdk viem@^1.20.0The SDK ships a CLI that exposes its functions, workflows, and contract calls as subcommands. Each command takes a single JSON argument and prints a JSON result. Useful from shell scripts, CI, or any non-TypeScript caller.
Install it globally from npm to put arbitrum-chain-sdk on your PATH:
npm i -g @arbitrum/chain-sdk
arbitrum-chain-sdk <command> '<json>'Or run it without installing (append @<version> to pin a release):
npx @arbitrum/chain-sdk <command> '<json>'Or pull the Docker image for a pinned, reproducible environment:
docker pull offchainlabs/arbitrum-chain-sdk:latest
docker run --rm offchainlabs/arbitrum-chain-sdk:latest <command> '<json>'The examples below use the installed arbitrum-chain-sdk command. Under Docker, replace arbitrum-chain-sdk with docker run --rm offchainlabs/arbitrum-chain-sdk:latest.
arbitrum-chain-sdk <command> '<json>' [-o <path>]
arbitrum-chain-sdk <command> --schema [-o <path>]
The JSON argument can be supplied three ways:
- As a literal:
arbitrum-chain-sdk getValidators '{"rpcUrl":"...","chainId":42161,"rollup":"0x..."}' - From a file:
arbitrum-chain-sdk getValidators @input.json - From stdin:
cat input.json | arbitrum-chain-sdk getValidators -
JSON with comments and trailing commas (JSONC) is accepted.
Under Docker the file and stdin forms need extra flags: mount the working directory (-v "$(pwd):/work" -w /work) for @file, and add -i for stdin.
Flags:
-o <path>β write the result to a file instead of stdout.--schemaβ print the input JSON Schema for the command and exit.
Run the CLI with no command to print the full command list:
arbitrum-chain-sdkCommands fall into three groups:
- SDK functions β direct wrappers around SDK exports (
getValidators,createRollup, β¦). - Workflows β multi-step orchestrations (
deployNewChain,deployFullChain,transferOwnership,initializeTokenBridge). - Contract calls β generic read/write/encode against a contract ABI (
ArbOwner,Rollup@v3.2,Inbox, β¦). Versioned entries sit alongside an unversioned alias pointing at the current default.
To see the input shape for a command:
arbitrum-chain-sdk <command> --schema- stdout β the JSON result.
BigIntvalues are serialized as decimal strings. - stderr β SDK progress logs, validation errors, and stack traces.
- Exit code β
0on success,1on any parse, validation, or runtime error.
Build a Nitro chainConfig for a new Arbitrum chain. This is the first call in the deploy-a-new-chain flow β given a chain ID and the chain's initial owner, the SDK fills in the full config:
arbitrum-chain-sdk prepareChainConfig '{
"chainId": 12345,
"arbitrum": {
"InitialChainOwner": "0x0000000000000000000000000000000000000001"
}
}'Clone the branch release of nitro-testnode, and run the testnode using the following arguments:
./test-node.bash --init --tokenbridge --l3node --l3-fee-token --l3-token-bridgeThen, run the integration tests:
pnpm test:integrationSee examples.