Building a Cross-Chain Token Bridge with LayerZero V2

We built a cross-chain ERC20 token bridge using LayerZero V2. It moves BRG tokens across Ethereum, Arbitrum, Base, and Optimism — 12 directional pathways, all trustless, with multi-DVN verification. This post walks through the actual code. The full source is at github.com/gnuser/brg-bridge.

Architecture

/images/brg-bridge-architecture.svg

Lock-and-Mint Model

The bridge uses LayerZero’s OFT (Omnichain Fungible Token) standard:

  • Ethereum (home chain): BridgeOFTAdapter locks ERC20 tokens when bridging out, unlocks when bridging back.
  • L2 chains: BridgeOFT mints synthetic tokens on receive, burns on send. No pre-minted supply.

Total supply is always conserved: locked on Ethereum = minted across L2s.

LayerZero Deep Dive: The Omnichain Interoperability Protocol

LayerZero is the leading omnichain interoperability protocol, connecting 70+ blockchains with 130M+ cross-chain messages delivered. Backed by $263M from a16z and Sequoia at a $3B valuation, it has attracted 35,000+ developers and 50,000+ deployments. We conducted a full market + technical deep dive. Here’s what we found.

V2 Architecture

LayerZero V2 (launched 2024) was a major overhaul. The old Oracle+Relayer model — widely criticized for centralization — was replaced with Decentralized Verifier Networks (DVNs). The core Endpoint contracts are now immutable: no admin keys, no upgrades, no governance attacks.

LayerZero 深度调研:全链互操作协议

LayerZero 是领先的全链互操作协议,连接 70+ 条区块链,已传递超过 1.3 亿条跨链消息。获得 a16z 和红杉资本 2.63 亿美元投资,估值 30 亿美元,吸引了 35,000+ 开发者和 50,000+ 部署。我们进行了完整的市场和技术调研,以下是核心发现。

V2 架构

LayerZero V2(2024 年上线)是一次重大升级。被广泛批评为中心化的 Oracle+Relayer 模型被替换为去中心化验证者网络(DVN)。核心 Endpoint 合约现在是不可变的:没有管理员密钥,没有升级,没有治理攻击。

核心创新:每个应用选择自己的安全配置。你可以选择哪些 DVN 来验证消息 — Google Cloud DVN、Polyhedra ZK DVN,或者运行自己的。这与竞品的协议级统一安全模型有本质区别。

竞争格局

协议 链数 安全模型 优势
LayerZero 70+ 应用可配置 DVN 灵活性 + 覆盖范围
Wormhole 30+ Guardian 多签 (13/19) Solana 生态
Chainlink CCIP ~20 Chainlink 预言机网络 机构信任
Axelar 50+ dPoS 验证者 Cosmos 生态
Hyperlane 35+ 无许可 ISM 可定制性

LayerZero 的护城河是最大的链覆盖范围、应用可配置安全性和不可变核心协议的组合。一旦协议在 LayerZero 上部署 OFT,切换成本很高。

Markdown Test

Heading 1

This is a heading 1 test.

Heading 2

This is a heading 2 test.

Heading 3

This is a heading 3 test.

Bold text and italic text.