Skip to main content
Version: 0.2.x-amarok

Spinning up NXTP Router guide

image

Automatic script, manual installing commands, liquidity providing.

What is in:

  • Using the automatic script you can spin up a router from scratch or upgrade to the latest or another one version you like to. image
MenuDetail
1Install + Auto PKeyAutomatic setup router and generate private key
2Install + Your PKeyAutomatic setup router with your private key
3Auto UpgradeAuto upgrade router to the latest released version
4Manual UpgradeManual upgrade router version
5Backup PKeyBackup and show your private key
6DeleteDelete Router and everything relating to it
7Check VersionChecking latest released Router version, latest docker image and your current version
8QuitQuit on menu
  • Using manual installing commands you can understand exactly how the installation process step by step works.
  • Add liquidity to your router and take part in the testnet.

⚠️ Requirements

Minimum Hardware Requirements
🔲 8GB RAM
🔲 30GB Storage

Preparation

  1. Private key of your wallet from Metamask.
    For safety reason create a new wallet address for router. You can create it in Metamask extention or get it automatically during installation.
  1. Setup provider endpoints. You have to add it to config.json file to use your own endpoints. For that we will use the nodes provided by the service Infura.

    You can use also blastapi.io as RPC privider to get endpoints for almost any network (the guide how to get it).

    2.1 Register at infura.io and create new project:

    screenshot
screenshot

2.2 Open settings:

screenshot

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

screenshot

Keep this data handy, you will need it for further installation

Quick router setup

Copy and paste this code to run script in your terminal.

Select install menu to setup Router and follow instructions. During the installation you will need to insert the private key from Metamask (not your public address), and the project ID from Infura.

wget -q -O nxtp-router.sh https://raw.githubusercontent.com/martynovalek/NXTP-Router-setup/main/Full%20version/nxtp-setup.sh && chmod +x nxtp-router.sh && . <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n router_menu -v "cd $HOME; sudo /bin/bash nxtp-router.sh" -a && router_menu

The script will add a command to the system to view the logs as a variable.

  • To view logs use router_log
  • To open menu use router_menu

Manual install

1. Update and install packages

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

2. Install Docker and Docker-compose latest version

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
rm get-docker.sh
DOCKER_VER="$(curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | awk 'BEGIN{FS="v"} {print $2}')"
curl -SL https://github.com/docker/compose/releases/download/v$DOCKER_VER/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 and pull the latest released Router version

You can check the latest version here: https://github.com/connext/nxtp/releases

LATEST="$(curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/connext/nxtp/releases/latest | awk 'BEGIN{FS="v"} {print $2}')" && echo $LATEST
docker pull ghcr.io/connext/router:$LATEST

⚠️ Basic configuration

Read more about configuration files...

Network Configuration

The router does not require any ports to be open for inbound access.

danger

Do NOT expose the ROUTER_EXTERNAL_PORT to anyone untrusted! It should only be accessible by the operator in a trusted environment.

Environment Config

Create a .env file in the root directory of the repository based on the env.example file.

Modify the following environment variables:

  • ROUTER_VERSION - The version of the router to use (e.g. 0.2.0-alpha.16). See the releases page for the latest released version.
  • ROUTER_EXTERNAL_PORT - Exposed port of the router. Remember to not expose this port to the public.
  • GRAFANA_EXTERNAL_PORT - Exposed port of the Grafana dashboard.
  • LOGDNA_KEY - This key is used by logna container. You can get this key by sign up here

Redis Config

The router uses an internal Redis instance in Docker by default. However, if you prefer to use your external Redis instance, you can set the corresponding host and port field in config.json. Instructions can be found on the Redis website.

Web3Signer Config

Set up Web3Signer config files to set the private key securely. Create a key.yaml file based on the key.example.yaml file. Fill the private key of your signer to key.yaml.

Router Config

Create a config.json file based on the config.example.json file. At minumum, change the following values:

  • sequencerUrl - The URL of the Sequencer node.
  • redis - The Redis instance to use.
  • server - Internal HTTP server config (adminToken).
  • chains - Add your desired chains, assets, and provider URLs. Use Domain IDs. instead of chainIds. For more domain ids of chains, please check https://raw.githubusercontent.com/connext/chaindata/main/crossChain.json . Make sure you use multiple providers for each chain! Example with the current testnet assets:
{
...
"chains": {
"1111": {
"assets": [
{
"address": "0x3FFc03F05D1869f493c7dbf913E636C6280e0ff9",
"name": "TEST"
}
],
"providers": ["https://rinkeby.infura.io/v3/...", "https://rpc.ankr.com/eth_rinkeby"]
},
"2221": {
"assets": [
{
"address": "0x3FFc03F05D1869f493c7dbf913E636C6280e0ff9",
"name": "TEST"
}
],
"providers": ["https://kovan.infura.io/v3/..."]
},
"3331": {
"providers": [
"https://goerli.infura.io/v3/..."
],
"assets": [
{
"address": "0x3FFc03F05D1869f493c7dbf913E636C6280e0ff9",
"name": "TEST"
}
]
}
}
}
  • web3SignerUrl - Set to "http://signer:9000".
  • redis
    • host - Set to the host name of your external Redis instance.
    • port - Set to the port of your external Redis instance.

See the Configuration section for more details.


4. Setup .env file

cp .env.example .env
sed -i 's/latest/'$LATEST'/g' .env

5. Setup key.yaml file

cp key.example.yaml key.yaml

Run this command and paste your private key from Metamask

read -p "Insert your Private Key from Metamask: " yourpk
sed -i 's/dkadkjasjdlkasdladadasda/'${yourpk}'/g' key.yaml

6. Setup config.json file.

wget -O config.json https://raw.githubusercontent.com/martynovalek/NXTP-Router-setup/main/Full%20version/config.json

Run this command and paste your Project ID from Infura

read -p "Insert your Project ID from Infura: " PROJECT_ID
sed -i 's/project_ID/'${PROJECT_ID}'/g' $HOME/connext/nxtp-router-docker-compose/config.json

7. Run your Router

cd $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

screenshot_infura

Usefull commands

Open Router menu:

router_menu

Check logs:

Add this command as variable:

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n router_log -v "docker logs --follow --tail 100 router" -a

Check logs:

router_log

Restart Docker containers:

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

Stop all running Docker containers:

docker stop $(docker ps -a -q)

Restart Docker deamon:

sudo systemctl restart docker
sudo systemctl status docker

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

Update Router Version:

You can check the latest version here: https://github.com/connext/nxtp/releases

Check current version of Router:
The output will show you which current version

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

Check new version of Router:
The output will show you which new version

NEW="$(curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/connext/nxtp/releases/latest | awk 'BEGIN{FS="v"} {print $2}')" && echo $NEW

If you need to update run the commands below:
Modify the .env file:

sed -i.bak -e "s/$CURRENT/$NEW/" $HOME/connext/nxtp-router-docker-compose/.env

Ensure .env file has a new version:

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

Liquidity and testnet

Now we have to add liquidity on 3 test chains to our Router and make some transactions.

  1. Go to https://amarok-testnet.coinhippo.io/ and connect wallet you have linked to your Router.
  2. Under the form you'll see the Faucet. Get 1000 $TEST on each chain.faucet
  3. Go to https://testnet.amarok.connextscan.io/router/ROUTER_ADDR (paste your router address at the end of the link)
  4. Select manage router and add some tokens to liquidity. Keep some tokens on your wallet balance to send a few transactions
    image image
  5. Go to https://amarok-testnet.coinhippo.io/ again and make some transactions.
  6. The transactions takes usually 2-3 minutes. Sometimes it can takes much more time. Please give your feedback on discord channel #testnet-feedback

Usefull links

  • How to deploy your router using helm — Guide