Installing Arbitrum-One in the MIPs program

Olga L
4 min readApr 26, 2023

If you installed the indexer stack by Stake🦑Squid build docker, then make the appropriate changes to the following files:

.env add network name and address of your arbitrum-one node CHAIN_1_NAME=”arbitrum-one”

CHAIN_1_RPC=”http://ip:9657"

in config.tmpl add a block line, for example if we had one network and we need to add the second one, then [chains.${CHAIN_0_NAME}]…, copy the whole block and change 0 to 1 everywhere, save changes

[store]
[store.primary]
connection = "postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:5432/${GRAPH_NODE_DB_NAME}?host=/var/run/postgresql"
pool_size = 10
[chains]
ingestor = "index_node_0"

[chains.${CHAIN_0_NAME}]
shard = "primary"
provider = [ { label = "${CHAIN_0_NAME}", url = "${CHAIN_0_RPC}", features = ["archive", "traces"] } ]

[chains.${CHAIN_1_NAME}]
shard = "primary"
provider = [ { label = "${CHAIN_1_NAME}", url = "${CHAIN_1_RPC}", features = ["archive", "traces"] } ]

[deployment]
[[deployment.rule]]
indexers = [ "index_node_0" ]

[general]
query = "query_node_0"

Restart the docker with the command bash start-all — force-recreate

Install the Arbitrum-One node

Install dependencies

sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y

sudo apt install -y git docker.io docker-compose aria2 clang cmake make \
librocksdb-dev libboost-all-dev pkg-config libusb-1.0-0-dev \
python3 python3-pip gperf libgoogle-perftools-dev autoconf \
automake libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev \
liblz4-dev libzstd-dev libtool libudev-dev libssl-dev \
libmpfr-dev libgmp-dev clang-format dtrx
# Add to PATH
echo "export PATH=$PATH:/usr/local/go/bin:/root/.local/bin" >> /root/.bashrc
source /root/.bashrc

Install GO You can see the current version here https://go.dev/doc/install

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version

Install nvm, npm and yarn

# nvm
wget -qO- <https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh> | bash
source /root/.bashrc

# npm and yarn:
nvm install 16.0.0 && npm install --global yarn
source /root/.bashrc

# Check installed:
nvm -v
npm -v
yarn -v

Arbitrum Nitro

# Compile the Nitro binary
git clone --recurse-submodules <https://github.com/OffchainLabs/nitro/>
cd nitro
docker build -t nitro .
# Copy the Nitro binary to host
mkdir -p /root/nitro/build/bin
docker cp $(docker run -it -d nitro):/usr/local/bin/nitro /root/nitro/build/bin/
# verify that the binary works
/root/nitro/build/bin/nitro -h
# Download Nitro snapshot
mkdir -p /root/.local/share/nitro/datadir/nitro
cd /root/.local/share/nitro/datadir/nitro
aria2c --file-allocation=none -c -x 10 -s 10 <https://snapshot.arbitrum.io/mainnet/nitro.tar>
# Extract & Remove the tar
dtrx -f nitro.tar
rm nitro.tar

Create the Systemd files for Nitro

nano /etc/systemd/system/nitro.service

# EDIT --l1.url=http://ip:port with your Ethereum Mainnet RPC URL
[Unit]
Description=Arbitrum Nitro Service
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=3

[Service]
Type=simple
Restart=on-failure
RestartSec=5
TimeoutSec=900
User=root
Nice=0
LimitNOFILE=200000
WorkingDirectory=/root/nitro
ExecStart=/root/nitro/build/bin/nitro \
--node.caching.archive \
--persistent.chain=/root/.local/share/nitro/datadir/ \
--persistent.global-config=/root/.local/share/nitro/ \
--l1.url=http://ip:port \
--l2.chain-id=42161 \
--http.api=net,web3,eth,debug \
--http.corsdomain=* \
--http.addr=0.0.0.0 \
--http.port=9657 \
--node.rpc.classic-redirect=http://0.0.0.0:9656 \
--http.vhosts=* \
--log-level=3

KillSignal=SIGHUP

[Install]
WantedBy=multi-user.target

Run Nitro

systemctl daemon-reload
systemctl restart nitro

# Viewing Logs
journalctl -fu nitro

Arbitrum Classic

Compile Arbitrum Classic binary from source

git clone --recurse-submodules <https://github.com/OffchainLabs/arbitrum>
cd arbitrum
yarn
yarn install:deps

cp /usr/include/openssl/opensslv.h /usr/include/openssl/opensslv.h.backup
nano /usr/include/openssl/opensslv.h
------------------
# replace
# define OPENSSL_VERSION_NUMBER_LOCAL \\\\
# ( (OPENSSL_VERSION_MAJOR<<28) \\\\
# |(OPENSSL_VERSION_MINOR<<20) \\\\
# |(OPENSSL_VERSION_PATCH<<4) \\\\
# |_OPENSSL_VERSION_PRE_RELEASE )

# with the following line (including the leading hashtag:
# define OPENSSL_VERSION_NUMBER 0x30000020
# save file
--------------------
cd $HOME
git clone -b v6.20.3 <https://github.com/facebook/rocksdb>
cd rocksdb
make -j 16 shared_lib
sudo make install-shared
echo "LD_LIBRARY_PATH=/usr/local/lib:$HOME/rocksdb/librocksdb.so" >> /root/.bashrc
source /root/.bashrc
sudo ldconfig
mkdir $HOME/arbitrum/packages/arb-avm-cpp/release
cd $HOME/arbitrum/packages/arb-avm-cpp/release
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=0 -DENABLE_TCMALLOC=true
cmake --build .
cd $HOME/arbitrum/packages/arb-rpc-node/cmd/arb-node
go build ./
# the binary is compiled under arb-node copy it to a shorter path for easier access and rename to arbitrum
mkdir -p $HOME/arbitrum/build/bin
cp $HOME/arbitrum/packages/arb-rpc-node/cmd/arb-node/arb-node $HOME/arbitrum/build/bin/arbitrum
# revert the opensslv.h to original
cp /usr/include/openssl/opensslv.h.backup /usr/include/openssl/opensslv.h
# verify that the binary works
$HOME/arbitrum/build/bin/arbitrum -h

Download Arbitrum Classic snapshot
mkdir -p /root/.local/share/arbitrum/datadir/
cd /root/.local/share/arbitrum/datadir/
aria2c --file-allocation=none -c -x 10 -s 10 <https://snapshot.arbitrum.io/mainnet/db.tar>
# Extract & remove the tar
dtrx -f db.tar
rm db.tar

Create the Systemd files for Arbitrum Classic nano /etc/systemd/system/arbitrum.service

# EDIT --l1.url=http://ip:port with your Ethereum Mainnet RPC URL
[Unit]
Description=Arbitrum Classic Service
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=3

[Service]
Type=simple
Restart=on-failure
RestartSec=5
TimeoutSec=900
User=root
Nice=0
LimitNOFILE=200000
WorkingDirectory=/root/arbitrum
ExecStart=/root/arbitrum/build/bin/arbitrum \
--l1.url=http://ip:port \
--core.checkpoint-gas-frequency=156250000 \
--node.rpc.enable-l1-calls \
--node.cache.allow-slow-lookup \
--core.checkpoint-gas-frequency=156250000 \
--node.rpc.tracing.enable \
--node.rpc.addr=0.0.0.0 \
--node.rpc.port=9656 \
--node.rpc.tracing.namespace="trace" \
--node.chain-id=42161 \
--l2.disable-upstream \
--persistent.chain=/root/.local/share/arbitrum/datadir/ \
--persistent.global-config=/root/.local/share/arbitrum/ \
--l2.final-classic-block=22207816
KillSignal=SIGHUP

[Install]
WantedBy=multi-user.target

Run Arbitrum Classic

systemctl daemon-reload
systemctl restart arbitrum
Viewing Logs
journalctl -fu arbitrum

--

--