Deploy your OWN Hyperlane

4 min read
Cover Image for Deploy your OWN Hyperlane

gm gm gm!!!
Hyperlane is a Permissionless Protocol which means that anyone can deploy their own Hyperlane Protocol on any chain without requiring any permission from the core team.

In this tutorial, we will learn how to deploy Hyperlane on Polygon zkEVM Testnet, Polygon Mumbai Testnet and Sepolia.

There are 5 steps we need to follow so LFG🚀

Prerequisites

Before moving forward, if you like to understand Hyperlane in-depth (which you should!) check this out:

Setup Keys

When you deploy Hyperlane Protocol it includes Smart Contracts, Validators and Relayers therefore we will be requiring Key Pair for each of them.

Keys for Deployment

To deploy smart contracts you will need to have a key pair with the funds for all the chains you will be deploying.

To create the key pair, follow the steps:

  • Open your Terminal and enter the following command

      cast wallet new
    

    This will generate a new key pair for you, which will look like this 👇🏻

    THIS IS A TESTING WALLET.
  • Save your Public Address and Private Key.

  • Fund your Address with the tokens of all the networks.

Keys for Validators

For this tutorial, we will be using the default Hyperlane's Multisig ISM. Multisig ISM is a module that takes several signatures from validators before completing the transaction. Therefore, we will be using 4 addresses with threshold one.

You can take any 4 of your Public Addresses, and keep them handy for later use.

Make sure to have a Private Key secured for the Public addresses you will be using.
You can generate Key Pairs using the above method.

Setting up the Repo

The Hyperlane Core team provided us with a repository that you can use to deploy Hyperlane on your preferred chain.

Follow these steps to set up the Hyperlane Deployment repo:

  • Open your terminal at your preferred directory.

  •     git clone https://github.com/hyperlane-xyz/hyperlane-deploy.git
    
  •     cd hyperlane-deploy
    
  •     yarn install
    

Adding the custom chain

Hyperlane's core team has provided a few chains in the SDK. You can check them out here.

To add a chain apart from the provided chains, follow these steps:

  • Open config/chains.ts There you will find the configuration example for adding new chains.

  • Add the following configuration for the Polygon zkEVM Testnet:

        polygonzkevmtestnet: {
          name: 'polygonzkevmtestnet',
          chainId: 1442,
          protocol: ProtocolType.Ethereum,
          nativeToken: {
            name: 'ether',
            symbol: 'ETH',
            decimals: 18,
          },
          rpcUrls: [
            {
              http: 'https://rpc.public.zkevm-test.net',
            },
          ],
          blockExplorers: [
            {
              name: 'Polygon Scan',
              url: 'https://testnet-zkevm.polygonscan.com',
              apiUrl: 'https://api-zkevm.polygonscan.com/api',
            },
          ],
          isTestnet: true,
        },
    

Adding the Validator Keys

For this tutorial, we are using the default Multisig as our Interchain Security Module.

Follow these steps, for setting up the keys:

  • Open config/multisig_ism.ts. There you will find the configuration example for adding new chains and their keys.

  • Add the keys for your validator:

        polygonzkevmtestnet: {
          threshold: 1,
          type: ModuleType.LEGACY_MULTISIG,
          validators: [
            '0xabcabcabcabcabcabcabcabcabcabcabcabcabca',
            '0xabcabcabcabcabcabcabcabcabcabcabcabcabca',
            '0xabcabcabcabcabcabcabcabcabcabcabcabcabca',
            '0xabcabcabcabcabcabcabcabcabcabcabcabcabca',
          ],
        },
    
  • threshold is 1 which means only one of the validator's signatures is required.

Woohoooo!!! You are done with the setup for the deployment of HYPERLANE on Polygon zkEVM testnet with remotes Mumbai and Sepolia.


Deploying the Hyperlane

To deploy Hyperlane, run the following command on your terminal.

DEBUG=hyperlane* yarn ts-node scripts/deploy-hyperlane.ts --local polygonzkevmtestnet \
  --remotes mumbai sepolia \
  --key 0xbeda2b3910bae7dbfb4e65e9c0931f001066d4f0df257b77ad55093fa271bde2

In the above command,

  • we are running the deploy-hyperlane.ts script

  • with polygonzkevmtestnet as local chain and

  • mumbai and sepolia as remotes. Since mumbai and sepolia are already provided by the Hyperlane SDK we don't need to add the configurations again.

  • the value after key param is your private key to the address that contains funds for all the networks.

After running the command, wait for a few minutes till your terminal looks like this 👇🏻


Congrats!!! You just Deployed Hyperlane on Polygon zkEVM Testnet.

But to test this out, you will need to run your Validators and Relayers for all the chains you deployed (local + remote). To learn how to setup Validators and Relayers check them out 👇🏻


Thanks for going through the whole blog, I hope you learned something today.

💡
If you wanna explore more check out the Hyperlane Docs, and if you have any queries get them resolved in Hyperlane India Telegram Channel.

Let me know if you have any doubts on Twitter, Lenster or LinkedIn.

Happy Learning 🙌🏻

Keep Building 🧱🚀