⛓️Sidecar setup (Oracle)

credit: kjnodes

➡️Clone zenrock-validators repository

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

➡️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"

➡️Top up your wallet address

Please fund your wallet addresses with Holesky $ETH before proceeding further. https://cloud.google.com/application/web3/faucet/ethereum/holesky

➡️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. I used infura.io

➡️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_TBD=$(zenrockd keys show wallet --bech val -a)
OPERATOR_ADDRESS_TBU=$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/configs/eigen_operator_config.yaml $HOME/.zrchain/sidecar/
cp $HOME/zenrock-validators/configs/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"

➡️Replace variables in eigen_operator_config.yaml

sed -i "s|OPERATOR_VALIDATOR_ADDRESS_TBD|$OPERATOR_VALIDATOR_ADDRESS_TBD|g" "$HOME/.zrchain/sidecar/eigen_operator_config.yaml"
sed -i "s|OPERATOR_ADDRESS_TBU|$OPERATOR_ADDRESS_TBU|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"

➡️Download sidecar binary

wget -O $HOME/.zrchain/sidecar/bin/validator_sidecar https://releases.gardia.zenrocklabs.io/validator_sidecar-1.2.3
chmod +x $HOME/.zrchain/sidecar/bin/validator_sidecar

➡️Create and run sidecar service

➡️Create Service

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

[Service]
User=$USER
ExecStart=$HOME/.zrchain/sidecar/bin/validator_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
sudo systemctl daemon-reload
sudo systemctl enable zenrock-testnet-sidecar.service
sudo systemctl start zenrock-testnet-sidecar.service

➡️Check the service logs

journalctl -fu zenrock-testnet-sidecar.service -o cat

Successfull Log examples:

{"level":"info","ts":1727294139.4385705,"caller":"operator/operator.go:250","msg":"Operator info","operatorId":[144,89,34,19,95,158,123,120,47,228,59,114,85,73,150,39,84,119,143,77,154,173,85,210,132,206,213,195,7,190,250,142],"operatorAddr":"0x68e305548619Ce71D562b851ff1adfb7e5369DB3","operatorG1Pubkey":"E([20150260775620749168755223143919346367674724303860875751315024817211815113340,5713528518001336848987890055463332760351549074437348780451495739349376234320])","operatorG2Pubkey":"E([9400781597017099172228313635710883835447541071342639102400258381712924127278+17588199816725806065286885136698384247231626887315665039610705603333445204237*u,21507870890336379219932542686750816691453493327464905543429790078496913285917+3341052853010856303076683482759015503204225193006075252832111461015148222443*u])"}
2024/09/25 19:55:39 initialized operator
2024/09/25 19:55:39 starting operator
{"level":"info","ts":1727294139.4387212,"caller":"operator/operator.go:262","msg":"Starting operator."}
{"level":"info","ts":1727294139.438742,"caller":"nodeapi/nodeapi.go:104","msg":"Starting node api server at address 0.0.0.0:9191"}
{"level":"info","ts":1727294139.4388723,"caller":"metrics/eigenmetrics.go:81","msg":"Starting metrics server at port 0.0.0.0:9292"}
{"level":"info","ts":1727294139.4389389,"caller":"nodeapi/nodeapi.go:238","msg":"node api server running","addr":"0.0.0.0:9191"}
{"level":"info","ts":1727294139.5475569,"caller":"chainio/avs_subscriber.go:63","msg":"Subscribed to new TaskManager tasks"}
2024/09/25 19:55:45 Received AVS contract state for  block 2407883
2024/09/25 19:55:45 Received prices: ETH/USD 2583.166191, ROCK/USD 0.000000
2024/09/25 19:56:00 Received prices: ETH/USD 2583.166191, ROCK/USD 0.000000
2024/09/25 19:56:00 Received AVS contract state for  block 2407884
2024/09/25 19:56:15 Received prices: ETH/USD 2583.166191, ROCK/USD 0.000000
2024/09/25 19:56:15 Received AVS contract state for  block 2407885

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

Last updated