1

I want to run several nodes on one machine. How can i define the network (mainnet, alphanet, zeronet) in the config.json?

2

It is not possible to set the network in the config.json file.

The network is somehow hard-coded on each branch (mainnet,alphanet,zeronet) as each network comes with its specific constants and a genesis block (which basically defines the network identifier). The config.json file aims to configure the behavior of a node (rpc port, number of connections, history mode, …) regardless of the network it interacts with.

5
  • Could you point me to a source, how to realize, what i want to do? My problem is, i've an compiled mainnet node and everytime i want to start the alphanet node (cd into the alphanet dir) it starts to sync the mainnet instead the alphanet. – Blindripper Jul 31 '19 at 6:59
  • 1
    First, To run on different networks, you have to run different binaries. (This is not the same tezos-node that is produced by make in the git branch "alphanet" and "mainnet" of the gitlab repo.) So to run an alphanet node, you have to checkout and compile binaries from the alphanet branch. Second, "bootstrap peers" the peers you first connect to when you launch a node aren't the same on mainnet and alphanet of course, so if you specify by hand bootstrap peers in your config.json, you mustn' use the same config.json to launch "alphanet"-tezos-node and "mainnet"-tezos-node... – Pierre Boutillier Jul 31 '19 at 7:18
  • 1
    I personally use a git feature called worktree. It allows you to checkout a branch in a given directory. You will have one folder for each branch you want. Then, you just need to pull/make/run in each directory. If you want to run several nodes on the same machine, do not forget to specify different ports, for both p2p and rpc listen_addr, and data-dir. – vect0r Jul 31 '19 at 7:37
  • I've done a checkout and compiled the alphanet and mainnet branch, i also haven't set any bootstrap peers for both. Both branches are in different folders. But i don't get why ./tezos-node run (in the alphanet dir) starts to sync the mainnet. Maybe the listen_addr is the problem... will try it and give feedback. thx guys. – Blindripper Jul 31 '19 at 7:47
  • 1
    @vect0r helped me to find the problem. git branchgave me *alphanetbut git logpointed to the mainnet branch. git reset --hard origin/alphanetand makesolved the problem. – Blindripper Jul 31 '19 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.