TECHNOLOGY

How Does Tez Move From Tezos to Etherlink?

Have you ever wondered how tez "moves" from Tezos to the Etherlink rollup? Take a peek under the hood and learn all about it in this article!

By Claude Barde

TRILITECH

650 words, 4 minute read

Tezos-Etherlink

Moving tez between Tezos and the Etherlink rollup involves an intricate sequence of steps that ensure a secure and verifiable transfer of assets.

This process involves two smart contracts on the Tezos blockchain (the EVM Bridge contract and the Exchanger contract) and the Etherlink rollup. This article details the interactions between these three components.

General interactions #

The diagram below describes the flow of interactions happening between the EVM Bridge contract, the Exchanger contract, and the Etherlink rollup:

Step 1: Sending a token transfer request #

The exchange process begins with a user initiating a request. This request includes essential information such as the user’s Etherlink address, and the rollup address where the tokens will be minted.

The amount of tez that they wish to bridge must also be attached to the transaction and sent along.

Step 2: EVM Bridge contract - Deposit entrypoint #

Upon receiving the request, the EVM Bridge contract on the Tezos blockchain executes the deposit entrypoint.

This entrypoint is responsible for creating a transfer request and sending a mint transaction to the Exchanger contract.

The storage is updated to represent the tokens, while a transaction is sent to the Exchanger contract to mint the ticket representing the recipient of the tokens on Etherlink and the address of the Etherlink rollup.

The transaction also includes a callback to the EVM Bridge with the minted ticket.

–> Check the code

Step 3: Minting request #

Once the storage of the EVM Bridge contract is updated, a transaction is sent to the Exchanger contract to mint a ticket.

The ticket represents a claim or voucher for the tez sent in the previous step and attached to this transaction. It is an essential component that facilitates the exchange of value between the Tezos L1 and Etherlink.

Step 4: Exchanger contract - Mint entrypoint #

The mint entrypoint in the Exchanger contract receives the minting request from the EVM Bridge contract and acknowledges the deposit.

It then proceeds to create a ticket representing the amount of tokens locked in the EVM Bridge contract. The tez are locked in the Exchanger contract.

The ticket is then sent back to the EVM Bridge contract using the callback provided in the previous transaction.

–> Check the code

Step 5: Callback to the EVM Bridge contract #

A transaction is sent back from the Exchanger contract to the EVM Bridge contract holding the ticket representing the locked tez.

Step 6: EVM Bridge contract - Callback entrypoint #

Following the successful minting and sending of the ticket, the callback entrypoint on the EVM Bridge contract is invoked.

This step checks that the storage was previously updated to request a ticket minting. The user’s Etherlink address and the address of the Etherlink rollup are retrieved from the storage and a transaction is sent to the rollup to deposit the newly created ticket.

The storage is then reset in order to accept new tez transfer requests.

The EVM Bridge contract calls the depositTicket entrypoint of the Etherlink rollup with the ticket and the Etherlink address of the recipient as a parameter.

This operation is crucial as it represents the transfer of tez to the Etherlink rollup.

Finally, the Etherlink rollup acknowledges the deposit of the ticket. This marks the completion of the exchange process.

The user’s tez have now been successfully exchanged for the corresponding amount of tokens within the Etherlink ecosystem, which are represented in a token format compatible with the Ethereum Virtual Machine (EVM).

Conclusion #

The sequence of steps from the initiation of the token exchange request to the final deposit on the Etherlink rollup ensures a robust and interoperable token transfer mechanism.

This interoperability is key to facilitating a fluid movement of assets between the Tezos L1 and Etherlink, providing users with the flexibility and benefits of an integrated blockchain ecosystem.