re.al docs
  • Introduction
    • Get to Know re.al
    • Relationship to Arbitrum
    • Tokenized RWAs on re.al
  • re.al Chain
    • Arbitrum Orbit Overview
    • Block Explorer
    • Run a Node
    • Governance
    • Security
    • Contracts & Addresses
  • Get Started
    • reETH: Native Token
    • Get Started
    • Asset Bridging
    • Network Guides and Videos
      • How to Bridge to re.al
      • How to Lock $RWA
      • How to Bridge from re.al (to Ethereum and L2s)
  • RWA Token
    • Overview
    • RWA Tokenomics
      • Reporting veRWA APY
    • Managing veRWA
    • stRWA and wstRWA
    • RWA Rewards Program
      • Overview and Goals
      • Program Specifics
      • Referrals
      • Calculating Points
    • Migration
    • Contracts
      • RWA Technical
      • stRWA Technical
  • Build on re.al
    • Start Building
    • Faucet
    • Smart Contracts
      • Write a Contract
      • Deploy Using Hardhat
      • Verify Contracts
  • Services
    • Services
    • Account Abstraction
      • Safe Account Abstraction
    • Automation & Off-chain Data
      • Gelato Web3 Functions
    • Bridges
      • Layer Zero
    • Indexers
      • Goldsky
    • Oracles
      • Redstone on re.al
    • Relay
      • Gelato Relay
    • VRF
      • Gelato VRF
    • Wallet as a Service
      • Privy
      • Web3Auth
Powered by GitBook
On this page
  • Getting Started
  • Prerequisites
  • Deploying your Contracts
  • Connecting your Contracts
  1. Services
  2. Bridges

Layer Zero

LayerZero is a messaging protocol, not a blockchain. Using smart contracts deployed on each chain, in combination with Decentralized Verifier Networks (DVNs) and Executors, LayerZero enables different blockchains to seamlessly interact with one another.

Getting Started

To start sending omnichain messages with LayerZero, you only need to implement two functions:

  • _lzSend: This function is used to send a message to a different chain.

_lzSend(
  _dstEid, // the destination endpoint id
  _payload, // encoded message payload being sent
  _options, // message execution options
  MessagingFee(msg.value, 0), // the fee in native gas and ZRO token
  payable(msg.sender) // refund address in case of failed source message
);
  • _lzReceive: This function is used to receive a message from a different chain.

function _lzReceive(
  Origin calldata _origin, // struct containing srcEid, sender address, and the message nonce
  bytes32 _guid, // global message packet identifier
  bytes calldata payload, // encoded message being received
  address _executor, // the address of who executed the message
  bytes calldata _extraData // appended executor data for the call
) internal override {
  data = abi.decode(payload, (string)); // your receive logic here
}

LayerZero offers Contract Standards that simplify this implementation by providing out of the box message handling, interfaces for custom protocol configurations, and other quality of life improvements:

Prerequisites

  1. You should first be familiar with writing and deploying contracts to your desired blockchains. This involves understanding the specific smart contract language and the deployment process for those chains.

  2. A wallet set up and funded for the chains you'll be working with.

Deploying your Contracts

Connecting your Contracts

To connect your contracts, call setPeer and pass the address of your destination contract as a bytes32 value, as well as the destination endpoint ID. If successful, you now should be setup to start sending cross-chain messages!

PreviousBridgesNextIndexers

Last updated 1 year ago

: the base contract standard for omnichain messaging and configuration.

: the base contract standard for omnichain messaging and configuration.

To learn how to deploy your contracts, please refer to the section.

To checkout endpoint addresses please refer to the section in the LayerZero docs.

To go more in depth, please refer to the section in the layerzero docs.

OApp
OFT
Deploying Contracts
Endpoints
Getting Started