Try   HackMD

Setup Feed Guide

Disclaimer: These instructions are made for Ubuntu 20.04. The commands may not match 100% on other distros, nor is there any guarantee that it will work. Avoid using containerization software like Docker if possible as these cause networking issues.

Set Up A New VPS

Please create a fresh VPS and do not attempt to update your existing VPS. Please also don't wipe the VPS running your current Feed because we need to run both networks in parallel to ensure a smooth transition. If this is not possible for you due to unique infra setups like running a home server please reach out to @marcandu on Keybase for further guidance.

Hardware requirements:

  • 4 GB ram
  • 4 vCPU
  • 120 GB storage

Login to VPS as root:
ssh root@<PEER_IP>

Patch system:
apt-get update && apt-get upgrade -y

Create a new user:

adduser <USER>
usermod -aG sudo <USER>

do NOT make your username contain the word omnia!

Two-factor authentication is strongly recommended. Here are some options:

Sync ssh permissions to new user:
rsync --archive --chown=<USER>:<USER> ~/.ssh /home/<USER>

Ensure .ssh permissions are set correctly

chmod 700 /home/<USER>/.ssh
chmod 644 /home/<USER>/.ssh/authorized_keys

Save login to Env on Workstation
Logout of VPS
logout

Append to .profile configuration on your workstation

echo 'export MYFEED="<USER>@<PEER_IP>" ' >>~/.profile
source ~/.profile

Login to VPS as user
ssh $MYFEED

Transfer Ethereum Keys

You will need to use the exact same keys on your new Feed as your previous Feed. Keep in mind your Feeds Ethereum keys are extremely sensitive. If anyone were to obtain it, they could launch an Oracle attack impersonating your Feed. If you don't know the location of your keys you can do cat /etc/omnia.conf and get the path from the ethereum.keystore and ethereum.password fields.

YOU SHOULD NOT RE-USE THE SAME SSB KEY SECRET OR GOSSIP.JSON FILE

New node
mkdir ~/keys

From your existing node:

scp keystore.json <USER>@<NEWVPS>:keys/
scp password.txt <USER>@<NEWVPS>:keys/

Install Feed

Install Nix

curl -L https://nixos.org/nix/install | sh
. /home/<USER>/.nix-profile/etc/profile.d/nix.sh

Configure Feed Environment

vim ~/caps.json

Paste the following snippet into caps config and save the file:

<ask for the caps configuration>

Install Omnia and Dependencies
nix-env -i --verbose -f https://github.com/chronicleprotocol/oracles/tarball/stable

Go make a coffee, this will take some time

Configure Gofer, Spire, Scuttlebot and Omnia
install-omnia feed --ssb-caps ~/caps.json --ssb-external <your external ip here> --eth-rpc <https://node1[:port]/path> --eth-rpc <https://node2[:port]/path> --eth-rpc <https://node3[:port]/path>

Configure Omnia Config File

install-omnia will have copied the omnia configuration file to /etc/omnia.conf
Three fields will need to be changed ethereum.(from, keystore, and password)

sudo vim /etc/omnia.conf

These MUST be the same keys you use on your current Feed.

Replace ethereum.from with your ethereum public key
Replace ethereum.keystore with the path to the directory containing your keystore
Replace ethereum.password with the path to the file containing the password to unlock your keystore

Set Scuttlebot and Omnia as systemd services and schedule to run on system boot

sudo systemctl daemon-reload
sudo systemctl enable --now ssb-server
sudo systemctl enable --now splitter-agent.service
sudo systemctl enable --now gofer-agent
sudo systemctl enable --now spire-agent
sudo systemctl enable --now omnia

[fyi] To stop running Omnia and Scuttlebot

sudo systemctl stop ssb-server
sudo systemctl stop omnia

[fyi] To stop Omnia and Scuttlebot from starting on system boot

sudo systemctl disable --now ssb-server
sudo systemctl disable --now omnia

Logging and Monitoring

Check that gofer is functionnal

gofer -c /etc/gofer.conf  prices WSTETH/USD --format=trace

note: if you get the error not enough sources to calculate median, wait two minutes and try again

Check Status of Omnia and Scuttlebot

sudo systemctl status ssb-server
sudo systemctl status omnia

Check Scuttlebot logs
sudo journalctl -feu ssb-server

Check Omnia logs
sudo journalctl -feu omnia

Verify Configuration

Verify that ssb-server is running on ports 8007 and 8988.
If these ports are not correct, your Feed will not function correctly!
sudo lsof -i -P -n | grep LISTEN | grep ssb-serve

Generate Invite Codes

Generate an invite code with 100 users and send it to @marcandu on Keybase. They will then post the invite code on your behalf on the keybase channels, which will help protecting your privacy.

ssb-server invite.create 100

Accept invite

As you see invites posted in the Keybase channel please be sure to accept them by doing the following:

ssb-server invite.accept “invite_code_here”

If you get an error, this usually means the other peer already accepted your invite.