Skip to content

Deploy Warp Routes on Tangle

Pavan Soratur edited this page Sep 21, 2024 · 2 revisions

This walkthrough explains how to deploy a Warp route on Tangle using the Hyperlane CLI.

Official Hyperlane documentation:

Prerequisites

Note ⚠️: The private key of the account that you use should have enough balance on the source chain and the destination chain to be able to deploy the warp route contracts.

Steps

  1. Install the Hyperlane CLI (If not already installed):
npm install -g @hyperlane-xyz/cli
  1. Export the private key of the account that you want to use for the deployment:
export HYP_KEY='<YOUR_PRIVATE_KEY>'
  1. Deploy Hyperlane on the chains you want to deploy the warp route on (If not already deployed):

Check Hyperlane Registry to see if your chain is already supported. If not, you can deploy Hyperlane on your chain by following the steps below.

hyperlane core init

This will output the deployment config for the chain.

Example output:

./configs/core-config.yaml

owner: '0x16F4898F47c085C41d7Cc6b1dc72B91EA617dcBb'
defaultIsm:
  type: trustedRelayerIsm
  relayer: '0x16F4898F47c085C41d7Cc6b1dc72B91EA617dcBb'
defaultHook:
  type: merkleTreeHook
requiredHook:
  owner: '0x16F4898F47c085C41d7Cc6b1dc72B91EA617dcBb'
  type: protocolFee
  beneficiary: '0x16F4898F47c085C41d7Cc6b1dc72B91EA617dcBb'
  maxProtocolFee: '100000000000000000'
  protocolFee: '0'
  1. Deploy Hyperlane:
hyperlane core deploy

Use the arrows and enter to select your custom chain from mainnet/testnet list. This will deploy the Hyperlane core contracts on the selected chain.

Example output:

$HOME/.hyperlane/chains

staticMerkleRootMultisigIsmFactory: '0x6906cb4741d3E2322E9f9aA645DfC8AB6F122c47'
staticMessageIdMultisigIsmFactory: '0x3CE97a32d9C8294691cBd2baC09B078EDa75c429'
staticAggregationIsmFactory: '0x81f969fDBF48278Ce09685Ce48e03388B6785aF4'
staticAggregationHookFactory: '0x3d864A3c25F61E3c3A7d02e980453A6E1f0a92A6'
domainRoutingIsmFactory: '0xC4c01f7B03f0fFa77A0265C600dEF7Ad28BCa5A2'
proxyAdmin: '0xABb7175d5F123172E7B7Fa467CC9fE4C2FEdb942'
mailbox: '0x5F58d75A9caDE4e2b191313223978dF049f93b81'
interchainAccountRouter: '0x43c0745b0dE9Cb780816a24ddE63d79Ca99B5dE8'
interchainAccountIsm: '0x9C96dC8f4257413225d6B5C47d1afbafc39B269F'
validatorAnnounce: '0xE3bd39BF92DB385dE6313D6070b035bD934378CB'
testRecipient: '0xa58462b1943Be1469Ed58db690C78583BA34Fd2E'

Check if the deployment is successful by sending a test message:

Note: Self relay of a message only works from Holesky to your chain. So make sure to select Holesky as the source chain.

hyperlane send message --relay

You should see a message like this:

Message was self-relayed!

  1. Create a Warp Route config:
hyperlane warp init

Select the required options and cross check all the options you have selected. Especially the mailbox addresses for the source and destination chains which can be found here if Hyperlane is already deployed and added to the registry. If not check the previous output of the Hyperlane deployment to see the mailbox address for your chain.

Example output:

Warp Route config is valid, writing to file ./configs/warp-route-deployment.yaml:

holesky:
  isNft: false
  type: collateral
  token: "0x94373a4919B3240D86eA41593D5eBa789FEF3848"
  owner: "0x009928463436d9CFf320d4E9E0D36376c71C1C1E"
  mailbox: "0x46f7C5D896bbeC89bE1B19e4485e59b4Be49e9Cc"
  interchainSecurityModule:
    type: staticAggregationIsm
    modules:
      - type: trustedRelayerIsm
        relayer: "0x009928463436d9CFf320d4E9E0D36376c71C1C1E"
      - owner: "0x009928463436d9CFf320d4E9E0D36376c71C1C1E"
        type: defaultFallbackRoutingIsm
        domains: {}
    threshold: 1
tangletestnet:
  isNft: false
  type: synthetic
  owner: "0x009928463436d9CFf320d4E9E0D36376c71C1C1E"
  mailbox: "0x4FB98bF4E45Fd5e25343cAb6fF6d86667F7c4F68"
  interchainSecurityModule:
    type: staticAggregationIsm
    modules:
      - type: trustedRelayerIsm
        relayer: "0x009928463436d9CFf320d4E9E0D36376c71C1C1E"
      - owner: "0x009928463436d9CFf320d4E9E0D36376c71C1C1E"
        type: defaultFallbackRoutingIsm
        domains: {}
    threshold: 1

✅ Successfully created new warp route deployment config.
  1. Deploy the Warp Route:
hyperlane warp deploy

This will deploy the Warp Route on the selected chains. Once finished, the CLI will create two new artifact files: otherchain-yourchain-addresses.yaml and otherchain-yourchain-config.yaml under $HOME/.hyperlane/deployments/warp_routes/.

Example output:

✅ Warp contract deployments complete
Writing deployment artifacts...
Skipping adding warp route at github registry
Now adding warp route at filesystem registry at /Users/pavansoratur/.hyperlane
Done adding warp route at filesystem registry
    tokens:
      - chainName: holesky
        standard: EvmHypCollateral
        decimals: 18
        symbol: WETH
        name: Wrapped Ether
        addressOrDenom: "0x3d148422858636e60D7195E1a9D5a1773b561b28"
        collateralAddressOrDenom: "0x94373a4919B3240D86eA41593D5eBa789FEF3848"
        connections:
          - token: ethereum|tangletestnet|0xaF6b41C31A3bc1569ab7Ea0629F238bcbfEDB36F
      - chainName: tangletestnet
        standard: EvmHypSynthetic
        decimals: 18
        symbol: WETH
        name: Wrapped Ether
        addressOrDenom: "0xaF6b41C31A3bc1569ab7Ea0629F238bcbfEDB36F"
        connections:
          - token: ethereum|holesky|0x3d148422858636e60D7195E1a9D5a1773b561b28

⛽️ Gas Usage Statistics
- Gas required for warp deploy on holesky: 0.003006302339655542 ETH
- Gas required for warp deploy on tangletestnet: 0.0000032953625 tTNT
  1. Verify the Warp Route:
hyperlane warp send --relay --warp $HOME/.hyperlane/deployments/warp_routes/TOKEN/corechain-yourchain-config.yaml

This will verify the Warp Route on the selected chains by sending 1 WEI.

You should see a message like this:

Transfer was self-relayed!

Clone this wiki locally