LayerZero v2 tutorial, Solidity

Nazreen Mohamad
Web3 for Developers
2 min readJan 15, 2024

--

This post exists to flag the right resource for those of you who search for “LayerZero v2 tutorial”, since it’s still relatively new and most search results are referencing the previous version of LayerZero.

This is a post meant for developers who need to implement LayerZero v2.

Image from LayerZero

In December 2023, a month prior to the writing of this post, LayerZero came out with the v2 of their protocol. This involved a slight change to how Solidity contracts should be written in order to use the protocol.

Here is the official LayerZero v2 Getting Started that you are looking for, on implementing v2: https://docs.layerzero.network/contracts/getting-started

It can get quite beefy, so if you’d like, you can read on for a gentle summary before you dive into LayerZero’s official getting started.

So what changed?

Several terms have changed:

  • `chainId` is no more, it is now `eid` (endpoint ID). This change came about due to v2 supporting non-EVM networks.
  • `adapterParams` is now `_options`
  • `srcAddress` is now `sender`
  • `dstAddress` is now `receiver`
  • `payload` is now `message`
  • `User Applications` is now `Omnichain Applications`

--

--