Running Off-chain Agents

This follow is meant for local setup. For production environment, please refer to https://docs.hyperlane.xyz/docs/protocol/agents

Clone hyperlane-monorepo repository and run cd rust.

1. Validator

Create rust/config/validator.env

CONFIG_FILES=./config/agent_config.json
HYP_BASE_CHAINS_SEPOLIA_CONNECTION_URL=https://eth-sepolia.g.alchemy.com/v2/apikey
HYP_BASE_ORIGINCHAINNAME=sepolia
HYP_BASE_REORGPERIOD=20
HYP_BASE_VALIDATOR_TYPE=hexKey
HYP_BASE_VALIDATOR_KEY=<validator private key>
HYP_BASE_CHECKPOINTSYNCER_TYPE=localStorage
HYP_BASE_CHECKPOINTSYNCER_PATH=/tmp/hyperlane-validator-signatures-ethereum

Compile the validator by running

Compile: cargo build --release --bin validator

Run the validator using the following

env $(cat ./config/validator.env | grep -v "#" | xargs) ./target/release/validator

It will generate the announcement json at /tmp/hyperlane-validator-signatures-ethereum/announcement.json

{
  "value": {
    "validator": "0x7c19f05db313d89dea09781df2c076ec1132c423",
    "mailbox_address": "0x000000000000000000000000d51a3fbac4424a2a0c330686020341fd70adc9c5",
    "mailbox_domain": 11155111,
    "storage_location": "file:///tmp/hyperlane-validator-signatures-ethereum"
  },
  "signature": {
    "r": "0x54b9657e0eafd1abd49ce5f101079110cbd370091efc333ec908580b121c285c",
    "s": "0x35b288738187df1e921842ab55c12fef0cc1c8c3e5555899c2086ceb61cbe747",
    "v": 27
  },
  "serialized_signature": "0x54b9657e0eafd1abd49ce5f101079110cbd370091efc333ec908580b121c285c35b288738187df1e921842ab55c12fef0cc1c8c3e5555899c2086ceb61cbe7471b"
}

To announce the validator, run this command:

cast send <validator announcement contract> "announce(address, string calldata, bytes calldata)(bool)" <validator address> "file:///tmp/hyperlane-validator-signatures-ethereum" <serialiszed signature> --rpc-url https://eth-sepolia.g.alchemy.com/v2/apikey --private-key <deployer private key>
  1. Relayer

Create rust/config/relayer.env

CONFIG_FILES=./config/agent_config.json
HYP_BASE_CHAINS_SEPOLIA_CONNECTION_URL=https://eth-sepolia.g.alchemy.com/v2/apikey
HYP_BASE_CHAINS_TESTNET_CONNECTION_URL=https://testnet-rollup-api.altlayer.io
HYP_BASE_ORIGINCHAINNAME=sepolia
HYP_BASE_DESTINATIONCHAINNAMES=testnet
HYP_BASE_REORGPERIOD=20
HYP_BASE_DEFAULTSIGNER_TYPE=hexKey
HYP_BASE_DEFAULTSIGNER_KEY=<relayer private key>
HYP_BASE_ALLOWLOCALCHECKPOINTSYNCERS=true

Last updated

#191:

Change request updated