Skip to main content
The LayerZero CLI tool uses the hardhat-deploy plugin to deploy contracts on multiple chains. After adding your MNEMONIC or PRIVATE_KEY to your dotenv file and adding networks in your hardhat.config.ts, run the following command to deploy your LayerZero contracts:
npx hardhat lz:deploy

Selecting Chains

You will be prompted to select which chains to deploy to:
info:    Compiling you hardhat project
Nothing to compile
? Which networks would you like to deploy?
Instructions:
    ↑/↓: Highlight option
    ←/→/[space]: Toggle selection
    [a,b,c]/delete: Filter choices
    enter/return: Complete answer

Filtered results for: Enter something to filter

  fuji
  amoy
  sepolia
If you wish to deploy to all blockchain networks selected, simply hit enter to continue deployment. To deselect a chain for deployment, highlight the chain and toggle the selection using the space bar or arrow keys:
Filtered results for: Enter something to filter

  fuji
  amoy
  sepolia

Adding Deploy Script Tags

Afterwards you’ll be prompted to choose which deploy script tags to use. By default, each CLI example contains a starter deploy script, with the deploy script tag being the contract name:
deploy.tags = [contractName];
The generic message passing standard for creating Omnichain Applications (OApps):
info:    Compiling you hardhat project
Nothing to compile
 Which networks would you like to deploy? bsc_testnet, amoy, sepolia
? Which deploy script tags would you like to use? › MyOApp
You will need to add a new deploy script for any new contracts added to the repo.

Running the Deployer

After selecting either all or a specific deploy script, the deployer will those contracts on your specified chains.
warn:    Will use all deployment scripts
 Do you want to continue? yes
Network: amoy
Deployer: 0x0000000000000000000000000000000000000000
Network: fuji
Deployer: 0x0000000000000000000000000000000000000000
Network: sepolia
Deployer: 0x0000000000000000000000000000000000000000
Deployed contract: MyOFT, network: amoy, address: 0x0000000000000000000000000000000000000000
Deployed contract: MyOFT, network: fuji, address: 0x0000000000000000000000000000000000000000
Deployed contract: MyOFT, network: sepolia, address: 0x0000000000000000000000000000000000000000
info: Your contracts are now deployed
You should see an output in your ./deployments folder, or have one generated, containing your contracts:
contracts / // your contracts folder
  deploy / // hardhat-deploy scripts
  deployments / // your hardhat-deploy deployments
  amoy / // network name defined in hardhat.config.ts
  MyOFT.json; // deployed-contract json
fuji / MyOFT.json;
sepolia / MyOFT.json;
test / // unit-tests, both hardhat and foundry enabled
  foundry.toml; // normal foundry.toml for remappings and project configuration
hardhat.config.ts; // standard hardhat.config.ts, with layerzero endpoint mappings
layerzero.config.ts; // special LayerZero config file (more on this later)
Your contract deployments can now be configured in your layerzero.config.ts!