L1 & L2 Bridging
Last updated
Last updated
The Wischain bridge facilitates the transfer of ETH, ERC20 tokens, NFTs, and arbitrary messages between Layer 1 (L1) and Layer 2 (L2). It acts as a secure mechanism for moving various digital assets across these two layers, enhancing user experience and asset fluidity.
To enable the transfer of ETH and ERC20 tokens, the Wischain bridge employs a Gateway Router contract. This contract manages the seamless movement of these assets between L1 and L2, allowing users to transfer their Ethereum-based tokens effortlessly.
For non-fungible assets, the bridge incorporates the ERC721 and ERC1155 Gateway. This functionality allows users to transfer NFTs between L1 and L2, ensuring that digital collectibles can be easily moved without loss of value or ownership.
Beyond token transfers, the Wischain Messenger contract facilitates cross-chain contract interactions. This feature allows smart contracts on one network to communicate and interact with contracts on the other network through the Wischain Messenger contract. Such capabilities significantly enhance the potential for decentralized applications (dApps) and smart contracts to function seamlessly across both networks, broadening the scope of applications and user engagement within the Wischain ecosystem.
There are many entry points from the user to the Wischain bridge. This will depend on what you want to do and how you want to do it. If you want to send ETH or ERC20 tokens, you should use the GatewayRouter
. If you want to send NFTs, you should use the L1ERC721Gateway
or L1ERC1155Gateway
. If you want to send arbitrary data, you should use the L1WischainMessenger
. All Gateway transfers use the Wischain Messenger to send assets cross-chain, whose job is to append the transactions to the Message Queue for L2 inclusion.
The L2 Gateway Architecture shares several similarities with the Layer 1 (L1) framework, particularly concerning permissionless callable entry points. However, a notable distinction arises when sending messages from Layer 2 (L2). In this architecture, the appendMessage
function is utilized to store messages within an append-only binary Merkle tree, commonly referred to as the withdraw tree, which is housed in the L2MessageQueue.
When a new message is dispatched to the L2MessageQueue, the relayer detects this action and records the message in the database. Upon finalization of a block, the system generates a proof of the new Merkle path and forwards it to the Wischain Geth node for execution on the WischainMessenger. All finalized withdraw roots are securely stored within the rollup contract, allowing for verification of the proof against these roots.
Looking ahead, future versions of Wischain aim to eliminate the need for a relayer, enabling users to finalize transactions on Layer 1 directly, thus enhancing the system's decentralization and efficiency.
In the following sections, we will delve into the technical specifications of the bridge, focusing on the smart contract API necessary to leverage its functionalities. Comprehensive guides, complete with code examples, will be available in the Developer Guides section to support developers and users in understanding and implementing these capabilities effectively.