Cover photo

Deploying a zkEVM rollup with airchian on E

System Requirements:

Hardware Configuration

this is airchain recommendation but you can run it on a server with a much lower config.

Install Dependencies:

Update Packages

sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y

Install Go

VERSION="1.21.6"
ARCH="amd64"
curl -O -L "https://golang.org/dl/go${VERSION}.linux-${ARCH}.tar.gz"
tar -xf "go${VERSION}.linux-${ARCH}.tar.gz"
sudo rm -rf /usr/local/go
sudo mv -v go /usr/local
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
source ~/.bash_profile
go version

Setup EVM station service:

Clone GitHub Repositories

git clone https://github.com/airchains-network/evm-station.git
git clone https://github.com/airchains-network/tracks.git

Setup the station

rm -r ~/.evmosd
cd ~/evm-station
git checkout --detac v1.0.2
go mod tidy
/bin/bash ./scripts/local-setup.sh

Create env file

cd ~

echo 'MONIKER="localtestnet"
KEYRING="test"
KEYALGO="eth_secp256k1"
LOGLEVEL="info"
HOMEDIR="$HOME/.evmosd"
TRACE=""
BASEFEE=1000000000
CONFIG=$HOMEDIR/config/config.toml
APP_TOML=$HOMEDIR/config/app.toml
GENESIS=$HOMEDIR/config/genesis.json
TMP_GENESIS=$HOMEDIR/config/tmp_genesis.json
VAL_KEY="mykey"' > .rollup-env

Create evmosd service file

sudo tee /etc/systemd/system/evmosd.service > /dev/null << EOF
[Unit]
Description=ZK
After=network.target

[Service]
User=root
EnvironmentFile=/root/.rollup-env
ExecStart=/root/evm-station/build/station-evm start --metrics "" --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --chain-id "stationevm_1234-1"
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target
EOF

Start evmosd service

sudo systemctl enable evmosd
sudo systemctl start evmosd
sudo journalctl -u evmosd -f --no-hostname -o cat

the service logs should be like this

Get Your Private Key of EVM Station

cd evm-station
/bin/bash ./scripts/local-keys.sh

Change evmosd ports

#stop evmosd
systemctl stop evmosd

#change ports
echo "export G_PORT="17"" >> $HOME/.bash_profile
source $HOME/.bash_profile

sed -i.bak -e "s%:1317%:${G_PORT}317%g;
s%:8080%:${G_PORT}080%g;
s%:9090%:${G_PORT}090%g;
s%:9091%:${G_PORT}091%g;
s%:8545%:${G_PORT}545%g;
s%:8546%:${G_PORT}546%g;
s%:6065%:${G_PORT}065%g" $HOME/.evmosd/config/app.toml

sed -i.bak -e "s%:26658%:${G_PORT}658%g;
s%:26657%:${G_PORT}657%g;
s%:6060%:${G_PORT}060%g;
s%:26656%:${G_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${G_PORT}656\"%;
s%:26660%:${G_PORT}660%g" $HOME/.evmosd/config/config.toml

sed -i -e 's/address = "127.0.0.1:17545"/address = "0.0.0.0:17545"/' -e 's/ws-address = "127.0.0.1:17546"/ws-address = "0.0.0.0:17546"/' $HOME/.evmosd/config/app.toml

sudo ufw allow 17545
sudo ufw allow 17546

Restart evmosd service

recheck the service log to make sure it's running properly

sudo journalctl -u evmosd -f --no-hostname -o cat

Setup EigenDA Keys

Download the Binary to Generate Keys

cd ~
wget https://github.com/airchains-network/tracks/releases/download/v0.0.2/eigenlayer

Create and List Keys

chmod +x ./eigenlayer
./eigenlayer operator keys create --key-type ecdsa myEigenDAKey

this is the result you will see and you should save.

Set Up and Run Tracker

sudo rm -rf ~/.tracks
cd tracks
go mod tidy

Initiate Sequencer

just replace <eigen-wallet-address> and execute it

go run cmd/main.go init --daRpc "disperser-holesky.eigenda.xyz" --daKey "<eigen-wallet-address>" --daType "eigen" --moniker "mySequencer" --stationRpc "http://127.0.0.1:17545" --stationAPI "http://127.0.0.1:17545" --stationType "evm"

Setup Tracker Component

there are two paths here:

  1. if you participated in the testnet campaign before and want to use your previous tracker address you should use this command:

    just replace your-mnemonic-phrase (address with air...)

    go run cmd/main.go keys import  --accountName mySequencerAccount --accountPath $HOME/.tracks/junction-accounts/keys --mnemonic 'your-mnemonic-phrase'
  2. otherwise, generate a new key with this command and save its result (Mnemonic & Address)

    go run cmd/main.go keys junction --accountName mySequencerAccount --accountPath $HOME/.tracks/junction-accounts/keys

get facuet for airchain address, on this site https://airchains.faucetme.pro/

Initiate Prover

go run cmd/main.go prover v1EVM

Get your Node ID

cat ~/.tracks/config/sequencer.toml | grep node_id

Create station on Junction

replace <tracker-wallet-address> (address with air...)

replace <node_id>

go run cmd/main.go create-station --accountName mySequencerAccount --accountPath $HOME/.tracks/junction-accounts/keys --jsonRPC "https://junction-testnet-rpc.synergynodes.com/" --info "EVM Track" --tracks <tracker-wallet-address> --bootstrapNode "/ip4/127.0.0.1/tcp/2300/p2p/<node_id>"

Create staiond service file

sudo tee /etc/systemd/system/stationd.service > /dev/null << EOF
[Unit]
Description=station track service
After=network-online.target
[Service]
User=root
WorkingDirectory=/root/tracks/
ExecStart=/usr/local/go/bin/go run cmd/main.go start
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Run stationd service

sudo systemctl enable stationd
sudo systemctl restart stationd
sudo journalctl -u stationd -f --no-hostname -o cat

Track Switchyard Campaign Testnet

import tracker wallet mnemonic (with air...) to the Leap wallet and connect to the tracker site

https://points.airchains.io/

after around 10 min you have to see your newly deployed station

Earn Point

you can use this script that I wrote or any other auto-transaction generator script that you can find out there.

Error Handling


Stationd incorrect pod number

Your stationd service will probably run into this error occasionally, so you must rollback it to operate correctly again.

Or you can run this bash script in a tmux or screen session and let it take care of the problem automatically!

# Create bash file
nano rollback.sh
# Copy & paste this script in the file

#!/bin/bash

# Define service name and log search string
service_name="stationd"
gas_string="with gas used"
restart_delay=180  # Restart delay in seconds (3 minutes)

echo "Script started and it will rollback $service_name if needed..."
while true; do
  # Get the last 10 lines of service logs
  logs=$(systemctl status "$service_name" --no-pager | tail -n 10)

  # Check for both error and gas used strings
  if [[ "$logs" =~ $gas_string ]]; then
    echo "Found error and gas used in logs, stopping $service_name..."
    systemctl stop "$service_name"
    cd ~/tracks
   
    echo "Service $service_name stopped, starting rollback..."
    go run cmd/main.go rollback
    go run cmd/main.go rollback
    go run cmd/main.go rollback
    echo "Rollback completed, starting $service_name..."
    systemctl start "$service_name"
    echo "Service $service_name started"
  fi

  # Sleep for the restart delay
  sleep "$restart_delay"
done
# Run the script
bash ./rollback.sh

Loading...
highlight
Collect this post to permanently own it.
sarox.eth logo
Subscribe to sarox.eth and never miss a post.
#rollup#evm#code#eigen#airchain#data availability