Skip to main content
When working with a LayerZero project, it searches for the closest hardhat.config.ts and layerzero.config.ts files starting from the Current Working Directory. This file normally lives in the root of your project. This guide shows how to add a new EVM network to your existing LayerZero project. Example scenario: You have an OFT deployed on Optimism Sepolia and Base Sepolia, and want to add Arbitrum Sepolia to your mesh. Existing networks in your mesh:
  • Optimism Sepolia (EID: 40232)
  • Base Sepolia (EID: 40245)
Network being added:
  • Arbitrum Sepolia (EID: 40231)
You will:
  • Update hardhat.config.ts with the new network’s LayerZero Endpoint ID (EID) and RPC
  • Deploy your contract to the new network
  • Update layerzero.config.ts to declare the contract and connections
  • Wire peers and apply configuration across pathways

Update dependencies

Ensure you have the latest versions of @layerzerolabs/lz-evm-sdk-v2 and @layerzerolabs/lz-definitions. Update or install the packages using your preferred package manager:
Using an outdated version @layerzerolabs/lz-definitions may result in an error such as TypeError: Cannot read properties of undefined (reading 'toString'). Using an outdated version @layerzerolabs/lz-evm-sdk-v2 may result in the error Error: No deployment found for: EndpointV2.

Add the network to hardhat.config.ts

Add an entry with the LayerZero Endpoint ID, RPC URL, and your deployer accounts. Here’s the diff showing what to add:
The only notable change from a standard hardhat.config.ts setup is the inclusion of a LayerZero Endpoint ID.For hardhat specific questions, refer to the Hardhat Configuration documentation.
The npx package uses @layerzerolabs/lz-definitions to enable you to reference both V1 and V2 Endpoints. Make sure if your project uses LayerZero V2 to select the V2 Endpoint (i.e., eid: EXAMPLE_V2_MAINNET).

Deploy your contract to the new network

Use the CLI to deploy your contract to the added network. You can deploy interactively or target a specific network.

Add the new contract and connections to layerzero.config.ts

Specify which contracts should be connected on a per pathway basis and set the security stack values:
You can refer to defaults with the Defaults Checker.

Wire peers and apply configuration

Set peers, libraries, DVN/Executor settings, and enforced options per your layerzero.config.ts. When delegate and owner are your local EOA (not recommended):
When delegate and owner are Multisigs:
  • --output-filename will generate a JSON file with the list of transactions rather than submitting the transactions for execution directly
  • When asked to preview txns, you can choose Y or just terminate the process immediately, as at this point, the JSON file would have already been generated. If asked “Would you like to submit the required transactions?”, respond with N to terminate the process.
  • View the generated JSON at wiring-txns.json to view the txns data that need execution
  • Import them into your Multisig for execution

Verify connections and configuration

Checking Pathway Configurations

To check your OApp’s current configuration, you can run:
This command will output a table with 3 columns:
  1. Custom OApp Config: your layerzero.config.ts configuration changes, with null values for unchanged parameters.
  2. Default OApp Config: the default LayerZero configuration for the pathway.
  3. Active OApp Config: the combination of your customized and default parameters, i.e., the active configuration.

Specifying Pathway Configurations

For more specific configurations on a per pathway basis, review the Configuring Pathways page.