ERC20 Messaging dApp

It is time to take your first steps with the Topos Testnet and get familiar with the mechanics of using and developing with Topos. To do so, you will use a basic dApp provided by Topos: the Topos ERC20 Messaging dApp. It is a sample application that allows you to experience Topos as a user transfering funds from one blockchain to another. Later, you can find out more about the actions that are triggered and executed on the public testnet during your test.

Visit the ERC20 Messaging dApp

Note

Please make sure you have installed MetaMask before continuing.

With MetaMask installed, you can navigate to ERC20 Messaging:

dApp first page

You are now going to complete a cross-subnet, fungible token transfer from the Topos Subnet to the Incal subnet.

1

First, you must connect MetaMask with the Topos ERC20 Messaging dApp:

The ERC20 Messaging dApp will display your address in the right top corner after the ERC20 dApp is connected to your wallet:

Each time you pick up a sending subnet it will be automatically added to MetaMask, if it is the first time you attempt to do so.

Add Topos to your networks:

Add Incal too:

If the network is already added to MetaMask, it will just ask for permission to switch the network. For example, for Topos:

Or for Incal:

2

In either case, select the Incal subnet in the dApp:

3

Register a token, here named testToken:

Faucet

In order to register tokens on the subnets, you will need to pay fees on both subnets. Use the Topos Faucet to get some:

Make sure that the tokens are sent:

Tokens sent

Now you can pay the necessary fee for a token registration (e.g. for the Incal subnet):

4

Repeat these steps for the Topos Subnet.

5

With both token setups done, you can try your first cross-subnet token transfer:

Incal page
6

The ERC20 Messaging dApp will list the different steps involved in the cross-subnet transfer process:

First, approve the actions:

Note

A cross-subnet ERC20 token transfer involves you approving several actions:

  1. Make allowance for token burn by sending an approve transaction to the token contract you deployed during registration of a new token. This step is not always required (for example, if you did not hit the maximum you set in this step during the next step).
  2. Burn tokens on the Incal subnet and emit an event by sending a sendToken transaction to ERC20Messaging contract.

The ERC20 Messaging dApp will wait for the transaction to be executed:

It should give you a success message, like the following:

Congratulations! You have completed your first cross-subnet token transfer.

Troubleshooting

Under the hood

The following steps describe what actually happened:

  1. The ERC20 Messaging frontend deployed a token contract on each subnet for the token you registered on it.
  2. To make a cross-subnet transfer, the dApp submitted a transaction to the Incal subnet to burn the transferred tokens there.
  3. Next, the sending subnet (Incal) prepares the input data for the ZK proof and submits it to the prover cluster by way of the Sequencer (for the testnet the prover is not active)
  4. The sequencer prepares the Certificate and broadcasts it to the TCE network.
  5. In parallel, the ERC20 frontend made a request to the executor service containing a Merkle proof of the Incal transaction (proof of inclusion of its receipt in the receipt trie of the certified state transition) and the root of the transaction trie, which is used by the ERC20Messaging contract to retrieve the certificate from the ToposCore contract.
  6. Once the receiving side (the Topos Subnet in this case) has taken delivery of the Certificate from its dedicated TCE node and the context-specific information from the executor service, it can proceed to mint the transferred tokens.

Note: In the current iteration of the testnet, no ZK proofs are actually computed and TCE nodes are implemented as part of the Topos Subnet validators.

Up next

You have invoked your first cross-subnet token transfer with Topos. In the next section, you will use Topos Explorer to see the certificates that were created.