Building Atlas requires git, Go (version 1.14 or higher), and a C compiler
Clone the code repository
gitclonehttps://github.com/mapprotocol/atlas.git
Build
We can start four nodes with different ports on a single host, or we can start four nodes on multiple hosts. The following example demonstrates starting four nodes with different ports on a single host.
gitcheckoutv1.1.5makeatlas
Create an account
Atlas allows developers to use Ethereum accounts on the Atlas blockchain. If you don't have an account, you can create one using the following command.
$./atlas--datadir./node-1accountnew$./atlas--datadir./node-2accountnew$./atlas--datadir./node-3accountnew$./atlas--datadir./node-4accountnew# OutputINFO [10-09|17:37:36.179]MaximumpeercountETH=100LES=0total=100Yournewaccountislockedwithapassword.Pleasegiveapassword.Donotforgetthispassword.Password:Repeatpassword:YournewkeywasgeneratedAddress:0x...PublicKey:0x...BLSPublickey:0x...BLSG1Publickey:0x...BLSProofOfPossession:0x...Pathofthesecretkeyfile:node-1/keystore/UTC--2023-10-09T09-37-38.019902000Z--...-Youcanshareyourpublicaddresswithanyone.Othersneedittointeractwithyou.-YoumustNEVERsharethesecretkeywithanyone!Thekeycontrolsaccesstoyourfunds!-YoumustBACKUPyourkeyfile!Withoutthekey,it's impossible to access account funds!- You must REMEMBER your password! Without the password, it'simpossibletodecryptthekey!
Generating genesis.json file
To generate the genesis.json file, please refer to this
Now we will use the information of the four accounts generated in the previous step to generate the genesis.json file. Fill in the corresponding key-value pairs in the markerConfig.json file with the information outputted when we created the accounts. The value for AdminAddress can be one of the four accounts we created earlier or any other account.
Please enter the above command in the command line and press Enter. You will see the following prompt:
......INFO [10-09|18:16:28.639]Startingpeer-to-peernodeinstance=atlas/v1.1.5-stable/darwin-amd64/go1.20.7INFO [10-09|18:16:28.759] New local node record seq=1,696,846,449,759 id=657ee01225705fca ip=127.0.0.1 udp=20201 tcp=20201
INFO [10-09|18:16:28.759] Started P2P networking self=enode://89b72450e02cf8a22dc66db717f4bab75b55961f2a474846f88615fd2be49bf406f3499842b39c5acd0d4ebc9fa72c29e27f1995a740d334c20b647e29a477b2@127.0.0.1:20201 maxdialed=33 maxinbound=67
INFO [10-09|18:16:28.762] IPC endpoint opened url=/Users/t/go_project/mapprotocol/atlas/node-1/atlas.ipc
Unlockingaccount0x3BaB3BDe5ECC520134da32Bf7891578c108FC290|Attempt1/3Password:
At this point, you will need to enter the password corresponding to the account and press Enter. Congratulations, you have successfully started one node. Then, you can start the remaining nodes in the same way.
If you want to start an RPC node, you can use the following method.
Before starting the nodes, make sure that the bootnode is running and accessible from the outside (try telnet to ensure it can be accessed). Then, use --bootnodes to point each subsequent Atlas node to the bootnode for peer discovery. Specify the data storage directory using --datadir.
After entering the command to connect to the node, you will start seeing some output. After a few minutes, you should see a line like this. This means that your node has connected to other nodes and will start generating blocks.
INFO [10-09|18:32:27.683]Lookingforpeerspeercount=2tried=5static=4INFO [10-09|18:32:37.582] Reset timer to resend RoundChange msg address=0xB16561A66B6439944DAf0388b5E6a2D3D0a49e12 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:32:39.311]Lookingforpeerspeercount=3tried=0static=4
You can also use admin.peers command in the console to see the connected nodes.