Single Node Private Testnet
This document shows how to start a private testnet of smartBCH with only one node.
We suggest to use ubuntu 20.04.
Step 0: install the basic tools.
Step 1: install dependencies
more infos can refer to rocksdb install doc
Last, export library path. You should export ROCKSDB_PATH with rocksdb root directory downloaded from above
Step 3: clone the moeingevm repo, and build dynamically linked library.
Step 4: clone the source code of smartBCH and build the executable of smartbchd.
Step 5: generate some private keys only used for test.
The output private keys will be used as input for the next step.
A validator needs two private keys: one ed25519 key for consensus engine (tendermint) and one secp256k1 key for operate it using smart contracts. Now we pick the secp256k1 key out from above generated keys. We just choose the first one and show its corresponding address:
If you have not installed the [direction]ethereum_private_key_to_address[/direction] tool, install it as below:
Step 6: initialize the node data using test keys generated above:
Step 7: generate genesis validator consensus key info
The output hex string is consensus pubkey which will be used in [direction]generate-genesis-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]
Since now we are just running a single node for test, the key file is not so important. In production, a validator’s operator must take good care of this key file [direction]priv_validator_key.json[/direction] and back it up safely.Step 8: generate genesis validator info using pubkey generated above
The [direction]validator-address[/direction] uses the one we get at step 5, and the [direction]consensus-pubkey[/direction] is the one we get at step 7.
The output hex string contains the information of a validator.
Step 9: add genesis validator info to genesis.json using hex string generated above
Step 10: copy priv_validator_key.json generated in Step 7
Step 11: start the node:
You can also ignore the unlock argument to [direction]unlock[/direction] no accounts.
This command starts the node which provides JSON-RPC service at localhost:8584. You can use the [direction]–http.addr[/direction] option to select another port other than localhost:8584. We unlocked accounts created at genesis, which can be shown using the following command:
You can also use [direction]–mainnet-url [/direction]option to specify a bitcoincashnode’s RPC endpoint, and use [direction]–home [/direction]option to specifiy another data directory other than ~/.smartbchd .