Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: Update #131

Merged
merged 2 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN apk add --update ca-certificates
RUN bash ./scripts/docker-node/setup.sh

# Entry for containers, Run the single-node script
ENTRYPOINT [ "bash", "./scripts/docker-node/start.sh" ]
ENTRYPOINT [ "hid-noded" ]

# Expose Ports
EXPOSE 26657 1317 9090 9091 26656
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ The Hypersign Identity Network is a permissionless blockchain network to manage
Following are the prerequisites that needs to be installed:

- golang (Installation Guide: https://go.dev/doc/install) (version: 1.17.2)
- starport (Installation Guide: https://docs.starport.network/guide/install.html)

## Get started

Expand All @@ -31,21 +30,14 @@ To start a single-node blockchain, refer to the README.md file present in [`/scr

To run a single node `hid-node` docker container, run the following:

1. Clone the repository:

```sh
git clone https://github.com/hypersign-protocol/hid-node.git
cd hid-node
```

2. Build the image:
1. Pull the image:
```sh
sudo docker build -t hidnode .
docker pull hypersignprotocol/hid-node
```

3. Run the container:
2. Open a separate terminal window. Run the node:
```sh
sudo docker run -d hidnode
docker run -it hypersignprotocol/hid-node start
```

## Operations
Expand Down
39 changes: 16 additions & 23 deletions scripts/docker-node/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,39 @@

echo "Setting up Chain."

# Setting up config files
rm -rf /usr/local/app/node1


# Make directories for hid-node config
mkdir /usr/local/app/node1

# Init node
hid-noded init --chain-id=hidnode node1 --home=/usr/local/app/node1 &> /dev/null
hid-noded init --chain-id=hidnode node1 &> /dev/null

# Create key for the node
hid-noded keys add node1 --keyring-backend=test --home=/usr/local/app/node1 &> /dev/null
hid-noded keys add node1 --keyring-backend=test &> /dev/null

# change staking denom to uhid
cat /usr/local/app/node1/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="uhid"' > /usr/local/app/node1/config/tmp_genesis.json && mv /usr/local/app/node1/config/tmp_genesis.json /usr/local/app/node1/config/genesis.json
cat /root/.hid-node/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="uhid"' > /root/.hid-node/config/tmp_genesis.json && mv /root/.hid-node/config/tmp_genesis.json /root/.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=/usr/local/app/node1) 100000000000uhid,100000000000stake --home=/usr/local/app/node1
hid-noded gentx node1 500000000uhid --keyring-backend=test --home=/usr/local/app/node1 --chain-id=hidnode
hid-noded collect-gentxs --home=/usr/local/app/node1
hid-noded add-genesis-account $(hid-noded keys show node1 -a --keyring-backend=test ) 100000000000uhid,100000000000stake
hid-noded gentx node1 500000000uhid --keyring-backend=test --chain-id=hidnode
hid-noded collect-gentxs

# update crisis variable to uhid
cat /usr/local/app/node1/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="uhid"' > /usr/local/app/node1/config/tmp_genesis.json && mv /usr/local/app/node1/config/tmp_genesis.json /usr/local/app/node1/config/genesis.json
cat /root/.hid-node/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="uhid"' > /root/.hid-node/config/tmp_genesis.json && mv /root/.hid-node/config/tmp_genesis.json /root/.hid-node/config/genesis.json

# udpate gov genesis
cat /usr/local/app/node1/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="uhid"' > /usr/local/app/node1/config/tmp_genesis.json && mv /usr/local/app/node1/config/tmp_genesis.json /usr/local/app/node1/config/genesis.json
cat /root/.hid-node/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="uhid"' > /root/.hid-node/config/tmp_genesis.json && mv /root/.hid-node/config/tmp_genesis.json /root/.hid-node/config/genesis.json

# update mint genesis
cat /usr/local/app/node1/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="uhid"' > /usr/local/app/node1/config/tmp_genesis.json && mv /usr/local/app/node1/config/tmp_genesis.json /usr/local/app/node1/config/genesis.json
cat /root/.hid-node/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="uhid"' > /root/.hid-node/config/tmp_genesis.json && mv /root/.hid-node/config/tmp_genesis.json /root/.hid-node/config/genesis.json

# change app.toml values
sed -i -E '104s/enable = false/enable = true/' /usr/local/app/node1/config/app.toml
sed -i -E '107s/swagger = false/swagger = true/' /usr/local/app/node1/config/app.toml
sed -i -E '104s/enable = false/enable = true/' /root/.hid-node/config/app.toml
sed -i -E '107s/swagger = false/swagger = true/' /root/.hid-node/config/app.toml


# change config.toml values
sed -i -E 's|tcp://127.0.0.1:26658|tcp://0.0.0.0:26658|g' /usr/local/app/node1/config/config.toml
sed -i -E 's|tcp://127.0.0.1:26657|tcp://0.0.0.0:26657|g' /usr/local/app/node1/config/config.toml
sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' /usr/local/app/node1/config/config.toml
sed -i -E 's|addr_book_strict = true|addr_book_strict = false|g' /usr/local/app/node1/config/config.toml
sed -i -E 's|cors_allowed_origins = \[\]|cors_allowed_origins = \[\"\*\"\]|g' /usr/local/app/node1/config/config.toml
sed -i -E 's|tcp://127.0.0.1:26658|tcp://0.0.0.0:26658|g' /root/.hid-node/config/config.toml
sed -i -E 's|tcp://127.0.0.1:26657|tcp://0.0.0.0:26657|g' /root/.hid-node/config/config.toml
sed -i -E 's|allow_duplicate_ip = false|allow_duplicate_ip = true|g' /root/.hid-node/config/config.toml
sed -i -E 's|addr_book_strict = true|addr_book_strict = false|g' /root/.hid-node/config/config.toml
sed -i -E 's|cors_allowed_origins = \[\]|cors_allowed_origins = \[\"\*\"\]|g' /root/.hid-node/config/config.toml

echo "Chain Setup is done."
4 changes: 0 additions & 4 deletions scripts/docker-node/start.sh

This file was deleted.