[Ethereum] 우분투에 node 설치

execution layer client로 geth를, consensus layer client로 Prysm을 사용한다.

geth 설치

sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt update
sudo apt install -y geth

확인

geth version

부팅 시 자동 실행

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

[Unit]
Description=Ethereum Geth Node
After=network.target

[Service]
Type=simple
User=dasomoli
ExecStart=/usr/bin/geth --mainnet --syncmode "snap" --datadir "/home/dasomoli/geth/data" --http --http.api web3,eth,txpool --http.addr 0.0.0.0
Restart=always
RestartSec=5
LimitNOFILE=8192

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start geth
sudo systemctl enable geth
sudo systemctl status geth

IPC로 geth console 연결

geth attach ipc:/home/dasomoli/geth/data/geth.ipc

로그 확인

journalctl -u geth -f

Prysm 설치

mkdir prysm
cd prysm/
sudo apt update
sudo apt install -y wget
wget <https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh>
chmod +x prysm.sh

부팅 시 자동 실행

sudo vi /etc/systemd/system/prysm-beacon.service

[Unit]
Description=Prysm Beacon Chain Client
After=network.target

[Service]
Type=simple
User=dasomoli
ExecStart=/home/dasomoli/prysm/prysm.sh beacon-chain \
    --execution-endpoint=http://localhost:8551 \
    --datadir=/home/dasomoli/prysm/data \
    --jwt-secret=/home/dasomoli/geth/data/geth/jwtsecret \
    --accept-terms-of-use \
    --mainnet \
    --checkpoint-sync-url=https://beaconstate.info --genesis-beacon-api-url=https://beaconstate.info
Restart=always
RestartSec=5
LimitNOFILE=8192

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start prysm-beacon
sudo systemctl enable prysm-beacon
sudo systemctl status prysm-beacon

로그 확인

journalctl -u prysm-beacon -f