how to เป็น validator บน kiln network (part 2— configure node)

Nattawat Songsom
2 min readMay 27, 2022

--

1. Configure Geth node

สร้างกับ user ไว้จัดการ node

sudo useradd --no-create-home --shell /bin/false goeth
sudo mkdir -p /var/lib/goethereum

download consensus file

cd ~
git clone https://github.com/eth-clients/merge-testnets.git

นำ consensus ไฟล์ไปวางโฟลเดอร์เดียวกับ go etheruem

sudo cp ~/merge-testnets/kiln/genesis.json /var/lib/goethereum/

ให้ permission กับ user

sudo chown -R goeth:goeth /var/lib/goethereum

setup consensus ให้กับ go etheruem

sudo -u goeth geth \
init /var/lib/goethereum/genesis.json \
--datadir /var/lib/goethereum

สร้างไฟล์ service

sudo nano /etc/systemd/system/geth.service

เนื้อหาไฟล์ดังนี้

[Unit]
Description=Go Ethereum Client - Geth (Kiln)
After=network.target
Wants=network.target
[Service]
User=goeth
Group=goeth
Type=simple
Restart=always
RestartSec=5
TimeoutStopSec=180
ExecStart=geth \
--kiln \
--http \
--datadir /var/lib/goethereum \
--metrics \
--metrics.expensive \
--pprof \
--http.api="engine,eth,web3,net,debug" \
--http.corsdomain "*" \
--http.addr "0.0.0.0" \
--authrpc.jwtsecret=/var/lib/goethereum/jwtsecret \
--bootnodes "enode://c354db99124f0faf677ff0e75c3cbbd568b2febc186af664e0c51ac435609badedc67a18a63adb64dacc1780a28dcefebfc29b83fd1a3f4aa3c0eb161364cf94@164.92.130.5:30303"
[Install]
WantedBy=default.target

ลองเปิด service

sudo systemctl daemon-reload
sudo systemctl start geth.service
sudo systemctl status geth.service

ถ้าขึ้นว่า service active อยู่ก็กด q แล้วไปต่อได้เลย

ตั้งให้ service start on reboot

sudo systemctl enable geth.service

สามารถดู logs จาก geth node ได้โดย

sudo journalctl -f -u geth.service -o cat | ccze -A

2. Configure lighthouse beacon node

สร้าง user สำหรับ run lighthouse node สร้างโฟลเดอร์สำหรับเก็บข้อมูล และให้ permission กับ user

sudo useradd --no-create-home --shell /bin/false lighthousebeacon
sudo mkdir -p /var/lib/lighthouse
sudo chown -R lighthousebeacon:lighthousebeacon /var/lib/lighthouse

สร้าง service

sudo nano /etc/systemd/system/lighthousebeacon.service

เนื้อหาไฟล์ดังนี้

[Unit]
Description=Lighthouse Ethereum Client Beacon Node (Kiln)
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=lighthousebeacon
Group=lighthousebeacon
Restart=always
RestartSec=5
ExecStart=/usr/local/bin/lighthouse bn \
--network kiln \
--datadir /var/lib/lighthouse \
--staking \
--http-allow-sync-stalled \
--merge \
--execution-endpoints http://127.0.0.1:8551 \
--metrics \
--validator-monitor-auto \
--jwt-secrets="/var/lib/goethereum/jwtsecret" \
--terminal-total-difficulty-override=20000000000000 \
--boot-nodes="enr:-Iq4QMCTfIMXnow27baRUb35Q8iiFHSIDBJh6hQM5Axohhf4b6Kr_cOCu0htQ5WvVqKvFgY28893DHAg8gnBAXsAVqmGAX53x8JggmlkgnY0gmlwhLKAlv6Jc2VjcDI1NmsxoQK6S-Cii_KmfFdUJL2TANL3ksaKUnNXvTCv1tLwXs0QgIN1ZHCCIyk"

[Install]
WantedBy=multi-user.target

เปิด permission jwt ของ goetheruem

sudo chmod +r /var/lib/goethereum/jwtsecret

รัน service lighthouse

sudo systemctl daemon-reload
sudo systemctl start lighthousebeacon.service
sudo systemctl status lighthousebeacon.service

ตั้งให้รันตอน reboot

sudo systemctl enable lighthousebeacon.service

สามารถดู logs ได้จาก

sudo journalctl -f -u lighthousebeacon.service -o cat | ccze -A

โอเค พอลองดู log ทั้ง 2 node เทียบกัน เหมือนจะยังเหลืออีกไกลเลยกว่าจะ sync เสร็จ

น่าจะต้องรอให้ฝั่ง beacon ขึ้นว่า sync ก่อนถึงจะไปทำขั้นต่อไปได้ละนะ

ref:

https://www.youtube.com/watch?v=caaV4oMmWe8

--

--

No responses yet