What is a good way to swap tokens from the Ethereum host network to a different network (i.e. the Tron blockchain)?

Would the best way to do this be to have a smart contract where ERC20 token holders would have to send their tokens and also declare a Tron wallet address to create a public mapping and an array of public keys belonging to the token holders who executed the mapping? Perhaps those two elements can be iterated over off-chain to distribute tokens on the new network? I'm concerned because I don't know if this is the most optimal approach or if it is possible to read and return the on-chain data of an array with a lot of variables due to gas costs? Thanks!

1 Answer 1


The method you described would work. A cost optimization would be to log an event whenever a user sent their tokens to the contract. This would remove the requirement for both an array and a mapping. When attempting to read the data off-chain (for the swap to the other token), you can simply read each event that occurred on that contract. An example would be:

event Swap(address indexed _from, bytes indexed _to, uint256 indexed _amount)

The _to parameter above would be the address of the user on the new chain.

As a note, I believe this is similar to how the ETH1 to ETH2 transition will work.

You can also look at historical examples that have happened and may be applicable to your situation.

EOS created an ERC20 on Ethereum and swapped it for tokens on the EOS network. To do so, they partnered with exchanges to perform the swap for non-US residents.

If your tokens were not on an exchange, you would have had to register your tokens on the EOS site and then perform a swap based on your registered address, similar to your proposal. More information can be found here. This worked by taking snapshot of the network at a given time and using the Ethereum public address as a function of the EOS address. You can read more details here.

One other example is USDT swaps. USDT lives on a few networks—Ethereum, Omni, and Tron, to name a few. These assets get swapped across chains constantly. This is possible because of its centralization, which is something that may not be possible in your case.

To perform a USDT chain swap, you must first make a deal with the Tether team to work out the specifics. A swap then consists of sending USDT on one chain to the Tether team, and them subsequently sending you USDT on the other chain.

Atomic swaps are yet another option. You can read about them here.

These swaps require a level of coordination and a shared secret between parties but can be thought of (from a top-level) as a simple transfer between chains. It requires a concept of a Hashed Timelock Contract, but is possible depending on your use case.

Additional information may be found here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.