Setup Environment


To start building your Dapp you will need to install some programs:
  • Install Node.js & npm (“Node.js Package Manager”)
  • Install Git
To check that Node is installed properly, open a console (admin PowerShell on Windows) and type node -v. This should print a version number, like v10.15.0.
To test npm, type npm -v and you should see the version number, like 6.4.1.

Getting Started: Installation

Truffle Framework is a great tool for developing Dapps. You can use Truffle to deploy your smart contracts to TomoChain.
We only need this single command to install Truffle, the popular development framework for Ethereum.
npm install -g truffle
You can verify that Truffle is correctly installed typing truffle version.

Creating a Truffle project

Truffle initializes in the current directory, so first create a directory in your development folder of choice and then move inside it.
mkdir pet-shop-tutorialcd pet-shop-tutorial
Let’s see how to create a Truffle project. There are two options. You can create a bare new project from scratch with no smart contracts included, and the other option for those just getting started, you can use Truffle Boxes, which are example applications and project templates.
Pet Shop Truffe Box
There is a special Truffle Box for this tutorial called pet-shop, which includes the basic project structure as well as code for the user interface. Use the truffle unbox command to unpack this Truffle Box:
truffle unbox pet-shop
The default Truffle directory structure contains a series of folders and files. If you want to know more, please check Truffle tutorials.
Note: This tutorial is focused on the whole process to build a Dapp on TomoChain, so we will not enter into all the details.

Creating a TOMO Wallet

You will need a wallet address and some tokens. We will show you how to do it on both TomoChain Testnet and Mainnet.

1. Create a TOMO wallet and save your Mnemonic

You can create a new TOMO wallet using TomoWallet mobile app for iOS, or the web version ( Under Settings go to Advanced Settings, here you can Choose network and select TomoChain TestNet or TomoChain [mainnet].
Go to Settings menu, select Backup wallet and then Continue. Here you can see your wallet’s private key and the 12-word recovery phrase. Write down the 12-word recovery phrase.
You can also create a new TomoChain wallet with MetaMask, MyEtherWallet or TrustWallet. For instance, for mainnet you can go to MyEtherWallet and select TOMO ( on the top right corner. Enter a password and then Create a new wallet. Write down your recovery phrase.
For this tutorial, my wallet address (testnet) is:
My recovery phrase (12-word mnemonic) is:
myth ahead spin horn minute tag spirit please gospel infant clog camera
Write them down. This will be needed later. Notice that your wallet address (public key) and your recovery phrase will be different than mine.
Important! Always keep your private key and recovery phrase secret!

2. Get some TOMO funds

Tokens are required for different matters, like smart contract deployment or to use in Dapps.
Testnet: Receive 15 free testnet TOMO tokens using TomoChain’s Faucet.
Mainnet: You need real TOMO tokens from exchanges.
Go to faucet and collect 30 TOMO. Now your wallet has enough balance to do everything in this tutorial so… let’s go ahead!

3. The Block Explorer

To check the balance of a wallet address, you can use TomoScan.