Skip to content

Testnet Instructions

The network consists of nodes, DCore 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.


Public Testnet Set up

The public testnet has been launched for the reason to provide a playground for the community, where anybody can test and run APIs, CLI Wallets and use the DCore network in general without using any real tokens.

Important

Everything that happens on public testnet stays only on the public testnet!

Synchronize the Public Testnet Locally

Download the genesis block file for public testnet genesis-public-testnet.json and move it to your testnet data folder /home/my-testnet-folder.

The daemon has the possibility to specify the directory where all blockchain data will be stored. To define this parameter, you can use: --data-dir /home/my-testnet-folder/. For defining the location of your genesis json file you can use the parameter: --genesis-json=/home/my-testnet-folder/genesis-public-testnet.json. Finally, there is a need to specify the IP and port of one node of the testnet to connect to. The address is testnet.dcore.io:40000.

At the end the full startup command for running decentd in a shell should look similar to:

./decentd --data-dir=/home/my-testnet-folder/public_testnet --genesis-json=/home/my-testnet-folder/genesis-public-testnet.json --seed-node=testnet.dcore.io:40000

Attention

The usage of data-dir parameter is crucial. In case you will skip it, there will be an issue to distinguish blockchain databases.

Additionally, the code structure for initial setup is descriptive. After the first run there will be config.ini file created and you can directly, to that folder, specify and save all arguments and make the list of arguments shorter.

Run the Daemon in a Shell

After starting your daemon with the previous command, you will have to wait for the blockchain to synchronize. After it is up to date, you can connect CLI Wallet to your local daemon instance:

./cli_wallet --wallet-file=/home/my-testnet-folder/public_testnet/wallet-public-testnet.json

Once the wallet is running, and is connected properly the daemon, you can setup a password and unlock it.

Then import one or more test accounts using these account_name, private_key pairs:

account_name : public-account-1 
Private key:  5KfatbpE1zVdnHgFydT7Cg9hJmUVLN7vQXJkBbzGrNSND3uFmAa

account_name : public-account-2
Private key:  5K1RA287ocAsZR36PxC7xKCwJ7jBbjrwNswznoi2DnR9uTEYWqu

account_name : public-account-3
Private key:  5Hs5VxmZf3P87remYbduVU5TrsdDxyAc6gxYkU8NVP6SGtB1Lxj

account_name : public-account-4
Private key:  5JnV8u1qP6J1mN9zYbcLDmcjtijJbFYMXFVURA6nqMTJcLKQkRx

account_name : public-account-5
Private key:  5JaDAz6qfDwY64SuFhF5VVr98k77tZvETMx1DZEYwCj2U9H2Xb3

account_name : public-account-6
Private key:  5KNdLJzt6A5soo2RHBHbi7FksexxMGPh19gD75tfCwUKuEN2tth

account_name : public-account-7
Private key:  5JFkwdzPNgxfdfpsNhhNjFZX1osT3o5NCZDGc6NQcsSkCVVGXnq

account_name : public-account-8
Private key:  5JLZmqPbdicGnSGySVCVJxxDpkcbuQZEBuSfZDsPwL5KmZcwVP7

account_name : public-account-9
Private key:  5Hxwqx6JJUBYWjQNt8DomTNJ6r6YK8wDJym4CMAH1zGctFyQtzt

account_name : public-account-10
Private key:  5JMpT5C75rcAmuUB81mqVBXbmL1BKea4MYwVK6voMQLvigLKfrE

After you have managed to import some accounts into CLI Wallet, we suggest you to create your own account and use it.

Info

The pre-defined test accounts DCT amount range is: 50 DCT to 500 DCT. All the test accounts are checked on an hourly basis - in case the amount of DCT is below 50 DCT they are automatically credited to have 100 DCT. There is also max amount of DCT set to 500 DCT.


Create your own Testnet

Config.ini

We can start by running decentd simply to create directory structure, configuration file and default genesis file by running the following code.

./decentd --data-dir=/path/my-testnet-dir/ --create-genesis-json=/path/my-testnet-dir/my-genesis.json

We need to prepare the config.ini:

  1. Set path to the genesis file genesis-json=/path/my-testnet-dir/my-genesis.json

  2. Set enable-stale-production = true.

  3. Add miner ids, in the section "ID of miner controlled by this node". Add 11 entries as it is the minimal required number of active miners:

    miner-id = "1.4.1" miner-id = "1.4.2" ... miner-id = "1.4.10" miner-id = "1.4.11"

  4. There is configuration for private key generated by default, which we need to change as is shown below.

    private-key = ["DCT82MTCQVa9TDFmz3ZwaLzsFAmCLoJzrtFugpF72vsbuE1CpCwKy","5JuJbrKZgAATcouJnwpaxPbHMAMDXSgUpQSfxTXzkSUuf cnpTUa"].

    The key is actually used by default generated genesis.json file, as the key of initial accounts and miner accounts. Also predefined "decent" account has the same key.

  5. Optional step. Set "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.

Genesis file lists initial accounts and miner accounts with corresponding public keys. Feel free to customize your genesis file by your needs. You can also use other keys, but miners' public keys have to match public key/keys specified in config.ini.

Start

Simply run the decent daemon.

./decentd --data-dir=/path/my-testnet-dir/

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 #10 with timestamp 2017-05-25T13:36:05 at ... .”

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 the process and start again.

Testing

Start another node (decentd) on the network, configure --seed-node=192.168.1.1:40000, where 192.168.1.1 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 --p2p-endpoint parameter. Start CLI Wallet, run the command head_block_time.

Serve up and Run

Right after the network has started we have a network with 12 accounts by default (see initial accounts field in genesis file), but only decent account has nonzero balance.