Cosmos Docker complete guide

# Hello, Cosmos Hub Mainnet is here today, let's see how to recover the account from a fundraiser or create a new one.

a) Install Docker

b) Run a node without install any more, only run some commands for play

c) Recover account address

d)Delegate & Undelegate & Redelegate Atoms to Validators

e) STAKE and Be Happy.

For completethis guide only need one VPS with 2 Cores, 8 Ram, Ubuntu and Docker

Learn more about Cosmos Network

https://cosmos.network/resources/faq

ok, let’s go, first need to install Docker.

Install Docker

sudo apt-get update
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh

Add your user to Docker Group

sudo usermod -aG docker $(whoami)

Log out of your ssh session and log back in

Docker Version

ok!

Now that Docker is installed, can run Cosmos-Docker from mydocker hub repo

(*)https://hub.docker.com/u/meleatrust

If need unsafe reset all before start

docker run -p 26657:26657 -p 26656:26656 -v $HOME/.gaiad:/root/.gaiad meleatrust/cosmos-sdk:v0.34.6  gaiad unsafe-reset-all

It is a new install start here

For start, a node for the first time, run this cmd and create the folders and files.

docker run -it -p 26657:26657 -p 26656:26656 -v $HOME/.gaiacli:/root/.gaiacli -v $HOME/.gaiad:/root/.gaiad meleatrust/cosmos-sdk:v0.34.6 gaiad init Write-Node-Name-Here --chain-id cosmoshub-2

Permission to folders creates previously

sudo chown user:group .gaiad/config
sudo chown user:group .gaiad/data

Open the folder

cd .gaiad/config

Remove the default genesis file

rm genesis.json

Download the Genesis File for Cosmos Mainnet

wget https://raw.githubusercontent.com/cosmos/launch/master/genesis.json

Edit config.toml, add seeds and verify moniker name is ok. Moniker name is the name than your Validators show in the explorers.

vi config.toml

#A custom human readable name for this node
 moniker = “moniker-Validator-name”

#Comma-separated list of seed nodes to connect to Cosmos-Hub 
 Peers=

"64da6049644cc21736544056fba402310ad8a7fe@51.68.162.218:26656"

Save the file and open gaia.toml

Edit config.toml, add seeds and verify moniker name is ok. Moniker name is the name than your Validators show in the explorers.

vi gaiad.toml

Add this gas price

minimum-gas-prices = “0.025uatom”

Save the file and Start Cosmos

docker run -p 26657:26657 -p 26656:26656 -v $HOME/.gaiad:/root/.gaiad meleatrust/cosmos-sdk:v0.34.6  gaiad start

When are sure that the node is downloading blocks and its sync, feel free to close for the run in detached mode.

For close (CRL+C)

For Run in detached mode add (-d) to the docker command.

docker run -d -p 26657:26657 -p 26656:26656 -v $HOME/.gaiad:/root/.gaiad meleatrust/cosmos-sdk:v0.34.6 gaiad start

In detached mode the process is running on docker, can close the session and back later the Cosmos is working meanwhile on docker.

For stop when is running in -d mode

docker ps
#output
#CONTAINER ID
b6d0577f8bf7
#Stop the node
docker stop b6d0577f8bf7
#Now the node is stop.

For run the commands to cosmos in docker just add ( — network=”host” )

Example to see the status from your node meanwhile is running

docker run --network="host" meleatrust/cosmos-sdk:v0.34.6 gaiacli status

# AKA Cosmos status=

“catching_up”:true = the node is downloading and is not full sync yet. When is “False” the node is full sync the last block.
“network”:”cosmoshub-2" = The actual network to the node is connected.
“latest_block_height”:”851" The actual last block sync in this node.
“voting_power”:”0"} total amount of tokens delegates to this validator.

Create add a new key AKA create a new account

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli keys add imvalidator

Keep safe the words for recovery the account whenever necessary. AKA (Seed phrase)

For recover your account from the Cosmos fundraiser or so with the Seed phrase just

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli keys add imvalidator --recover

Note the account from the fundraiser is different than the actual Cosmos address, not worry, after dump your safe words obtain a new account new format with the balanced from the fundraiser.

For see the new accounts in the localhost.

docker run -it -v $HOME/.gaiacli:/root/.gaiacli  meleatrust/cosmos-sdk:v0.34.6 gaiacli keys list

List of commands for play and learn.

docker run --network="host" meleatrust/cosmos-sdk:v0.34.6 gaia -h
docker run --network="host" meleatrust/cosmos-sdk:v0.34.6 gaiacli -h
docker run --network="host" meleatrust/cosmos-sdk:v0.34.6 gaia version
docker run --network="host" meleatrust/cosmos-sdk:v0.34.6 gaiacli version

For see the Docker container ID and IP

docker ps
#output
#CONTAINER ID
b6d0577f8bf7
#Run for see the IP
docker inspect --format '{{ .NetworkSettings.IPAddress }}' b6d0577f8bf7
#Output
172.17.0.2
Add this address to External address in config.toml
vi .gaiad/config/config.toml
# Address to advertise to peers for them to dial
# If empty, will use the same port as the laddr,
# and will introspect on the listener or use UPnP
# to figure out the address.
external_address = "tcp://172.17.0.2:26656"

Stop gaiad to apply the new setup

docker stop container-ID

Start Cosmos

docker run -d -p 26657:26657 -p 26656:26656 -v $HOME/.gaiad:/root/.gaiad meleatrust/cosmos-sdk:v0.34.6 gaiad start

Ok for now in the command line have to use the flag node

(--node http:……….)

so for used your own local node running in docker same machine

--node http://172.17.0.2:26657

But is your node is not synced the last blocks or for any reason want to connect to another node just use this IP in the flag node

--node http://172.17.0.2:26657

or used one IP from one node full sync

--node http://51.68.162.219:26657

Check the Balanced in the account

The balanced is true when the node is totally synced the last block.

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli query account cosmos1zqght.......t --trust-node --node http://172.17.0.2:26657

Delegate Stake to Validators you preferred and liked.

How to delegate stake?

Where can see the Validator list:

Cosmos Explorers

https://stake.id/#/

https://stargazer.certus.one/

https://www.mintscan.io/validators

https://cosmos.bigdipper.live/validators

https://cosmos-overview.genesislab.net/

https://hubble.figment.network/chains/cosmoshub-2

List of actives Validators via command line

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli query staking validators --chain-id cosmoshub-2 --node http://51.68.162.219:26657

This is one validator and other different is bellow

In the explorer can see the same details but more web site style.

This is my Validator = meleaTrust

https://cosmos.bigdipper.live/validator/51DB2566204EE266427EA8A6CB719835AB170BE9

Now in the process for down the commission every day 1% less until going to 0% for some time.

Consider delegate some $Atoms to my node if you wish more work like this.

Every day we try to do the best job in validation possible. And be near to the community.

https://meleatrust.com/cosmos-melea-trust-validator/

Need assistance or any help feel free to DM Telegram user @melea_trader @meleatrust or sent email tomeleacrypto@gmail.com

Talking about ATOMS and UATOMS

1 Atom = 1,000,000.00 UATOMS

Example for delegate 1000 atoms

for Delegate 1000 ATOMS = 1000000000 UATOMS

For delegate to one validator have to check the operator address in the description for each validator.

Operator Address :cosmosvaloper1zqgheeawp7cmqk27dgyctd80rd8ryhqs6la9wc

After copy, the address for delegate cosmosvaloper….. paste in the cmd like in the next example.

You can delegate to as many Validators as you want

In the next command, I used in the flag (--node) another server that is sync the last block meanwhile my docker is sync, can send the TX to another node via like to (--node http://51.68.162.219:26657)

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli tx staking delegate cosmosvaloper1zqgheeawp7cmqk27dgyctd80rd8ryhqs6la9wc 1000000000uatom --gas auto --gas-prices 0.025uatom --from keyname --chain-id cosmoshub-2 --node http://51.68.162.219:26657

If after sending one TX the output is

ERROR: broadcast_tx_commit: Response error: RPC error -32603 — Internal error: Timed out waiting for tx to be included in a block

This means your transaction is in the pool for becoming true. just have to wait, but if have some bad parameter like less gass, then fail, have to check later in the explorers if come true after a while. If not sent again.

For Undelegate or Unbond and get Atoms Out the validator service

Example for Unbond 1000 atoms from Validator

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli tx staking unbond cosmosvaloper1zqgheeawp7cmqk27dgyctd80rd8ryhqs6la9wc 1000000000 --gas auto --gas-prices 0.025uatom --from keyname --chain-id cosmoshub-2 --node http://51.68.162.219:26657

For a list of staking commands

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli tx staking -h

Then if want to redelegate from one validator to others can ask for help like

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli tx staking redelegate -h

then can see the command example and add to the docker command line.

Note: what is keyname?

keyname is the account name.

example:

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli keys list

Here NAME: melea is keyname so in the command line example

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli tx staking unbond cosmosvaloper1zqgheeawp7cmqk27dgyctd80rd8ryhqs6la9wc 1000000000 --gas auto --gas-prices 0.025uatom --from melea --chain-id cosmoshub-2 --node http://51.68.162.219:26657

Consider delegate or support my node in any way if you liked my job for CosmosHub in Validation service.

Thanks in advanced.

meleatrust Validator

docker run -it -v $HOME/.gaiacli:/root/.gaiacli meleatrust/cosmos-sdk:v0.34.6 gaiacli tx staking delegate cosmosvaloper1zqgheeawp7cmqk27dgyctd80rd8ryhqs6la9wc 100000000uatom --gas auto --gas-prices 0.025uatom --from Key-name --chain-id cosmoshub-2 --node http://51.68.162.219:26657

Happy validating

Looking for learning how to make one backup file for Cosmos Blockchain:

https://medium.com/@meleacrypto/cosmos-sdk-how-to-make-one-backup-30abcb153d54?source=friends_link&sk=08e759a9b7c44d279b0574ffb24c79ec