How to install and configure Deez relayer

How to install and configure Deez relayer

Constant

There are few options:

  1. Build software on your own
  2. Use docker container
  3. Use public Deez relayer

PREREQUISITES

Jito solana client: https://jito-foundation.gitbook.io/mev/jito-solana/building-the-software

You can use simple installation:

sh -c "$(curl -sSfL https://release.jito.wtf/v2.0.18-jito/install)"

Chrony service: https://jito-foundation.gitbook.io/mev/jito-relayer/running-a-relayer#nice-to-have-time-synchronization


KEY GENERATION

If you have keys, please correct the path in service file later. I put it in $HOME/.keys

mkdir $HOME/.keys
openssl genrsa --out $HOME/.keys/private.pem
openssl rsa --in $HOME/.keys/private.pem --pubout --out $HOME/.keys/public.pem

BUILDING THE RELAYER

cd $HOME
sudo apt-get install protobuf-compiler clang llvm
curl https://sh.rustup.rs -sSf | sh
source "$HOME/.cargo/env"

git clone https://github.com/deez-labs/deez-relayer.git
cd $HOME/deez-relayer
git submodule update -i -r
cargo b --release -j 4

---
# If you need update relayer
cd $HOME/deez-relayer
git fetch --all
git reset --hard origin/master
git submodule update --init --recursive
cargo build --release -j 4

You will have BLOCK_ENGINE_URL in relayer and solana services.


CONFIGURE RELAYER

There is no need to set DEEZ_ENGINE_URL - it detects automatically.

The closest Jito BLOCK_ENGINE_URL can be found with next command:

for entry in "amsterdam.mainnet.block-engine.jito.wtf Amsterdam" "frankfurt.mainnet.block-engine.jito.wtf Frankfurt" "ny.mainnet.block-engine.jito.wtf NY" "tokyo.mainnet.block-engine.jito.wtf Tokyo" "slc.mainnet.block-engine.jito.wtf SLC"; do
 hostname="${entry%% *}"
 city="${entry##* }"
 echo -n "Ping $hostname ($city) - "
 ping -c 4 "$hostname" | grep 'avg' | awk -F'/' '{print $5 " ms"}'
done

Put hostname with the lowest ping in the service file for BLOCK_ENGINE_URL

It's always good to check if addresses still correct on official page here.


DO NOT RUN RELAYER SERVICE UNTIL SOLANA RUN PROPERLY


This command automatically creates service file relayer.service with resolved public ip and user id you currently use.

When it will be created please check that it has correct User, PUBLIC_IP.

sudo tee /etc/systemd/system/relayer.service > /dev/null <<EOF
[Unit]
Description=Solana transaction relayer
Requires=network-online.target chrony.service
After=network-online.target chrony.service

[Service]
Environment="RUST_LOG=info"
Environment="SOLANA_METRICS_CONFIG=host=http://metrics.jito.wtf:8086,db=relayer,u=relayer-operators,p=jito-relayer-write"
Environment="BLOCK_ENGINE_URL=https://ny.mainnet.block-engine.jito.wtf"
Environment="PUBLIC_IP=$(wget -q -O - ipinfo.io/ip)"
Environment="GRPC_BIND_IP=127.0.0.1"

ConditionPathExists=$HOME/.keys/relayer-keypair.json
ConditionPathExists=$HOME/.keys/private.pem
ConditionPathExists=$HOME/.keys/public.pem

Type=exec
User=$USER
Restart=on-failure

# Please check if PATH is correct
ExecStart=$HOME/deez-relayer/target/release/jito-transaction-relayer \\
--keypair-path=$HOME/.keys/relayer-keypair.json \\
--signing-key-pem-path=$HOME/.keys/private.pem \\
--verifying-key-pem-path=$HOME/.keys/public.pem \\
--block-engine-url \${BLOCK_ENGINE_URL} \\
--public-ip \${PUBLIC_IP} \\
--packet-delay-ms=300 \\
--grpc-bind-ip \${GRPC_BIND_IP}

[Install]
WantedBy=multi-user.target
EOF

DO NOT RUN RELAYER SERVICE UNTIL YOU SURE THAT SOLANA VALIDATOR IS RUNNING WITH NEXT KEYS:

--account-index program-id \
--account-index-include-key AddressLookupTab1e1111111111111111111111111 \
--full-rpc-api \


Add firewall rules

Check that you have rules for 8000-8020(or range that you use):

sudo ufw allow 8000:8020/tcp
sudo ufw allow 8000:8020/udp
sudo ufw allow 11228,11229/udp


When relayer is running you can switch between Jito's public relayer address and your local relayer with next command(replace with necessary relayer-url address):

agave-validator -l /path/to/solana/ledger/ set-relayer-config --relayer-url http://127.0.0.1:11226

If you done everything correct you can see that your validator is connected and is using the relayer: https://grafana.metrics.jito.wtf:3000/ (use relayer keypair PUBKEY in Host field to find your relayer)

At the end of solana service should have such extra keys:

# Extra Solana Validator CLI Arguments for Co-Hosted Relayer
  --relayer-url http://127.0.0.1:11226 \
  --private-rpc \
  --full-rpc-api \
  --rpc-port 8899 \
  --account-index program-id \
  --account-index-include-key AddressLookupTab1e1111111111111111111111111 \

OPTIONAL UPDATE FOR EXTRA REWARDS(Solana service)

You don't need to restart solana after updating service file, it will be applied during the next restart. Do not forget to run systemctl daemon-reload

You should replace --block-engine-url to the https://global.mainnet.block-engine.deez.wtf/ or better from the list:

declare -A locations=(
 ["Global"]="global.mainnet.block-engine.deez.wtf"
 ["LA"]="la.mainnet.block-engine.deez.wtf"
 ["NY"]="ny.mainnet.block-engine.deez.wtf"
 ["Oslo"]="oslo.mainnet.block-engine.deez.wtf"
 ["Vienna"]="vienna.mainnet.block-engine.deez.wtf"
 ["Warsaw"]="warsaw.mainnet.block-engine.deez.wtf"
 ["Frankfurt"]="frankfurt.mainnet.block-engine.deez.wtf"
 ["London"]="london.mainnet.block-engine.deez.wtf"
 ["Kyiv"]="kyiv.mainnet.block-engine.deez.wtf"
 ["Tokyo"]="tokyo.mainnet.block-engine.deez.wtf"
)

best_ping=99999
best_location=""

for city in "${!locations[@]}"; do
 hostname="${locations[$city]}"
 avg_ping=$(ping -c 4 "$hostname" | grep 'avg' | awk -F'/' '{print $5}')
 if [[ -n $avg_ping ]]; then
  echo "$city ($hostname): $avg_ping ms"
  if (( $(echo "$avg_ping < $best_ping" | bc -l) )); then
   best_ping=$avg_ping
   best_location=$hostname
  fi
 else
  echo "$city ($hostname): Ping failed"
 fi
done

echo -e "\nBest option: https://$best_location ($best_ping ms)"

To set it temporary on the fly(no solana restart needed):

agave-validator --ledger /path/to/ledger set-block-engine-config --block-engine-url "https://global.mainnet.block-engine.deez.wtf"

FINAL STEP

There is one more important task before you can start using Deez relayer and be rewarded. You should contact ari in discord or @aribxby in telegram to say Hello and share wallet for rewards.
Example:
Hello Ari. I'm a validator and I would like to join you.
I installed and configured deez relayer. Here is details:
identity: your_validator_identity
wallet: your_wallet

Monitor updates in Telegram: https://t.me/deezmempool

Report Page