Skip to content

Instantly share code, notes, and snippets.

@webmaster128
Last active April 22, 2022 08:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save webmaster128/af65a1d499bf246e08dac99d445dd26a to your computer and use it in GitHub Desktop.
Save webmaster128/af65a1d499bf246e08dac99d445dd26a to your computer and use it in GitHub Desktop.
Sync Juno from genesis (April 7th, 2022)

Run juno node from genesis

Base installation

Tested on Ubuntu 20.04 but should be very similar for all Ubuntu/Debian systems. Logged in as root because I'm feeling lucky.

# Base installation
apt update && apt upgrade -y \
  && apt install -y joe git build-essential jq screen

# Reboot?
reboot

# Install Go
wget -N https://go.dev/dl/go1.17.linux-amd64.tar.gz \
 && rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.linux-amd64.tar.gz \
 && echo 'export PATH=$PATH:/usr/local/go/bin' >> $HOME/.profile \
 && echo 'export PATH=$PATH:~/go/bin' >> $HOME/.profile \
 && source $HOME/.profile \
 && go version

# Install IPFS
wget -N https://dist.ipfs.io/go-ipfs/v0.12.0/go-ipfs_v0.12.0_linux-amd64.tar.gz \
  && tar -xvzf go-ipfs_v0.12.0_linux-amd64.tar.gz \
  && (cd go-ipfs && bash install.sh) \
  && ipfs --version \
  && ipfs init

Start IPFS daemon

ipfs daemon &

Build juno 3.0.0

git clone https://github.com/CosmosContracts/juno.git \
  && cd ~/juno \
  && git checkout v3.0.0 \
  && make install \
  && junod version

Reset data dir

rm -rf ~/.juno \
  && export CHAIN_ID=juno-1 \
  && export MONIKER_NAME="Validatron 9000" \
  && export MORE_PEERS="cf9c45145f06198d3c72aa819b89b916f275e404@sentry-1.juno.ezstaking.io:26009,dedcf7bc2de6e4f27705bdab4b8f3f11fcbe1354@sentry-2.juno.ezstaking.io:26656,8656957a311dc882523654e25a1d8e2f014cd353@sentry-3.juno.ezstaking.io:26656" \
  && export PEERS="$(curl -s https://raw.githubusercontent.com/CosmosContracts/mainnet/main/juno-1/persistent_peers.txt),$MORE_PEERS" \
  && junod init "$MONIKER_NAME" \
  && ipfs get bafybeicg7e6ird3trbjklxyocjhiao4w65crje5bdp5gq6ypwtknrvetkq --output juno-phoenix-genesis.tar.gz \
  && tar -xvf juno-phoenix-genesis.tar.gz -C $HOME/.juno/config \
  && sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" ~/.juno/config/config.toml

Run juno 3.0.0 from genesis (initial height 2578099) to 2616300

cd ~ && junod start --halt-height 2616300 >>junod_3.0.0.log 2>&1

Notes:

  • This version has a memory leak in Wasmer. Better disable swap. You might need to restart the node during sync a few times when it is killed due to OOM.
  • Not sure if halt-height is neede because the node will crash with.
  • You might want to add --x-crisis-skip-assert-invariants if you feel like YOLO

Back up ~/.juno

That way you don't have to go through genesis loading and invariant checks later on if something goes wrong.

# Check disk space and folder size
df
du -hs ~/.juno

# Copy
cp -R ~/.juno ~/.juno_backup

Continue with juno 3.1.1

Build:

cd ~/juno \
  && git fetch --all \
  && git checkout v3.1.1 \
  && make install \
  && junod version

Start:

cd ~ && junod start >>junod_3.1.1.log 2>&1

Notes:

  • This version seems to leak memory too. Better disable swap. You might need to restart the node during sync a few times when it is killed due to OOM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment