How to spin up a router on Connext Network (Ver. ไทย)

Rooj Rin
4 min readMay 17, 2022

--

สวัสดีครับ

วันนี้ผมจะมาแนะนำวิธีการติดตั้ง Router บน Connext Network ครับ

หากใครยังไม่รู้จักโปรดติดตาม:

Twitter

Discord

โดยวันนี้ Cloud ที่ผมจะใช้คือของ DigitalOcean

ข้อมูลเพิ่มเติม:

Connext Documentation

Hardware Minimum Requirement:

  • 8GB RAM
  • 30GB Storage
  • Redis

Part 1: สร้าง Droplets

Step 1: เข้าไปที่หน้า home ตรงแทบฝั่งซ้าย กดปุ่ม “New Project”

กรอกรายละเอียด Project Name / Project Description ตามด้วยกดปุ่ม “Create Project”

Step 2: กดปุ่ม “Create” สีเขียวแล้วเลือก “Droplets”

Step 3: เลือก settings ตามนี้นะครับ

Image: Ubuntu

Plan: Basic

i. Shared CPU

ii. CPU Option: Regular with SSD $40/month, $0.060/hour (8 GB / 4 CPUs, 160 GB SSD, 5 TB Transfer)

iii. เลือก Datacentre Region: Singapore

iv. เลือก Authentication เป็น Password

v. เลือก Monitoring เพิ่ม, ตั้งชื่อ droplets แล้วกดปุ่มสร้างได้เลย

Part 2: ติดตั้ง Docker CE

Docket CE: https://docs.docker.com/engine/install/ubuntu/

Step 1: กดปุ่ม “console” ข้างบนขวา

Step 2: Set up the repository

ลอก code แล้ววางได้เลยครับ รันทีละ command ตามลำดับ

i. Update apt Package

sudo apt-get update

sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release

ii. Add Docker’s official GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpgecho \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nulliii.

Step 3: Install Docker Engine

Install

sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

กด “Y’ รอซักแปปนึงไม่มี errors ขึ้นก็ผ่านครับ

Part 3: ติดตั้ง Docker Compose

Docker Compose: https://phoenixnap.com/kb/install-docker-compose-on-ubuntu-20-04

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04

สามารถข้ามมาที่ “Step 3: Download the Latest Docker Version” ตาม Doc ได้เลย ลอก code แล้ววางได้เลยครับ รันทีละ command ตามลำดับ

Step 1: Download Docker

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Step 2: Change File Permission

sudo chmod +x /usr/local/bin/docker-compose

Step 3: Check Docker Compose Version

docker-compose --version

Part 4: Cloning Connext Respository and Basic Setup

https://docs.connext.network/routers/spinning-up/

Step 1:

git clone https://github.com/connext/nxtp-router-docker-compose.gitcd nxtp-router-docker-compose/git checkout amarok

เราเข้า branch “amarok” เรียบร้อย

Step 2: เราต้องแก้ไข files มีอยู่สามอัน

i. env.example

ii. config.example.json

iii. key.example.json

Step 2.1: env.example

  1. กรอก
nano .env.example

เสร็จแล้วเช็ค version ที่: https://github.com/connext/nxtp/releases

version: 0.2.0-beta.6 (ณ ตอนนี้)

2. แก้ตรงช่อง ROUTER_VERSION=0.2.0-beta.6

3. เสร็จแล้วกด Control + S และ Control + X เพื่อออก

4. ทำการ copy

cp .env.example .env

5. ลองเช็ค version โดยการกด

nano .env

6. กด Control + X เพื่อออก

Step 2.2: config.example.json

  1. Copy file config
cp config.example.json config.json

2. ลองเช็ครายละเอียด chain

cat config.json

ขึ้นแบบนี้ก็เรียบร้อยครับ

Step 2.3: key.example.yaml

  1. Copy file key
cp key.example.yaml key.yaml

2. เข้าไป edit โดย

nano key.yaml

3. Generate private key โดยการเข้าไปที่เว็ป: https://allprivatekeys.com/mnemonic-code-converter

เลือก Ethereum แล้วกด Generate

4. เลื่อนลงมาข้างล่างแล้วคัดลอก Private Key ไว้

สิ่งที่ต้องระวังคือลอกทุกอย่างยกเว้น “0x”

5. นำไปวางตรง file key.yaml

6. เสร็จแล้วกด Control + S และ Control + X เพื่อออก

*อย่าลืมจด Seed Phrase, Addresss, Public Key, Private Key ไว้*

Update 3 Files เรียบร้อยแล้ว

Step 3: Running the Router

กด command:

docker-compose up -d

รอซักพัก ใช้เวลาอยู่ครับ เสร็จแล้วจะขึ้น:

สำเร็จเรียบร้อยครับ

Step 4: Logs checking (Monitoring)

docker logs (ตามด้วยชื่อ containers)docker logs router
docker logs signer
etc.

ผมลอง check logs ของ signer นะครับ

เสร็จเรียบร้อยครับ เดี่ยวจะมาเขียนเรื่องการใช้ Grafana Dashboard, Add LP, Mint $TEST, กับ version ภาษาอังกฤษให้นะครับ รอแปปนึง

ขอบคุณเจ้าของวีดีโอด้วยนะครับช่วยผมไว้เยอะเลย: https://www.youtube.com/watch?v=ShNRtdV4URA&t=683s

ติดตามได้ที่: https://twitter.com/r_rooj

--

--

Rooj Rin

19 yrs old, Computer Science and Electronic Engineering Undergrad @ University of Bristol, Blockchain + Crypto + Defi Enthusiast