To start building your Dapp you will need to install some programs:
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
To test npm, type
npm -vand you should see the version number, like
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 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 unboxcommand 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.
You will need a wallet address and some tokens. We will show you how to do it on both TomoChain Testnet and Mainnet.
You can create a new TOMO wallet using TomoWallet mobile app for iOS, or the web version (https://wallet.tomochain.com/#/login). Under Settings go to Advanced Settings, here you can Choose network and select
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 (tomochain.com) 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
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!
Tokens are required for different matters, like smart contract deployment or to use in Dapps.
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!
To check the balance of a wallet address, you can use TomoScan.