Make Private Chain

Until now, atlas has both POC and POS version. Next, the following is a description of how to build private-net with four nodes On two different version.

Prerequisites

  • Private key and address

    Building atlas requires git, Go (version 1.14 or later) and a C compiler. You can install them using your favourite package manager.

  • Clone repositories

git clone https://github.com/mapprotocol/atlas.git
cd atlas

Build four nodes

We can start four nodes with different ports on one host, or we can start four nodes on multiple hosts. The following will use the node method of starting four different ports on one host to demonstrate.

  • build atlas of POC version:

git checkout v0.2
make atlas
  • build atlas of POS version:

git checkout v1.0.0 or git checkout <latest tag>
make atlas

Create four validator accounts

  • private key and address

    Atlas allows developers use the ethereum's account on atlas blockchain. If no account, it's helpful to use the command.

Generating a genesis.json

Note that there are differences between versions, which the POC version needn't set validator. Only Suitable for the POS version. The validator must be set, because only them are allowed to mine.

Get validator configuration json and generating a genesis.json

We now generate the genesis.json file using the paths of the four accounts generated in the previous step. Fill in the information we output when we created the account into the corresponding key value. The value corresponding to the AdminAddress key can be any of the four accounts we created above or other accounts.

Just like the following:

Initialize four validator nodes

Initialize the node with the genesis file generated in the previous step

Start four validator nodes

The following command starts four corresponding nodes using the four accounts created earlier。

Type the above command on the command line and press enter, you will see the following prompt:

At this time, we need to enter the password corresponding to the account and press Enter, congratulations, you have successfully started a node. Then we start the remaining nodes in the same way.

If you want to start an RPC node you can use the following way.

Connect four nodes

  • the Operation of flag.

With the bootnode operational and externally reachable (try telnet <ip> <port> to ensure it's indeed reachable), start every subsequent atlas node pointed to the bootnode for peer discovery via the --bootnodes flag. It will probably also be desirable to keep the data directory of your private network separated, so do also specify a custom --datadir flag.

  • the Operation on a console.

Query Own node-url:

Connect validator node, for example:

Check node status

You'll start seeing some output. After a few minutes, you should see lines that look like this. This means your node has connected other nodes and started produce blocks.

Last updated

Was this helpful?