From 85019f2283681a82aac1c42ddfc89db3576795d8 Mon Sep 17 00:00:00 2001 From: billy rennekamp Date: Wed, 18 Mar 2020 13:42:46 +0100 Subject: [PATCH] added init script with test password (#228) * added init script with test password * added make install * update README --- README.md | 17 ++++++++++++----- init.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) create mode 100755 init.sh diff --git a/README.md b/README.md index 8bcbf4f2e..91704fc0c 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,16 @@ $ make build ### Starting a Ethermint daemon (node) -First, create a key to use in signing the genesis transaction: +The following config steps can be performed all at once by executing the `init.sh` file located in the root directory like this: +```bash +./init.sh +``` +> This bash file removes previous blockchain data from `~/.emintd` and `~/.emintcli`. It uses the `keyring-backend` called `test` that should prevent you from needing to enter a passkey. The `keyring-backend` `test` is unsecured and should not be used in production. + +To initalize your chain manually, first create a key to use in signing the genesis transaction: ```bash -emintcli keys add mykey +emintcli keys add mykey --keyring-backend test ``` > replace mykey with whatever you want to name the key @@ -58,6 +64,7 @@ Then, run these commands to start up a node emintd init mymoniker --chain-id 8 # Set up config for CLI +emintcli config keyring-backend test emintcli config chain-id 8 emintcli config output json emintcli config indent true @@ -67,7 +74,7 @@ emintcli config trust-node true emintd add-genesis-account $(emintcli keys show mykey -a) 1000000000000000000photon,1000000000000000000stake # Sign genesis transaction -emintd gentx --name mykey +emintd gentx --name mykey --keyring-backend test # Collect genesis tx emintd collect-gentxs @@ -108,7 +115,7 @@ To clear all data except key storage (if keyring backend chosen) and then you ca #### Keyring backend options -Ethermint supports using a file or OS keyring backend for key storage. To create and use a file stored key instead of defaulting to the OS keyring, add the flag `--keyring-backend file` to any relevant command and the password prompt will occur through the command line. This can also be saved as a CLI config option with: +The instructions above include commands to use `test` as the `keyring-backend`. This is an unsecured keyring that doesn't require entering a password and should not be used in production. Otherwise, Ethermint supports using a file or OS keyring backend for key storage. To create and use a file stored key instead of defaulting to the OS keyring, add the flag `--keyring-backend file` to any relevant command and the password prompt will occur through the command line. This can also be saved as a CLI config option with: ```bash emintcli config keyring-backend file @@ -159,5 +166,5 @@ via the `--blockchain` flag. See `TestImportBlocks` for further documentation. The following chat channels and forums are a great spot to ask questions about Ethermint: -- [Cosmos Riot Chat Channel](https://riot.im/app/#/group/+cosmos:matrix.org) +- [Cosmos Discord](https://discord.gg/W8trcGV) - Cosmos Forum [![Discourse status](https://img.shields.io/discourse/https/forum.cosmos.network/status.svg)](https://forum.cosmos.network) diff --git a/init.sh b/init.sh new file mode 100755 index 000000000..7791e9038 --- /dev/null +++ b/init.sh @@ -0,0 +1,32 @@ +#!/bin/bash +rm -rf ~/.emintcli +rm -rf ~/.emintd + +make install + +emintcli config keyring-backend test +emintcli keys add mykey + +# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) +emintd init mymoniker --chain-id 8 + +# Set up config for CLI +emintcli config chain-id 8 +emintcli config output json +emintcli config indent true +emintcli config trust-node true + +# Allocate genesis accounts (cosmos formatted addresses) +emintd add-genesis-account $(emintcli keys show mykey -a) 1000000000000000000photon,1000000000000000000stake + +# Sign genesis transaction +emintd gentx --name mykey --keyring-backend test + +# Collect genesis tx +emintd collect-gentxs + +# Run this to ensure everything worked and that the genesis file is setup correctly +emintd validate-genesis + +# Start the node (remove the --pruning=nothing flag if historical queries are not needed) +emintd start --pruning=nothing \ No newline at end of file