Sidecar Setup

Step 1: Clone zenrock-validators repository

cd $HOME
rm -rf zenrock-validators
git clone https://github.com/zenrocklabs/zenrock-validators

Step 2: Generate keys

# Set key password
read -p "Enter password for the keys: " key_pass

# Create sidecar directories
mkdir -p $HOME/.zrchain/sidecar/bin
mkdir -p $HOME/.zrchain/sidecar/keys

# Build ecdsa binary
cd $HOME/zenrock-validators/utils/keygen/ecdsa && go build

# Build bls binary
cd $HOME/zenrock-validators/utils/keygen/bls && go build

# Generate ecdsa key
ecdsa_output_file=$HOME/.zrchain/sidecar/keys/ecdsa.key.json
ecdsa_creation=$($HOME/zenrock-validators/utils/keygen/ecdsa/ecdsa --password $key_pass -output-file $ecdsa_output_file)
ecdsa_address=$(echo "$ecdsa_creation" | grep "Public address" | cut -d: -f2)

# Generate bls key
bls_output_file=$HOME/.zrchain/sidecar/keys/bls.key.json
$HOME/zenrock-validators/utils/keygen/bls/bls --password $key_pass -output-file $bls_output_file

# Output
echo "ecdsa address: $ecdsa_address"

Step 3: Top up your wallet address

Please fund your wallet addresses with Holesky $ETH before proceeding further.

Step 4: Set operator configuration

Ensure that you have configured TESTNET_HOLESKY_ENDPOINT, MAINNET_ENDPOINT, ETH_RPC_URL, ETH_WS_URL with your specific values. You can use Quicknode.com to get api keys.

# Declare variables
EIGEN_OPERATOR_CONFIG="$HOME/.zrchain/sidecar/eigen_operator_config.yaml"
TESTNET_HOLESKY_ENDPOINT="YOUR_TESTNET_HOLESKY_ENDPOINT"
MAINNET_ENDPOINT="YOUR_ETH_MAINNET_ENDPOINT"
OPERATOR_VALIDATOR_ADDRESS=$(zenrockd keys show wallet --bech val -a)
OPERATOR_ADDRESS=$ecdsa_address
ETH_RPC_URL="YOUR_TESTNET_HOLESKY_RPC"
ETH_WS_URL="YOUR_TESTNET_HOLESKY_WS"
ECDSA_KEY_PATH=$ecdsa_output_file
BLS_KEY_PATH=$bls_output_file

# Copy initial configuration files
cp $HOME/zenrock-validators/scaffold_setup/configs_testnet/eigen_operator_config.yaml $HOME/.zrchain/sidecar/
cp $HOME/zenrock-validators/scaffold_setup/configs_testnet/config.yaml $HOME/.zrchain/sidecar/

# Replace variables in config.yaml
sed -i "s|EIGEN_OPERATOR_CONFIG|$EIGEN_OPERATOR_CONFIG|g" "$HOME/.zrchain/sidecar/config.yaml"
sed -i "s|TESTNET_HOLESKY_ENDPOINT|$TESTNET_HOLESKY_ENDPOINT|g" "$HOME/.zrchain/sidecar/config.yaml"
sed -i "s|MAINNET_ENDPOINT|$MAINNET_ENDPOINT|g" "$HOME/.zrchain/sidecar/config.yaml"
sed -i "s|/root-data|$HOME/.zrchain|g" "$HOME/.zrchain/sidecar/config.yaml"

# Replace variables in eigen_operator_config.yaml
sed -i "s|OPERATOR_VALIDATOR_ADDRESS|$OPERATOR_VALIDATOR_ADDRESS|g" "$HOME/.zrchain/sidecar/eigen_operator_config.yaml"
sed -i "s|OPERATOR_ADDRESS|$OPERATOR_ADDRESS|g" "$HOME/.zrchain/sidecar/eigen_operator_config.yaml"
sed -i "s|ETH_RPC_URL|$ETH_RPC_URL|g" "$HOME/.zrchain/sidecar/eigen_operator_config.yaml"
sed -i "s|ETH_WS_URL|$ETH_WS_URL|g" "$HOME/.zrchain/sidecar/eigen_operator_config.yaml"
sed -i "s|ECDSA_KEY_PATH|$ECDSA_KEY_PATH|g" "$HOME/.zrchain/sidecar/eigen_operator_config.yaml"
sed -i "s|BLS_KEY_PATH|$BLS_KEY_PATH|g" "$HOME/.zrchain/sidecar/eigen_operator_config.yaml"

# Set grpc endpoint in eigen_operator_config.yaml
sed -i "s|localhost:9790|localhost:18290|g" "$HOME/.zrchain/sidecar/eigen_operator_config.yaml"

Step 5: Download sidecar binary

wget -O $HOME/.zrchain/sidecar/bin/validator_sidecar https://github.com/zenrocklabs/zrchain/releases/download/v5.11.4/validator_sidecar
chmod +x $HOME/.zrchain/sidecar/bin/validator_sidecar

Step 6: Create and run sidecar service

Create service

sudo tee /etc/systemd/system/zenrock-sidecar.service > /dev/null <<EOF
[Unit]
Description=Validator Sidecar
After=network-online.target

[Service]
User=$USER
ExecStart=$HOME/.zrchain/sidecar/bin/validator_sidecar
WorkingDirectory=$HOME/.zrchain/sidecar
Restart=on-failure
RestartSec=30
LimitNOFILE=65535
Environment="OPERATOR_BLS_KEY_PASSWORD=$key_pass"
Environment="OPERATOR_ECDSA_KEY_PASSWORD=$key_pass"
Environment="SIDECAR_CONFIG_FILE=$HOME/.zrchain/sidecar/config.yaml"

[Install]
WantedBy=multi-user.target
EOF

Enable and start service

sudo systemctl daemon-reload
sudo systemctl enable zenrock-sidecar.service
sudo systemctl start zenrock-sidecar.service

Step 7: Check the service logs

To check service logs use command below:

journalctl -fu zenrock-sidecar.service -o cat

Successfull Log examples:

2025/02/08 20:19:00 initializing operator
2025/02/08 20:19:02 initialized operator
2025/02/08 20:19:02 starting operator
{"level":"info","ts":1739026142.1142812,"caller":"operator/operator.go:268","msg":"Starting operator."}
{"level":"info","ts":1739026142.114335,"caller":"nodeapi/nodeapi.go:104","msg":"Starting node api server at address 0.0.0.0:29591"}
{"level":"info","ts":1739026142.1144495,"caller":"metrics/eigenmetrics.go:81","msg":"Starting metrics server at port 0.0.0.0:29592"}
{"level":"info","ts":1739026142.1146398,"caller":"nodeapi/nodeapi.go:238","msg":"node api server running","addr":"0.0.0.0:29591"}
{"level":"info","ts":1739026142.18761,"caller":"chainio/avs_subscriber.go:63","msg":"Subscribed to new TaskManager tasks"}
2025/02/08 20:19:57 INFO Received AVS contract state for network="Holešky Ethereum Testnet" block=3311417
2025/02/08 20:19:57 INFO Received prices ROCK/USD=0.03648 BTC/USD=96192.39 ETH/USD=2609.01264727
2025/02/08 20:20:17 INFO Received AVS contract state for network="Holešky Ethereum Testnet" block=3311418
2025/02/08 20:20:17 INFO Received prices ROCK/USD=0.03648 BTC/USD=96192.39 ETH/USD=2609.01264727

Step 8: Backup operator config and keys

To back up your sidecar configuration and keys, ensure you have a copy of the $HOME/.zrchain/sidecar directory.

Last updated