Managing multi-chain contract deployments

HyperlaneDeployer helps manage the deployment of contracts across multiple chains. Hyperlane apps should extend a deployer to specify the needed types and implement any needed logic for deployment of their contracts.


Developers must provide an implementation for deployContracts which describes the logic for deploying the application on a single chain. Developers building with the Router pattern can extend HyperlaneRouterDeployer, which handles some Router-specific boilerplate.

Deployers will also need contract Factories, which be defined manually or generated automatically by tooling like TypeChain (recommended).

import { HyperlaneRouterDeployer, ChainName } from '@hyperlane-xyz/sdk';

class MyDeployer<Chain extends ChainName, MyConfig>
  extends HyperlaneRouterDeployer<Chain, MyContracts, MyFactories, MyConfig> { 
    function deployContracts(network: Networks, config: MyConfig) {
      // Custom contract deployment logic to goes here
      // This method is called once for each target chain

For a simple, single contract app that extends the Router contract, it is sufficient to call the deployContract method in the deployContracts implementation:

  async deployContracts(chain: Chain, config: HelloWorldConfig) {
    const router = await this.deployContract(chain, 'router', [
    return {

For an example deployer implementation see the Hyperlane Hello World app.


Once aHyperlaneDeployer class has been defined, the deployer can be instantiated with a Multiprovider and a map of chains to configurations. These configs will be provided to your deployContracts methods and can include any values needed there. The initialization of Invoking deploy() will deploy contracts for all specified chains.

const ethereum: MyConfig = {...};
const polygon: MyConfig = {...};
const myDeployer = new MyDeployer(multiProvider, { ethereum, polygon });
const contracts = await myDeployer.deploy();

In scripts that calls deploy, consider persisting deployment artifacts as they will be important for future use of your application. This includes addresses, compiler options, and contract constructor arguments.

For an example deployment script, see the Hyperlane Hello World app. This script is the same as the one provided above.

Last updated