Multi-Node Testnet
This document shows how to start a testnet of smartBCH with multiple nodes.
We suggest to use ubuntu 20.04.
Among these nodes, just pick one to generate the genesis file. And all the other nodes do not generate the genesis file, instead, they use the generated genesis file as is.
1. On the nodes which do not generate the genesis file
Step 0: Prepare
Follow the instructions in running a single-node testnet, and just finish the steps 0, 1, 2, 3 and 4 described in it.
Step 0: Prepare
The above command generates one private key. And the corresponding EOA address is [direction]0xF0c6969C2a554ddae639ba1Aa1d2fA11382CAb2B.[/direction]
Step 2: generate genesis validator consensus key info
The output hex string is consensus pubkey which will be used in generate-genesis-[direction]validator[/direction] command, and a file containing the consensus public and private key is generated under the current directory, named [direction]priv_validator_key.json.[/direction]
Step 3: generate genesis validator info using pubkey generated above
The [direction]validator-address[/direction] is the one we get at step 1, and the [direction]consensus-pubkey[/direction] is the one we get at step 2.
The output hex string contains the information of a validator. Send the this hex string to the node who is genesis-generator.
Step 4: wait for the data directory's tarball and unpack it
Step 5: Copy private key file to data directory and start node
Step 6: activate validator
Note: replace the content after [direction]–validator-key[/direction] with your validator private key, and repace the content after [direction] –staking-coin [/direction]with [direction]1000000000000000000000[/direction] or even more you have.
⚠️Keep your private key safe, and execute this command on a secure, offline machine
Then broadcast the transaction (replace [direction]–your_tx_data[/direction] with what hex string get above):2. On the node which generates the genesis file
Step 0: Prepare
Step 1: add genesis validator info to genesis.json using hex strings sent by other nodes
Using [direction]./smartbchd add-genesis-validator[/direction] multiple times, one time with one hex string sent by one node.
Finally you’ll include all the validators’ information in the genesis.json file. Then, make a copy of the [direction]~/.smartbchd [/direction]directory, excluding the [direction]node_key.json[/direction] file.
Step 2: start the node
Step 4: collect seeds information
Step 5: send information to all the other nodes
3. Join in as a validator after genesis
Step 0: create new validator
Step 1: send transaction to register as a validator
Make sure you have enough BCH in you validator account.
Then broadcast the transaction (replace [direction]your_tx_data[/direction] with what hex string get above):
Step 2: voting in the BCH mainnet
If you are using a real BCH node, please use getblocktemplate.
to specify the coinbase transaction for voting.
You can also starting voting before registering the validator, which can make sure then it is registered, it gets voting power as soon as possible.
4. Adjust minGasPrice
Step 0: generate minGasPrice adjust signed rawTx
Step 1: send transaction to adjust minGasPrice
Make sure you have enough BCH in you sender account.
Then broadcast the transaction (replace [direction]your_tx_data [/direction]with what hex string get above):