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.
$./atlas--datadir./node-1accountnew$./atlas--datadir./node-2accountnew$./atlas--datadir./node-3accountnew$./atlas--datadir./node-4accountnew# OutputINFO [03-16|14:12:42.713]MaximumpeercountETH=50LES=0total=50Yournewaccountislockedwithapassword.Pleasegiveapassword.Donotforgetthispassword.Password:Repeatpassword:YournewkeywasgeneratedAddress:0x57d28a6Cb48dc6Da45f6fE13E42757aF56cB0650PublicKey:0x04cb8512a050dc66750faabf4a6cace5bbfd70ccaa5e94e986f5062aa5c016a7e9541f266b7289e6e113c9780fbf5d2ad1ff3136576a38e20569f82094c2e47d30BLSPublickey:0x2a9520c996aaa5bd3222a0cef50ae1420602b4ba836c3e0a590d794107d8d7b51139baefa4645947402dc31d3c69ae96a83f054b0851412892d03ba6d154257126ebfcd6c512f84f19d139749ce760b9f142bd10c9a80b0f6b3086254840a4ee0d9510c2ebfcbbf03d168d62d8b2926edeee70e0e8b6b205e0ac0394370832ecBLSG1Publickey:0x0491aa3f6523e253003c02856a4623a163bb11ba9f115ae464c940dd60e64e0b1fff5644ca887928f0c6a29055bfa608103aa19d13edfc1a12f5baaa69d60f7aBLSProofOfPossession:0x2866621aa6703c6992299f75ee05b34fb42963ae82173e43c212d891ddc8a94e107fa37f3833e9230deb3078dde2521ea6b833e70ed051ee297734117bec367cPathofthesecretkeyfile:node-1/keystore/UTC--2022-03-17T09-35-15.650368000Z--f930b74d2b1b703b879ab54e225ecc18ab28e61c-Youcanshareyourpublicaddresswithanyone.Othersneedittointeractwithyou.-YoumustNEVERsharethesecretkeywithanyone!Thekeycontrolsaccesstoyourfunds!-YoumustBACKUPyourkeyfile!Withoutthekey,it's impossible to access account funds!- You must REMEMBER your password! Without the password, it'simpossibletodecryptthekey!
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.
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.
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.
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.
INFO [03-16|20:21:27.683] Looking for peers peercount=2 tried=5 static=4
INFO [03-16|20:21:37.582] Reset timer to resend RoundChange msg address=0x2dC45799000ab08E60b7441c36fCC74060Ccbe11 func=resetResendRoundChangeTi
mer cur_seq=23 cur_epoch=1 cur_round=0 des_round=5 state="Waiting for new round" address=0x2dC45799000ab08E60b7441c36fCC74060Ccbe11 timeout=17.5s
INFO [03-16|20:21:39.311] Looking for peers peercount=3 tried=0 static=4