Skip to content

Instantly share code, notes, and snippets.

@JacobPlaster
Created April 22, 2019 23:47
Show Gist options
  • Save JacobPlaster/e41307fd4034dcb465a46205653721db to your computer and use it in GitHub Desktop.
Save JacobPlaster/e41307fd4034dcb465a46205653721db to your computer and use it in GitHub Desktop.
Setup cosmos node

Setup cosmos mainnet node on Ubuntu

Install go

curl -O https://storage.googleapis.com/golang/go1.12.4.linux-amd64.tar.gz
tar -xvf go1.12.4.linux-amd64.tar.gz   
mv go /usr/local/go

sudo apt install make
sudo apt install make-guile
sudo apt install gcc

Update bash_profile

export GOPATH=$HOME/go
export GOBIN=/usr/local/go/bin
export PATH=$PATH:$GOBIN
export PATH=$PATH:$GOPATH
export PATH=$PATH:/usr/local/go/bin/

Download gaia

mkdir -p $GOPATH/src/github.com/cosmos
cd $GOPATH/src/github.com/cosmos
git clone https://github.com/cosmos/cosmos-sdk
cd cosmos-sdk

Build toolset

git checkout master
make tools install

Initialise node

gaiad init <your_custom_moniker>
mkdir -p $HOME/.gaiad/config
curl https://raw.githubusercontent.com/cosmos/launch/master/genesis.json > $HOME/.gaiad/config/genesis.json

Add seeders and peers to $HOME/.gaiad/config/config.toml

vim $HOME/.gaiad/config/config.toml

# Add the following

# Comma separated list of seed nodes to connect to
seeds = "3e16af0cead27979e1fc3dac57d03df3c7a77acc@3.87.179.235:26656,ba3bacc714817218562f743178228f23678b2873@public-seed-node.cosmoshub.certus.one:26656,2626942148fd39830cb7a3acccb235fab0332d86@173.212.199.36:26656,3028c6ee9be21f0d34be3e97a59b093e15ec0658@91.205.173.168:26656,89e4b72625c0a13d6f62e3cd9d40bfc444cbfa77@34.65.6.52:26656"

Start syncing

gaiad start

Note: you can use gaiacli status to check if the status of the node

@JacobPlaster
Copy link
Author

JacobPlaster commented Apr 23, 2019

Also, to start the http rest api:

gaiacli rest-server --chain-id=0 --laddr=tcp://localhost:1317 --node tcp://localhost:26657

The server only seems to like requests sent from the local machine so if the node is remote you can use socat to forward from an exposed port:

socat TCP-LISTEN:1318,fork TCP:127.0.0.1:1317

@JacobPlaster
Copy link
Author

git checkout dba33693 is the working commit for the go-server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment