Skip to content

himu007/nn_mm2_seed

 
 

Repository files navigation

Basic scripts for running a MM2 Seed Node on your Notary Node

Komodo Platform's AtomicDEX-API is an open-source atomic-swap protocol for trading seamlessly between essentially any blockchain asset in existence. Seed nodes play an essential part in orderbook propagation and relaying information about peers within the network and the status of swaps in progress.

With the start of the 5th Komodo Notary Node Season, operators will be running a seed node on their third party (3P) server to further decentralize the network. This expands the current number of seed nodes from half a dozen to over 60 nodes, distributed geographically across the planet, and maintained by a diverse group of respected people within the Komodo community with great expertise in KMD related technologies and the ability to rapidly deploy updates and assist each other with troubleshooting as required.

Operators with the best metrics in terms of uptime and responsiveness to updates will also be rewarded with bonus points towards their Season 5 score, and the chance to win automatic re-election.

For each hour of uptime with the correct version, Notary Nodes will receive 0.2 points to their season score.

You'll need to open port 38890 - sudo ufw allow 38890

The simple scripts in this repository will assist operators in setting up their seed node and keeping it up to date whenever update announcements are broadcast.

gen_conf.py

Creates an MM2.json config file to define node as seed.

update_coins.sh

Downloads latest coins file from https://github.com/KomodoPlatform/coins/

update_mm2.sh

Downloads latest mm2 binary from https://github.com/KomodoPlatform/atomicDEX-API/releases

run_mm2.sh

Launches mm2, and logs output.

stop_mm2.sh

Stops mm2.

Setup

  • Clone repository git clone https://github.com/smk762/nn_mm2_seed/ && cd nn_mm2_seed
  • Install pip requirements - pip3 install -r requirements.txt (do sudo apt-get -y install python3-pip first if not installed)
  • Get latest coins file - ./update_coins.sh
  • Get latest MM2 binary - ./update_mm2.sh
  • Generate config - ./gen_conf.py (Don't use your Notary passphrase! Use a fresh one. This passphrase will be linked to your PeerID and should not be changed later)
  • Start MM2 - run_mm2.sh
  • Find your PeerID in mm2.log cat mm2.log | grep 'Local peer id'
  • Send the domain name of your server and your PeerID to smk in Discord DM (can be run on Third Party nodes, or a separate VPS in any region)
peerid.mp4

WSS Setup

In order for our seed node to be able to process WSS connections, we'll need to register a domain and generate SSL certificates.

Step 1: Obtain a Domain Name

There are many providers, and they are available for as low as $5/year. I'll use https://www.hover.com/domain-pricing for example.

Setup nameservers for DNS propagation - https://help.hover.com/hc/en-us/articles/217282477

Setup DNS records to link IP address with domain - https://help.hover.com/hc/en-us/articles/217282457-Managing-DNS-records-

I'll be using my 3P nodes, though you can run the mm2 seednode on a different server in any region.

My domain name will be smk.dog. The settings below will create the subdomains dev.smk.dog and na.smk.dog pointing to my 3P Dev & NA servers.

image

Additional subdomains for each of your nodes can be added as required.

image

DNS propagation can take a little while. You can check the progress at https://www.whatsmydns.net and / or via ping in terminal.

ping dev.smk.dog

Step 2: Generate SSL certificates with LetsEncrypt

The simplest way to do this is with the EFF's Certbot

sudo apt update && sudo apt upgrade
sudo apt install snapd
sudo snap install core; sudo snap refresh core
sudo apt remove certbot  # Remove older version if existing
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo apt install nginx
# Temporarily open port 80 so certbot can confirm certificate config
sudo ufw allow 80
sudo certbot certonly --nginx  # This might fail is DNS propagation is not yet complete - if so, try again later

image

Once the certs are generated, add entries to your MM2.json as below, substituting in your subdomain as required:

"wss_certs": {
    "server_priv_key":"/etc/letsencrypt/live/dev.smk.dog/privkey.pem",
    "certificate":"/etc/letsencrypt/live/dev.smk.dog/fullchain.pem"
}

Step 3: Open the mm2 Seednode WSS Port, and Close Port 80

sudo ufw allow 38900
sudo ufw status numbered    # To find the ID numbers for port 80
sudo ufw delete 20          # Remove port 80 on ipv6
sudo ufw delete 10          # Remove port 80 on ipv4

Step 4: Restart MM2

Start mm2 and review your logs.

./run_mm2.sh && tail -f mm2.log

If you see an error like 'Error reading WSS key/cert file "/etc/letsencrypt/live/dev.smk.dog/privkey.pem": Permission denied (os error 13)' you need to change the ownership of these files for mm2 to be able to access them.

sudo chown smk762:smk762 /etc/letsencrypt/archive/dev.smk.dog/privkey1.pem
sudo chown smk762:smk762 /etc/letsencrypt/archive/dev.smk.dog/fullchain1.pem
sudo setfacl -m 'u:smk762:rx' /etc/letsencrypt/archive /etc/letsencrypt/live    # You might need to 'sudo apt install acl' first

Once it looks like it is working, you can confirm external connections are being accepted via https://websocketking.com/

image

Additional Resources

Notes for running on Ubuntu 18 (GLIBC_2.28 not found error)

rustup install nightly-2021-05-17
rustup default nightly-2021-05-17
rustup component add rustfmt-preview
  • Build mm2:
git clone https://github.com/KomodoPlatform/atomicDEX-API
cd atomicDEX-API
git checkout 4366141c8 # check for latest valid version hash at https://github.com/smk762/DragonhoundTools/blob/master/atomicdex/seednode_version.json
cargo build -vv

Additional build notes at https://github.com/KomodoPlatform/atomicDEX-API/#building-from-source

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 81.8%
  • Shell 18.2%