-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6fc693
commit dddc48d
Showing
2 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
|
||
# Set the binary name | ||
BINARY=hid-noded | ||
|
||
# Check if the binary is installed | ||
${BINARY} &> /dev/null | ||
|
||
RET_VAL=$? | ||
if [ ${RET_VAL} -ne 0 ]; then | ||
# Check the current version of hid-noded running on testnet | ||
echo "hid-noded binary is not installed in your system. Installing now......" | ||
HIDNODE_TESTNET_VERSION=$(curl -s https://rpc.jagrat.hypersign.id/abci_info | jq -r .result.response.version) | ||
echo -e "\nCurrent hid-noded version running on Testnet is $HIDNODE_TESTNET_VERSION. Installing binary of version $HIDNODE_TESTNET_VERSION" | ||
VERSION=$(echo "$HIDNODE_TESTNET_VERSION" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') | ||
SANITISED_VERSION=$(echo "$HIDNODE_TESTNET_VERSION" | sed "s/.*$VERSION/$VERSION/") | ||
|
||
# Download binary | ||
mkdir tmp_hid_node && cd tmp_hid_node | ||
FILENAME=hid-noded-$SANITISED_VERSION-linux-amd64.tar.gz | ||
wget "https://github.com/hypersign-protocol/hid-node/releases/download/v$SANITISED_VERSION/$FILENAME" | ||
tar -C $HOME/.local/bin/ -xzf $FILENAME | ||
cd .. && rm -rf ./tmp_hid_node | ||
fi | ||
|
||
# Setting up config files | ||
rm -rf $HOME/.hid-node/ | ||
|
||
# Make directories for hid-node config | ||
mkdir $HOME/.hid-node | ||
|
||
# Init node | ||
hid-noded init --chain-id=hidnode node1 --home=$HOME/.hid-node | ||
|
||
# Change hid-node config | ||
hid-noded configure min-gas-prices 0uhid | ||
|
||
# Create key for the node | ||
hid-noded keys add node1 --keyring-backend=test --home=$HOME/.hid-node | ||
|
||
# change staking denom to uhid | ||
cat $HOME/.hid-node/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="uhid"' > $HOME/.hid-node/config/tmp_genesis.json && mv $HOME/.hid-node/config/tmp_genesis.json $HOME/.hid-node/config/genesis.json | ||
|
||
# update crisis variable to uhid | ||
cat $HOME/.hid-node/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="uhid"' > $HOME/.hid-node/config/tmp_genesis.json && mv $HOME/.hid-node/config/tmp_genesis.json $HOME/.hid-node/config/genesis.json | ||
|
||
# update gov genesis | ||
cat $HOME/.hid-node/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="uhid"' > $HOME/.hid-node/config/tmp_genesis.json && mv $HOME/.hid-node/config/tmp_genesis.json $HOME/.hid-node/config/genesis.json | ||
cat $HOME/.hid-node/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="50s"' > $HOME/.hid-node/config/tmp_genesis.json && mv $HOME/.hid-node/config/tmp_genesis.json $HOME/.hid-node/config/genesis.json | ||
|
||
# update ssi genesis | ||
cat $HOME/.hid-node/config/genesis.json | jq '.app_state["ssi"]["chain_namespace"]="testnet"' > $HOME/.hid-node/config/tmp_genesis.json && mv $HOME/.hid-node/config/tmp_genesis.json $HOME/.hid-node/config/genesis.json | ||
|
||
# update mint genesis | ||
cat $HOME/.hid-node/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="uhid"' > $HOME/.hid-node/config/tmp_genesis.json && mv $HOME/.hid-node/config/tmp_genesis.json $HOME/.hid-node/config/genesis.json | ||
|
||
# create validator node with tokens | ||
hid-noded add-genesis-account $(hid-noded keys show node1 -a --keyring-backend=test --home=$HOME/.hid-node) 500000000000000000uhid --home=$HOME/.hid-node --keyring-backend test | ||
hid-noded gentx node1 50000000000000000uhid --keyring-backend=test --home=$HOME/.hid-node --chain-id=hidnode | ||
hid-noded collect-gentxs --home=$HOME/.hid-node | ||
|
||
# change app.toml values | ||
sed -i -E '112s/enable = false/enable = true/' $HOME/.hid-node/config/app.toml | ||
sed -i -E '115s/swagger = false/swagger = true/' $HOME/.hid-node/config/app.toml | ||
sed -i -E '133s/enabled-unsafe-cors = false/enabled-unsafe-cors = true/' $HOME/.hid-node/config/app.toml | ||
|
||
|
||
# change config.toml values | ||
sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' $HOME/.hid-node/config/config.toml | ||
sed -i -E 's|addr_book_strict = true|addr_book_strict = false|g' $HOME/.hid-node/config/config.toml | ||
sed -i -E 's|cors_allowed_origins = \[\]|cors_allowed_origins = \[\"\*\"\]|g' $HOME/.hid-node/config/config.toml | ||
|
||
echo -e "\nConfiguarations set, you are ready to run hid-noded now!" | ||
|
||
echo -e "\nEnter the command 'hid-noded start' to start a single node blockchain." |