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
Please make sure you have installed MetaMask before continuing.
With MetaMask installed, you can navigate to ERC20 Messaging:
You are now going to complete a cross-subnet, fungible token transfer from the Topos Subnet to the Incal subnet.
First, you must connect MetaMask with the Topos ERC20 Messaging dApp:
If you have not already done so, you will have to connect the ERC20 Messaging dApp to MetaMask and add the Topos and Incal subnets to your MetaMask wallet. To do this, follow the steps in our How to add Topos and Incal to MetaMask guide.
If you had previously following that guide, but you had performed the manual procedure, then you will still need to connect the dApp to MetaMask. If the upper right corner of the ERC20 Messaging dApp page looks like this, with a 'Connect to MetaMask' button:
Then click the 'Connect to MetaMask' button and follow the instructions to connect the dApp to MetaMask.
Once the ERC20 Messaging dApp is displaying your address in the right top corner, the ERC20 dApp is connected to your wallet.
Additionally, you will want to have requested tokens from the Topos Faucet. If you have not done this yet, please follow the instructions in our How to use the Faucet to get Testnet Tokens guide to do this.
Repeat these steps for the Topos Subnet.
The ERC20 Messaging dApp will list the different steps involved in the cross-subnet transfer process:
First, approve the actions:
A cross-subnet ERC20 token transfer involves you approving several actions:
- 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).
- 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.
Under the hood
The following steps describe what actually happened:
- The ERC20 Messaging frontend deployed a token contract on each subnet for the token you registered on it.
- To make a cross-subnet transfer, the dApp submitted a transaction to the Incal subnet to burn the transferred tokens there.
- 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)
- The sequencer prepares the Certificate and broadcasts it to the TCE network.
- 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.
- 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.