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
Lock-and-Mint Model
The bridge uses LayerZero’s OFT (Omnichain Fungible Token) standard:
- Ethereum (home chain):
BridgeOFTAdapterlocks ERC20 tokens when bridging out, unlocks when bridging back. - L2 chains:
BridgeOFTmints synthetic tokens on receive, burns on send. No pre-minted supply.
Total supply is always conserved: locked on Ethereum = minted across L2s.