2020-03-18 12:42:46 +00:00
|
|
|
#!/bin/bash
|
2020-04-06 20:11:52 +00:00
|
|
|
|
2020-04-08 19:00:30 +00:00
|
|
|
KEY="mykey"
|
2020-04-06 20:11:52 +00:00
|
|
|
CHAINID=8
|
2020-05-20 21:29:26 +00:00
|
|
|
MONIKER="localtestnet"
|
2020-04-06 20:11:52 +00:00
|
|
|
|
2020-05-20 21:29:26 +00:00
|
|
|
# remove existing daemon and client
|
2020-04-06 20:11:52 +00:00
|
|
|
rm -rf ~/.emint*
|
2020-03-18 12:42:46 +00:00
|
|
|
|
|
|
|
make install
|
|
|
|
|
|
|
|
emintcli config keyring-backend test
|
2020-04-06 20:11:52 +00:00
|
|
|
|
2020-03-18 12:42:46 +00:00
|
|
|
# Set up config for CLI
|
2020-04-06 20:11:52 +00:00
|
|
|
emintcli config chain-id $CHAINID
|
2020-03-18 12:42:46 +00:00
|
|
|
emintcli config output json
|
|
|
|
emintcli config indent true
|
|
|
|
emintcli config trust-node true
|
|
|
|
|
2020-05-20 21:29:26 +00:00
|
|
|
# if $KEY exists it should be deleted
|
|
|
|
emintcli keys add $KEY
|
|
|
|
|
|
|
|
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
|
|
|
|
emintd init $MONIKER --chain-id $CHAINID
|
|
|
|
|
2020-03-18 12:42:46 +00:00
|
|
|
# Allocate genesis accounts (cosmos formatted addresses)
|
2020-04-06 20:11:52 +00:00
|
|
|
emintd add-genesis-account $(emintcli keys show $KEY -a) 1000000000000000000photon,1000000000000000000stake
|
2020-03-18 12:42:46 +00:00
|
|
|
|
|
|
|
# Sign genesis transaction
|
2020-04-06 20:11:52 +00:00
|
|
|
emintd gentx --name $KEY --keyring-backend test
|
2020-03-18 12:42:46 +00:00
|
|
|
|
|
|
|
# Collect genesis tx
|
|
|
|
emintd collect-gentxs
|
|
|
|
|
2020-05-20 21:29:26 +00:00
|
|
|
# Enable faucet
|
|
|
|
cat $HOME/.emintd/config/genesis.json | jq '.app_state["faucet"]["enable_faucet"]=true' > $HOME/.emintd/config/tmp_genesis.json && mv $HOME/.emintd/config/tmp_genesis.json $HOME/.emintd/config/genesis.json
|
|
|
|
|
|
|
|
echo -e '\n\ntestnet faucet enabled'
|
|
|
|
echo -e 'to transfer tokens to your account address use:'
|
|
|
|
echo -e "emintcli tx faucet request 100photon --from $KEY\n"
|
|
|
|
|
|
|
|
|
2020-03-18 12:42:46 +00:00
|
|
|
# Run this to ensure everything worked and that the genesis file is setup correctly
|
|
|
|
emintd validate-genesis
|
|
|
|
|
2020-04-06 20:11:52 +00:00
|
|
|
# Command to run the rest server in a different terminal/window
|
2020-05-20 21:29:26 +00:00
|
|
|
echo -e '\nrun the following command in a different terminal/window to run the REST server and JSON-RPC:'
|
|
|
|
echo -e "emintcli rest-server --laddr \"tcp://localhost:8545\" --unlock-key $KEY --chain-id $CHAINID --trace\n"
|
2020-04-06 20:11:52 +00:00
|
|
|
|
2020-03-18 12:42:46 +00:00
|
|
|
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
|
2020-05-20 21:29:26 +00:00
|
|
|
emintd start --pruning=nothing --rpc.unsafe --log_level "main:info,state:info,mempool:info" --trace
|
2020-04-06 20:11:52 +00:00
|
|
|
|