Lamina1 Teleporter Token Bridge
Sending tokens outside of the Lamina1 network will be disabled during the initial Mainnet launch period. This functionality will go live as soon as audits for sending in between networks are complete and the OMF activates the necessary infrastructure.
That said, to empower this ability, the Lamina1 core team has already built a bridge using Avalanche Warp Messaging (AWM) and the AvaLabs Teleporter Token Bridge contracts to allow users to send native or ERC20 tokens from a source chain to multiple destination chains on the Lamina1 network.
For interested builders and developers, we’ll provide an overview of the bridge below.
Avalanche Warp Messaging (AWM) is a protocol that enables sending data trustlessly between subnets on the Avalanche network. The only requirement is that validators of a subnet register their BLS public keys on the Avalanche P chain. The P chain maintains the validator set of each subnet, as well as which subnets exist and blockchains on said subnets. Validators on a subnet can verify a message sent by validators of a different subnet by looking up the BLS public keys on the P chain, and then verifying the BLS signature that is sent together with the message as part of the AWM protocol. In order to allow AWM to be used within EVM execution, Avalanche developed a warp messaging precompile contract, which is active on the C chain as of the Durango upgrade. Furthermore, this precompile can also be activated on the subnet-evm codebase, which is used to launch EVM compatible subnets.
The Teleporter protocol is built on top of AWM and provides a developer-friendly interface for sending and receiving cross-chain messages from within the EVM. Amongst the features it provides, the highlights are replay protection and relay incentivization via fees collected in ERC20 tokens.
A diagram of the token bridges that will be used at Lamina1 Mainnet launch to send both L1 ERC20 and AVAX back and forth between the Avalanche C-chain and the Lamina1 subnet is below.
Sending L1 ERC20 from the C-chain to native L1 in the Lamina1 Subnet
- User calls send function with destination, amount and fee on ERC20Destination contract
- Fee payment
- Transfer L1 ERC20 fee from user to the contract (in this case, the ERC20Destination contract itself IS the ERC20)
- Increase allowance for Teleporter Messenger to pay fee to relayer after message is delivered to destination chain
- Transfer amount
- Transfer L1 ERC20 amount from the user to the contract
- Send Teleporter message using the Teleporter Registry, which in turn calls the Teleporter Messenger contract
- Teleporter Messenger contract creates warp message and calls the WARP precompile
- Relayer listens to WARP message + Teleporter message events
- Relayer submits transaction
- Gather BLS signatures from validators of the source subnet (C-chain)
- Combine signatures into a single BLS signature for the Warp message
- Send a transaction that contains both the Warp message and the Teleporter message (interacts with both WARP precompile and Teleporter Messenger contracts)
- Deliver message
- Teleporter Messenger validates the message
- If valid, calls receive Teleporter message function on the NativeTokenSource contract
- Send to destination
- NativeTokenSource validates the message
- If valid, it transfers native L1 coins to the destination
**NOTE: **The Avalanche Teleporter implementation has the concept of a multi-hop: users can send a token from a destination chain to another via the source chain. This functionality is not going to be used at Lamina1 Mainnet launch. However, the addition of configurable fees required some modifications to the multi-hop flow, since fee tokens for each hop have to be specified at the sending time, but live on separate chains (primary fee on the source of the message, secondary fee on the chain of the first hop). This means that it’s possible that a user sends a multi-hop message without having enough tokens to pay the secondary fee, since the source contract can’t check the balance of this token, as it lives on a separate chain.
For now, the implementation of be Teleporter into Lamina1 will allow the transfer of L1 and AVAX tokens to other accounts across the Lamina1 and Avalanche networks. As the Lamina1 platform expands, additional tokens will be supported and the technology can be used to empower increasing cross-chain connectivity and utility between multiple blockchains.