Skip to content

Instantly share code, notes, and snippets.

@mina86
Created July 6, 2023 16:39
Show Gist options
  • Save mina86/3595acbaa07e4d9fc2046cef40c7f7d5 to your computer and use it in GitHub Desktop.
Save mina86/3595acbaa07e4d9fc2046cef40c7f7d5 to your computer and use it in GitHub Desktop.
Installing and starting mainnet osmosisd

The Osmosis Installer script is a bit broken and it needs some help to get working. Most notably, it’ll delete ~/.osmosisd directory and then complain that it doesn’t exist. Thankfully this is relatively simple to fix.

cd
curl -sL https://get.osmosis.zone/install > install.py

patch -p1 <<EOF
diff -Naur old/install.py new/install.py
--- old/install.py	2023-07-06 16:23:28.847463778 +0000
+++ new/install.py	2023-07-06 16:25:34.603500350 +0000
@@ -884,6 +884,11 @@
         subprocess.run(["brew install aria2"], shell=True, env=my_env)
         subprocess.run(["brew install lz4"], shell=True, env=my_env)
     colorprint("Downloading Snapshot...")
+
+    home = os.path.expanduser(osmo_home)
+    if not os.path.isdir(home):
+        os.mkdir(home)
+
     proc = subprocess.run(["curl https://osmosis-snapshot.sfo3.cdn.digitaloceanspaces.com/osmosis.json|jq -r '.[] |select(.file==\"osmosis-1-pruned\")|.url'"],
                           capture_output=True, shell=True, text=True)
     os.chdir(os.path.expanduser(osmo_home))
@@ -904,6 +909,11 @@
     else:
         subprocess.run(["brew install aria2"], shell=True, env=my_env)
         subprocess.run(["brew install lz4"], shell=True, env=my_env)
+
+    home = os.path.expanduser(osmo_home)
+    if not os.path.isdir(home):
+        os.mkdir(home)
+
     colorprint("Downloading Snapshot from " + location + " ...")
     proc = subprocess.run(["curl -L https://quicksync.io/osmosis.json|jq -r '.[] |select(.file==\"" + fileName +
                           "\")|select (.mirror==\"" + location + "\")|.url'"], capture_output=True, shell=True, text=True)
EOF

python3 install.py -m

Now we need to get the genesis file and setup proper seeders. I’m not sure if the install script was supposed to do it for me, but in my case I was missing the genesis file. As for seeders, I’m not really sure if this is needed but things seemed to work better for me once I updated them. The sed command is one taken from https://polkachu.com/installation/osmosis.

cd /home/mpn/.osmosisd/config/
wget -O genesis.json https://snapshots.polkachu.com/genesis/osmosis/genesis.json --inet4-only
sed -i 's/seeds = ""/seeds = "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:12556"/' config.toml

Finally, I’m not sure if the install script is supposed to build the osmesisd binary but again in my case this didn’t happen so now it’s time to build the binary manually.

Make sure you have go version 1.19 or newer. If you have newer, building osmosis will fail because Makefile expects minor version to be exactly 19. However, things should work fine if you have newer version of go. You just need to patch the Makefile as shown below.

(Note: Below is for version 15.2.0. If you’re reading this in the future, make sure you checkout correct branch).

cd ~
git clone https://github.com/osmosis-labs/osmosis
cd osmosis
git checkout v15.2.0

patch -p1 <<EOF
diff --git a/Makefile b/Makefile
index 2689dba54..c8316a5db 100644
--- a/Makefile
+++ b/Makefile
@@ -92,3 +92,3 @@ ifneq ($(GO_MINOR_VERSION),19)
        @echo "ERROR: Go version 1.19 is required for this version of Osmosis."
-       exit 1
+#      exit 1
 endif
EOF

make build-all
cp build/osmosisd ~/go/bin/osmosisd

Node should now work which can be tested by looking at the logs:

journalctl -u osmosisd -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment