make private network(atlas)
Prerequisites
Private key and address
Building Atlas requires git, Go (version 1.14 or higher), and a C compiler
Clone the code repository
git clone https://github.com/mapprotocol/atlas.gitBuild
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.
git checkout v1.1.5
make atlasCreate 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-1 account new
$ ./atlas --datadir ./node-2 account new
$ ./atlas --datadir ./node-3 account new
$ ./atlas --datadir ./node-4 account new
# Output
INFO [10-09|17:37:36.179] Maximum peer count ETH=100 LES=0 total=100
Your new account is locked with a password. Please give a password. Do not forget this password.
Password:
Repeat password:
Your new key was generated
Address: 0x...
PublicKey: 0x...
BLS Public key: 0x...
BLS G1 Public key: 0x...
BLSProofOfPossession: 0x...
Path of the secret key file: node-1/keystore/UTC--2023-10-09T09-37-38.019902000Z--...
- You can share your public address with anyone. Others need it to interact with you.
- You must NEVER share the secret key with anyone! The key controls access to your funds!
- You must BACKUP your key file! Without the key, it's impossible to access account funds!
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!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.
Then, generate the genesis.json file using the markerConfig.json file mentioned above, as follows:
After the command execution is complete, you can find the genesis.json file in the current directory.
Initialize the nodes
Initialize the four validator nodes using the genesis file generated in the previous step.
Start the nodes
Start the four corresponding nodes using the four accounts created earlier using the following command.
Please enter the above command in the command line and press Enter. You will see the following prompt:
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.
Connect the nodes
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.
To query the enode information of your node, you can use the following command:
To connect to a node using the console, use the following command:
Check node status
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.
You can also use admin.peers command in the console to see the connected nodes.
Last updated