How does the LyLx Bridge work in general?

Created by Sourajyoti Gupta, Modified on Thu, 30 Nov 2023 at 07:01 PM by Sourajyoti Gupta

LxLy is basically a tool that allows users to bridge assets between L1( Ethereum) and L2 (Polygon zkEVM). It's a marvel of blockchain interoperability.  The LxLy bridge's modular design enables its deployment across various chains, ensuring a versatile bridge for L1 to L1, L1 to L2, L2 to L2, L2 to L3, and so on.

The overall process involved in LxLy is:

  1. Deposit on L1:

    1. You start by sending assets to a special contract called PolygonZkEVMBridge on Ethereum L1.

    2. You specify details like the destination network (L2), your L2 address, the amount of assets, and the token contract address.

    3. Inside the contract, it checks if the destination is valid and handles Ether and ERC-20 tokens differently.

  2. Updating Records:

    1. The contract keeps records of your deposits and ensures their security.

    2. If necessary, it updates a global record to show your assets are ready to move.

  3. Transaction to L2:

    1. After a while, the records are updated on L2, often through a Sequencer.

    2. The L2 network checks this update, confirming your assets are now ready on L2.

  4. Claim on L2:

    1. You can then prove that the assets are yours on L2 by providing proof.

    2. You submit a transaction on L2 to claim your assets using the PolygonZkEVMBridge contract.

  5. Completion:

    1. The contract checks your proof and ensures the assets haven't been claimed before.

    2. It transfers your assets (Ether or tokens) accordingly.

    3. An event confirms the successful claim and your assets are now on L2.

In summary, the LyLx Bridge is a versatile solution for connecting different blockchain networks, and it operates through a series of steps involving smart contracts, records, and verification mechanisms.


GitHub repo for LyLx: https://github.com/0xPolygonHermez/code-examples/tree/main/customERC20-bridge-example

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article