How to setup a network¶
The network consists of nodes, decent daemons that interact with each other using p2p connectivity. The network has a specially configured miner nodes, which generate blocks and keep the network running. The document describes how to do the configuration. This special node is called miner node.
We can start by running decentd simply to create the default
Then we can delete all the contents of
To prepare the
config.ini we need to:
seed-node = 127.0.0.1:40000entry.
"p2p-endpoint = 0.0.0.0:40000". Here we specify the port that the other nodes will use to connect to the seed node, which in turn will be configured as
"seed-node = 192.168.1.1:40000"for those nodes.
There is configuration for private key generated by default, which we need to change it as is shown below. This seems to be hardcoded key in c++ code, required to start a new chain.
private-key = ["DCT82MTCQVa9TDFmz3ZwaLzsFAmCLoJzrtFugpF72vsbuE1CpCwKy","5JuJbrKZgAATcouJnwpaxPbHMAMDXSgUpQSfxTXzkSUuf cnpTUa"].
The key is actually used by default generated genesis.json file, as the key of init accounts. Also
"decent"account has the same key.
Add miner ids, in the section
"ID of miner controlled by this node". Add 11 entries:
miner-id = "1.4.1" miner-id = "1.4.2" ... miner-id = "1.4.10" miner-id = "1.4.11"
enable-stale-production = true.
Create genesis file for the testnet with following command
./decentd --create-genesis-json ~/genesis-test.json.
This will create a genesis file, that lists initial miner accounts with
corresponding public keys. This is the key that has to be specified
The default generated genesis file defines the following account - decent
Start the network¶
Simply run the decent daemon.
./decentd --genesis-json ~/genesis-test.json
This greets with big title, telling that it is starting a new chain. On the successful start we see lines such as following:
“Generated block #100 with timestamp 2017-05-25T13:36:05 at ... .”
Seed node decent daemon throws some red errors from time to time, but mostly it's temporary.
"not producing blocks because node didn’t wake up within 500ms of the slot time".
It sometimes hangs up in ntp on this initial start - if there is no progress in like minute or two kill and start again.
Start another node (decentd) on the network, configure
is the IP address of the host running previously configured node and 40000 is the port that seed node is listening to.
It's configured with
cli_wallet, run the command
Up and running¶
Right after the network is started we have a network with a single account.