Designing a Cross-Chain Token Bridge with LayerZero v2
Cross-chain interoperability is one of the harder Web3 problems. Here is the mental model behind a 1:1 token bridge built on LayerZero v2 messaging.
A token bridge does something that sounds impossible at first: it lets a token on Chain A become spendable on Chain B, without the two chains ever talking to each other directly. The trick is a trusted messaging layer, in this case, LayerZero v2.
Burn here, mint there
The cleanest 1:1 bridge model is burn-and-mint. When a user bridges, the source contract burns (or locks) their tokens and emits a cross-chain message. LayerZero delivers that message to the destination contract, which mints the equivalent amount to the user. Supply stays constant across both chains.
- Source chain: burn/lock the token and send a message via the LayerZero endpoint.
- Messaging layer: LayerZero verifies and relays the payload to the destination.
- Destination chain: the receiving contract validates the sender and mints/unlocks.
The parts that bite you
The happy path is easy. Production readiness is in the edges: verifying the message truly came from your paired contract, handling failed or stuck messages so funds are never lost, and setting gas correctly on the destination so delivery does not revert. Get those wrong and a bridge becomes a headline.
I built a 1:1 bridge on LayerZero v2 swapping a token between Sanko Chain and Arbitrum. Interoperability is genuinely hard, which is exactly why it is worth doing carefully.
Want this built into your product?
I take on freelance work across AI, voice, backend and full-stack. Tell me what you're building.
Start a project