Skip to content

Layer Zero

LayerZero is an interoperability protocol designed to link blockchains, enabling developers to create fluid omnichain applications, tokens, and experiences. Utilizing immutable on-chain endpoints, a customizable Security Stack, and an open set of Executors, the protocol facilitates the transfer of censorship-resistant messages across chains.

Implementation Example

The following example shows how to create and bridge an ERC-20 token between SKALE Europa testnet and Mumbai Testnet.

For more information check the github repository created by the SKALE team.

  1. Repository clone
    Terminal window
    git clone https://github.com/TheGreatAxios/skale-layerzero-examples.git && cd skale-layerzero-examples/oft-example
  2. Package Install
    Terminal window
    pnpm install
  3. .env file
    1. Rename .env.example -> .env

    2. Choose your preferred means of setting up your deployer wallet/account

      Terminal window
      MNEMONIC="test test test test test test test test test test test junk"
      or...
      PRIVATE_KEY="0xabc...def"
  4. Contract deploy
    Terminal window
    npx hardhat lz:deploy

    With the ERC-20 contracts deployed on the desired chains we can enable bridging those asserts.

    This is a two step process. The created examples are under the scripts folder and it shows the bridging tokens between two testnet chains Mumbai Testnet and SKALE Europa Testnet.

    Once you’ve finished configuring your OFT, you can open the messaging channel and connect your OFT deployment to different chains by calling setPeer.

  5. Set Peer
    Terminal window
    npx hardhat setpeer --origin <origin_chain_name> --destination <destination_chain_name> --network <chain_where_tx_will_be_initiated>
  6. Bridge

    After setting the peers you can now proceed you bridging the tokens.

    Terminal window
    npx hardhat bridge --origin <origin_chain_name> --destination <destination_chain_name> --amount <amount_to_bridge> --network <chain_where_tx_will_be_initiated>

Additional Layer Zero Documentation

Click here for the official documentation.