# Local Testnet
For testing or developing purpose, you may want to setup a local testnet.
# Single Node Testnet
Requirements:
TIP
We use the default home directory for all the following examples
# plugchaind init
Initialize the genesis.json file that will help you to bootstrap the network
plugchaind init testing --chain-id=plugchain_521-1
# create a key
Create a key to hold your validator account
plugchaind keys add MyValidator
# plugchaind add-genesis-account
Add that key into the genesis.app_state.accounts array in the genesis file
TIP
this command lets you set the number of coins. Make sure this account has some plugchaind which is the only staking coin on Plug Chain Hub
plugchaind add-genesis-account $(plugchaind keys show MyValidator --address) 150000000uplugcn
# plugchaind gentx
Generate the transaction that creates your validator. The gentxs are stored in ~/.plugchain/config/gentx/
plugchaind gentx MyValidator 100000000plugchaind --chain-id=plugchain_521-1
# plugchaind collect-gentxs
Add the generated staking transactions to the genesis file
plugchaind collect-gentxs
# plugchaind start
Change the default token denom to pc
sed -i 's/stake/pc/g' $HOME/.plugchain/config/genesis.json
Now it‘s ready to start plugchaind
plugchaind start
# plugchaind unsafe-reset-all
You can use this command to reset your node, including the local blockchain database, address book file, and resets priv_validator.json to the genesis state.
This is useful when your local blockchain database somehow breaks and you are not able to sync or participate in the consensus.
plugchaind unsafe-reset-all
# plugchaind tendermint
Query the unique node id which can be used in p2p connection, e.g. the seeds
and persistent_peers
in the config.toml are formatted as <node-id>@ip:26656
.
The node id is stored in the node_key.json.
plugchaind tendermint show-node-id
Query the Tendermint Pubkey which is used to identify your validator, and the corresponding private key will be used to sign the Pre-vote/Pre-commit in the consensus.
The Tendermint Key is stored in the priv_validator.json which is required to be backed up once you become a validator.
plugchaind tendermint show-validator
Query the bech32 prefixed validator address
plugchaind tendermint show-address
# plugchaind export
Please refer to Export Blockchain State