How to migrate DApps from Ethereum to TomoChain?

This tutorial shows how easy it is to migrate a DApp running on Ethereum to TomoChain in order to use the many unrivaled features and advantages that TomoChain has over Ethereum.

TomoChain Publisher
TomoChain
5 min readJul 25, 2019

--

What’s a DApp?

Ethereum DApps are built on smart contracts deployed onto the Ethereum blockchain where Ethereum serves as the back-end for the application. One of the most popular DApps — Cryptokitties, is collectibles-style Dapp built on Ethereum. When we build a game with Ethereum, essentially, each game action and transaction is be stored on the Ethereum blockchain.

What’s TomoChain?

In short, TomoChain is an innovative solution to blockchain scalability and functionality. TomoChain supports all EVM-compatible smart-contracts, which basically means that every DApp run on Ethereum can be easily ported to TomoChain.

Every DApp running on Ethereum can be easily ported to TomoChain!

Why should developers build DApps on TomoChain?

TomoChain is a blockchain built for practical decentralized applications.

Remember CryptoKitties in 2017? A single DApp brought the whole Ethereum blockchain to their knees. The network was congested, with endless waiting times for transaction confirmation and high transaction fees. Porting to TomoChain would seem a good idea for the cute kitties. TomoChain mainnet can process 2'000 TPS, which is 100x faster than the Ethereum blockchain, and for a fraction (1/1000) of the cost of DApps on Ethereum. Furthermore, the whole TomoChain ecosystem is also quickly evolving, which makes it become an ideal platform for DApp development.

For more information about TomoChain, please refer to our website.

Introduction

In this tutorial, we will see how easy it is to migrate the TomoRPS (source code can be found here and here) game from Ethereum to TomoChain in 1 hour.

The migration consists of 3 steps:

  1. Remove some configs of Ethereum network and replace by TomoChain network in Truffle project.
  2. Compile & deploy a smart contract to TomoChain networks.
  3. Update old client and testing the game :)

Below is Video showing that TomoRPS was slow and had bad user experience because of the low performance of Ethereum.

Remove some configs of Ethereum network and replace by TomoChain network in Truffle project

Take a look at our current truffle-config.js.

We have 2 configs for deploying the smart contract to Ropsten Testnet and Ethereum Mainnet.

To deploy the same contract onto TomoChain, let’s change the configuration to connect to the TomoChain network. Check TomoChain Network document, we can find all configs of TomoChain networks easily. The configuration change basically tells Truffle to connects to TomoChain and deploy the contract on it instead of Ethereum.

Finally, we have the updated truffle-config.js.

Compile & deploy a smart contract to TomoChain networks

Now, it’s a good time to compile the smart contract with TomoChain networks.

  • Run command truffle compile
  • Migrate the contract to TomoChain Testnet network:

truffle migrate --network tomotestnet

After a few seconds, the smart contract will be migrated successfully to TomoChain Testnet.

Update client to interact with TomoChain smart contract

This is the easiest step. We only need to change old smart contract address to new address on TomoChain and update our client (text, icon, logon…) to match with TomoChain.

ADDRESS_CONTRACT: “0xb7cEb47FbD0f6f98E16E681eb3933B7801a1ce43”

You can go to TomoScan Testnet to verify the contract deployment.

Testing

Let’s get some faucet TOMO from the faucet page.

Connect MetaMask to TomoChain Testnet by following this guide.

You can even play the game with TomoWallet through our built-in DApp Browser, which provides the best user experience for gamers.

And enjoy the game running on TomoChain and taste how fast and cheap transactions on TomoChain are.

Below is the video showing how fast TomoRPS is on TomoChain.

Conclusion

It will not be too difficult and won’t take much time to migrate your DApps from Ethereum to TomoChain. Along with that DApps running on TomoChain has many advantages in speed and cost. So don’t hesitate to bring your DApps to TomoChain where you can make your DApps great again… 😎

Github: https://github.com/tomochain/docs/blob/game_tutorials/docs/developers/migrate_from_ethereum.md

About TomoChain

TomoChain blockchain and product ecosystem allow entrepreneurs, enterprises, and institutions to build high-performance, feature-rich blockchain projects on an enhanced EVM-compatible platform. An array of original features and protocols is designed to support users’ speed, privacy, usability, and liquidity needs all in one platform.

TomoChain is built on a performance layer that achieves high transaction speeds without compromising decentralization. TomoChain uses an innovative consensus method called POSv (Proof of Stake Voting) which gives an incentive to all TomoChain token-holders to play an active part in staking across a network of 150 high-quality masternodes, and to monitor their performance and governance actively. Its staking-governance Dapp, TomoMaster, is recognized as one of the leading staking platforms in the industry.

TomoChain flagship products are:

  • TomoZ — Zero Friction Protocol — the first on-chain protocol that offers the ability for any user to pay transaction fees with the same token the user is holding
  • TomoX — a secure and efficient relayer-masternode decentralized cryptocurrency exchange protocol that empowers a diverse system of relayers, MM providers, and independent projects to work together

TomoChain contact

Follow us on TomoChain Announcement Channel | Twitter | Facebook | LinkedIn | Reddit | Github | Sign up for our newsletter on Website

For General support: TomoChain Chat

For Technical support: Gitter

--

--