Skip to main content

Setup a Local Network

Follow the instructions below to set up a local development network.

Chain init

$ shareledger init <moniker name> --home <home path> --chain-id <chain name>

Add keys

$ shareledger keys add authority
$ shareledger keys add treasurer
$ shareledger keys add validator

Add role

$ shareledger genesis add-authority [address_or_key_name]
$ shareledger genesis add-treasurer [address_or_key_name]
$ shareledger genesis add-validator [address_or_key_name]

Add account to genesis file

$ shareledger add-genesis-account [address_or_key_name] [coin][,[coin]]

Create validator genesis transaction

$ shareledger gentx [key_name] [amount]

## Example
$ shareledgerd gentx my-key-name 1000000nshr --home=/path/to/home/dir --keyring-backend=os --chain-id=test-chain-1 \
--moniker="myvalidator" \
--commission-max-change-rate=0.01 \
--commission-max-rate=1.0 \
--commission-rate=0.07 \
--details="..." \
--security-contact="..." \
--website="..."

Collect genesis file

If genesis file has multiple validators, you have to collect all the gentx files of all validators in $SHARELEDGER_HOME/config/gentx and add it to one machine, then run the following command:

$ shareledger collect-gentxs

Validate genesis

$ shareledger validate-genesis

Start the network

$ shareledger start

Start other node/validator

Chain init

$ shareledger init <moniker name> --home <home path> --chain-id <chain name>

Replace genesis file

Get the genesis file from any machine that already runs the network from this path $SHARELEDGER_HOME/config/genesis.json and replace it.

Start node

$ shareledger start --p2p.persistent_peers “<node-id>@<node-ip:26656>

or

$ shareledger start --p2p.seeds “<node-id>@<node-ip:26656>

You can get node ID with this command:

$ shareledger tendermint show-node-id