Не актуально
June 5, 2022

Spinning up NXTP Router version 0.2.0-beta.8 + update

Minimum Hardware Requirements
🔲 8GB RAM
🔲 30GB Storage
🔲 Redis (not necessary, as it is used in the docker by default)

Prepair to install

  1. Prepare in advance a private key of your wallet from Metamask. You should enter it right after running the script.
    For safety reason create a new wallet address for router.
  2. Setup provider endpoints. Then you'll add it to config.json file to use your own. For that we will use the nodes provided by the service Infura.

2.1 Register at infura.io and create new project:

2.2 Open settings and save all:

2.3 And copy your project ID. It will be the same on any network

Quick router setup (oneliner script)

Manual install

1. Update and install packages

sudo apt update && sudo apt upgrade -y
apt install git sudo unzip wget curl htop -y

2. Install Docker and Docker-compose

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
rm get-docker.sh
curl -SL https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

3. Install Router

cd $HOME
mkdir -p connext && cd connext
git clone https://github.com/connext/nxtp-router-docker-compose.git
cd $HOME/connext/nxtp-router-docker-compose
git checkout amarok

Get the Router version 0.2.0-beta.8

docker pull ghcr.io/connext/router:0.2.0-beta.8

4. Create .env, config and key files:

cp .env.example .env
wget -O config.json https://raw.githubusercontent.com/martynovalek/NXTP-Router-install/main/config.json
wget -O key.yaml https://raw.githubusercontent.com/martynovalek/NXTP-Router-install/main/key.yaml

Delete example files:

rm config.example.json .env.example key.example.yaml

5. Setup key.yaml file

Paste your private key from Metamask instead of <your_key>

PRIVATE_KEY="<your_key>"

Use command below to write key into key.yaml file

sed -i 's/your_privatekey/'$PRIVATE_KEY'/g' key.yaml

6. Setup config.json file.

Paste your Project ID from Infura into the command below instead 'XXXX'

PROJECT_ID="XXXX"
sed -i 's/224d26fcdc02495c921bb5d74702002e/'$PROJECT_ID'/g' $HOME/connext/nxtp-router-docker-compose/config.json

7. Setup .env file

sed -i 's/latest/0.2.0-beta.8/g' .env

8. Run your Router
Ensure your currently directory is $HOME/connext/nxtp-router-docker-compose

docker-compose down
docker-compose up -d

Check logs:

cd $HOME/connext/nxtp-router-docker-compose
docker logs --follow --tail 100 router

Now you can check data of your provider at infura.io

Additional commands

Restart Docker:

cd $HOME/connext/nxtp-router-docker-compose
docker-compose restart

Update Router Version:

We have to modify .env to change ROUTER_VERSION
You can check the latest version here: https://github.com/connext/nxtp/releases

Enter new version instead of <new_ver>:

NEW="<new_ver>"

Modify the .env file:

CURRENT=$(cat $HOME/connext/nxtp-router-docker-compose/.env | grep ROUTER_VERSION | awk -F '=' '{print$2}')
sed -i.bak -e "s/$CURRENT/$NEW/" $HOME/connext/nxtp-router-docker-compose/.env

Check current version in .env file:

cat $HOME/connext/nxtp-router-docker-compose/.env | grep ROUTER_VERSION | awk -F '=' '{print$2}'

Now update the stack and check logs:

cd $HOME/connext/nxtp-router-docker-compose
docker-compose down
docker-compose pull
docker-compose up -d
docker logs --follow --tail 100 router

Delete Router and everything relating to it:

cd ~/connext/nxtp-router-docker-compose
docker-compose down
docker system prune -a
cd && rm -rf $HOME/connext