TomoChain Private Testnet Setup

This tutorial shows how to set up a private TomoChain Testnet on a local machine. The purpose is to help developers to familiarise themselves with TomoChain's source code and initial setup.
The following will walk you step-by-step to setup a TomoChain private net with three Masternodes.

Install Golang

set GOROOT=$HOME/usr/local/go

Prepare TomoChain Client Software

  • cd $GOPATH/src/
  • Download source code and build
git init
git remote add [email protected]:tomochain/tomochain.git
git pull origin master
make all
  • Create shortcuts/alias for easier access
alias tomo=$GOPATH/src/
alias bootnode=$GOPATH/src/
alias puppeth=$GOPATH/src/

Setup Chain Fata Folders datadir and Corresponding keystore Folders for 3 Masternodes

mkdir $HOME/tomochain
mkdir $HOME/tomochain/nodes
mkdir $HOME/tomochain/nodes/1 $HOME/tomochain/nodes/2 $HOME/tomochain/nodes/3
mkdir $HOME/tomochain/keystore/1 $HOME/tomochain/keystore/2 $HOME/tomochain/keystore/3

Initialize / Import Accounts For the Masternodes's Keystore

  • Initialize new accounts: If there are existing accounts and a preference to import them, please ignore this step and go to Import Accounts
tomo account new \
--keystore $HOME/tomochain/keystore/1
tomo account new \
--keystore $HOME/tomochain/keystore/2
tomo account new \
--keystore $HOME/tomochain/keystore/3
  • Import accounts
tomo account import [PRIVATE_KEY_FILE_OF_YOUR_ACCOUNT] \
--keystore $HOME/tomochain/keystore/1 \
Repeat this step to import two more private keys for our three masternodes.

Customize Genesis Block by Using the puppeth Tool

  • Run puppeth command and answer questions about your private chain as follows:
  • Set chain name
> localtomo
Private chain name
  • Enter 2 to configure new genesis
  • Enter 3 to select POSV consensus
  • Set blocktime (default 2 seconds)
  • Set reward of each epoch
  • Set addresses to be initial masternodes
  • Set number of blocks of each epoch (default 900). If you would like to customize epoch number, please update code here common/constants.go:14 EpocBlockRandomize = 900
  • Set gap (How many blocks before checkpoint need prepare new masternodes set ?)suggestedGap = 5
  • Enter foundation address which you hold private key
POSV configurations
  • Enter accounts which you control private keys to unlock MultiSig wallet
MultiSig wallet setting
  • Enter swap wallet address for fund 55 million TOMO
Initial funds
  • Export genesis file - Select 2. Manage existing genesis - Select 2. Export genesis configuration - Enter genesis filename
Export genesis file
  • Control + C to exit

Initialize Your Private Chain with Above Genesis Block

tomo --datadir $HOME/tomochain/nodes/1 init [PATH/TO/GENESIS_FILE]
tomo --datadir $HOME/tomochain/nodes/2 init [PATH/TO/GENESIS_FILE]
tomo --datadir $HOME/tomochain/nodes/3 init [PATH/TO/GENESIS_FILE]

Setup Bootnode

  • Initialize bootnode key
bootnode -genkey bootnode.key
  • Start bootnode and copy bootnode information
bootnode -nodekey ./bootnode.key

Start Masternodes

  • Start Masternode 1
tomo --syncmode "full" \
--datadir $HOME/tomochain/nodes/1 --networkid [YOUR_NETWORK_ID] --port 10303 \
--keystore $HOME/tomochain/keystore/1 --password [YOUR_PASSWORD_FILE_TO_UNLOCK_YOUR_ACCOUNT] \
--rpc --rpccorsdomain "*" --rpcaddr --rpcport 1545 --rpcvhosts "*" \
--rpcapi "db,eth,net,web3,personal,debug" \
--gcmode "archive" \
--ws --wsaddr --wsport 1546 --wsorigins "*" --unlock "[ADDRESS_MASTERNODE_1]" \
--identity "NODE1" \
--mine --gasprice 2500 \
  • Start Masternode 2
tomo --syncmode "full" \
--datadir $HOME/tomochain/nodes/2 --networkid [YOUR_NETWORK_ID] --port 20303 \
--keystore $HOME/tomochain/keystore/2 --password [YOUR_PASSWORD_FILE_TO_UNLOCK_YOUR_ACCOUNT] \
--rpc --rpccorsdomain "*" --rpcaddr --rpcport 2545 --rpcvhosts "*" \
--rpcapi "db,eth,net,web3,personal,debug" \
--gcmode "archive" \
--ws --wsaddr --wsport 2546 --wsorigins "*" --unlock "[ADDRESS_MASTERNODE_2]" \
--identity "NODE2" \
--mine --gasprice 2500 \
  • Start Masternode 3
tomo --syncmode "full" \
--datadir $HOME/tomochain/nodes/3 --networkid [YOUR_NETWORK_ID] --port 30303 \
--keystore $HOME/tomochain/keystore/3 --password [YOUR_PASSWORD_FILE_TO_UNLOCK_YOUR_ACCOUNT] \
--rpc --rpccorsdomain "*" --rpcaddr --rpcport 3545 --rpcvhosts "*" \
--rpcapi "db,eth,net,web3,personal,debug" \
--gcmode "archive" \
--ws --wsaddr --wsport 3546 --wsorigins "*" --unlock "[ADDRESS_MASTERNODE_3]" \
--identity "NODE3" \
--mine --gasprice 2500 \
  • Some explanations on the flags
--verbosity: log level from 1 to 5. Here we're using 4 for debug messages
--datadir: path to your data directory created above.
--keystore: path to your account's keystore created above.
--identity: your full-node's name.
--password: your account's password.
--networkid: our testnet network ID.
--port: your full-node's listening port (default to 30303)
--rpc, --rpccorsdomain, --rpcaddr, --rpcport, --rpcvhosts: your full-node will accept RPC requests at 8545 TCP.
--ws, --wsaddr, --wsport, --wsorigins: your full-node will accept Websocket requests at 8546 TCP.
--mine: your full-node wants to register to be a candidate for masternode selection.
--gasprice: Minimal gas price to accept for mining a transaction.
--targetgaslimit: Target gas limit sets the artificial target gas floor for the blocks to mine (default: 4712388)
--bootnode: bootnode information to help to discover other nodes in the network
--gcmode: blockchain garbage collection mode ("full", "archive")
--synmode: blockchain sync mode ("fast", "full", or "light". More detail:
To see all flags usage
tomo --help

Check Your Private Chain

  • Connect ipc
tomo attach $HOME/tomochain/nodes/1/tomo.ipc
  • Connect rpc
tomo attach tomo attach http://localhost:1545
  • Verify Checkpoints
    Wait about 30 minutes to see if your chain passes the first checkpoint
tomo attach


  • Reset your chain
rm -rf $HOME/tomochain/nodes/1/tomo $HOME/tomochain/nodes/2/tomo $HOME/tomochain/nodes/3/tomo
tomo --datadir $HOME/tomochain/nodes/1 init genesis.json
tomo --datadir $HOME/tomochain/nodes/2 init genesis.json
tomo --datadir $HOME/tomochain/nodes/3 init genesis.json
Note: we use the Gnosis Multisig Wallet: