Viction Private Testnet Setup

This tutorial shows how to set up a private Viction Testnet on a local machine. The purpose is to help developers to familiarise themselves with Viction's source code and initial setup.

The following will walk you step-by-step to setup a Viction private net with four Masternodes.

Setup environment

Install Golang

For MacOS running not Apple Silicon, please use amd64 variant of Golang instead of arm64.

  • Set environment variables

set GOROOT=$HOME/usr/local/go
set GOPATH=$HOME/go

Build Tomo from source

  • Create Tomo folder

mkdir $HOME/tomo
cd $HOME/tomo
  • Download source code and build:

git init
git remote add [email protected]:Viction/Viction.git
git pull origin master
make all
  • Download source code Tomo and install library:

  • Create alias for Tomo (this will only be effective in current session)

Setup Nodes and Accounts

  • Create a file to store password to encrypt/decrypt private key in plain text:

  • You can either create new keypair or import private key for your node:

  • Repeat the process for node2, node3 and node4.

Customize genesis block using the puppeth tool

  • Run puppeth command and answer questions about your private chain as follows:

  • Set chain name: Tomo

  • Configure new genesis: 2

  • Select POSV consensus: 3

  • Set block time (default 2 seconds): Enter

  • Set reward of each epoch: 250

  • Set addresses to be first masternode: Any address

  • Set account to seal: Address of Node 1, Node 2, Node 3, Node 4

  • Set the number of blocks of each epoch (default 900): Enter

  • Set gap (How many blocks before checkpoint need to prepare new masternodes set ?): 5

  • Set foundation wallet address: Enter

  • Account confirm Foundation MultiSignWallet: 2 or more addresses

  • Require for confirm tx in Foundation MultiSignWallet: 1

  • Account confirm Team MultiSignWallet: 2 or more addresses

  • Require for confirm tx in Team MultiSignWallet: 1

  • Enter swap wallet address for fund 55 million VIC: Any address

  • Enter account be pre-funded: Any address, should be at least 1

  • Enter Network ID: Any number

  • Export genesis file

    • Select 2. Manage existing genesis

    • Select 2. Export genesis configuration

    • Enter genesis filename (example): $HOME/tomo/genesis.json

  • Control + C to exit

Initialize Your Private Chain with Above Genesis Block

Setup Bootnode

  • Initialize bootnode key

  • Start bootnode and copy bootnode information

enode://7e59324b1e54f8c282719465eb96786fb3a04a0265deee2cdb0f62e912337ca6f118d0c91f7ebfae6f5c17825205279249cf7ff65ae54d0a1a8908ef16f80f63@[::]:30301

As in this example, all nodes are running in the same machine, so the enode IP can be set to 127.0.0.1. From the above example: enode://7e59324b1e54f8c282719465eb96786fb3a04a0265deee2cdb0f62e912337ca6f118d0c91f7ebfae6f5c17825205279249cf7ff65ae54d0a1a8908ef16f80f63@127.0.0.1:30301

Start Masternode

  • Start Masternode 1

  • Start Masternode 2

  • Start Masternode 3

  • Start Masternode 4

  • Some explanations on the flags

To see all flags usage

Connect to other node manually

We'll try to let node2 to connect to node1.

Get node info

  • Connect to node1 ipc

  • In the newly open prompt, run the following command:

As in the example, we can see enode information of node1. Copy this information for later use.

For example enode://89a5e91d30461641c4ede519c065b2f1e6d23a36d45e2d953e0ec9fa75e516517a0d4964489e07b73a7fa48e67d42fb2498ba46fe1a814c42ec0ad3257ced47a@[::]:10303

As in this example, all nodes are running in the same machine, so the enode IP can be set to 127.0.0.1. From the above example: enode://89a5e91d30461641c4ede519c065b2f1e6d23a36d45e2d953e0ec9fa75e516517a0d4964489e07b73a7fa48e67d42fb2498ba46fe1a814c42ec0ad3257ced47a@127.0.0.1:10303

  • Exit node1 ipc prompt by this command:

Add peer for your node

  • Connect to node2 ipc

  • In the newly open prompt, connect to other node by their enode (which we get from the previous step) using the following command:

  • Now check if we added peer sucessfully:

  • Exit node2 ipc prompt by this command:

  • Repeat this step for other nodes.

Check Your Private Chain

  • Connect ipc

  • Connect rpc

  • Verify Checkpoints

Troubleshooting

  • Reset your chain

Note: we use the Gnosis Multisig Wallet: https://github.com/gnosis/MultiSigWallet

Last updated