Blockchain/Testnet

Sui 인센티브 테스트넷 Validator 등록을 위한 Fullnode 구축해보기

lowsec 2022. 8. 13. 00:09

Introduction

요새 Aptos와 Sui가 새로운 L1의 강자로 주목 받고 있습니다. Aptos는 현재 두 번째 인센티브 테스트넷을 운영 중이고 8월 15일부터 3번째 Phase 등록이 시작되는 것으로 알고 있습니다. Sui는 이제 처음으로 인센티브 테스트넷을 오픈하기 위해 Validator를 모집하고 있습니다. 웨이브 당 2,000 $SUI의 보상이 있으며 메인넷 출시 시점에 Validator 보상으로 Sui 토큰의 최대 10%까지 보상하겠다고 하네요. 보상으로 받은 토큰은 1년 락업 기간이 있고 수령을 위해 코인리스트 KYC가 필요할 것으로 예상합니다.

 

 

Validator Registration Open

Earlier in June, we announced Sui Incentivized Testnet. We're happy to share that registration to participate in Sui Incentivized Testnet is now open! If you are a validator, developer or Sui Enthusiast, we highly encourage you to apply and join our incent

sui.io

 

Sui validator 등록 form을 보니까 꽤나 디테일하게 요구사항을 적도록 하고 있었습니다. 이 중에 현재 운영 중인 fullnode의 rpc URL을 적는 항목이 있어서 본 포스팅에서는 Sui fullnode 구축 방법을 알아보고자 합니다.

 

Official Guide

https://docs.sui.io/build/fullnode?utm_source=blog&utm_medium=website&utm_campaign=registrvalidators

 

Run a Sui Fullnode | Sui Docs

We welcome you to run your own Sui fullnode! Sui fullnodes run a service that stores the full blockchain state and history. They service reads, either for end clients or by helping other fullnodes get up-to-date with the latest transactions that have been

docs.sui.io

 

Prerequisties (사전 요구사항)

https://docs.sui.io/build/install#prerequisites

 

Install Sui | Sui Docs

Welcome to the Sui development environment! This site is available in two versions in the menu at top left: the default and stable Devnet branch and the Latest build upstream main branch. Use the devnet version for app development on top of Sui. Use the La

docs.sui.io

본 포스팅에서는 Server 구축 및 Ubuntu 설치, docker, docker-compose 설치 방법은 생략하고 완료되었다는 가정하에 진행하도록 하겠습니다.

 

fullnode 설치 하드웨어 요구 사항 (그리 높지 않습니다.)

CPUs: 2
RAM: 8GB
Storage: 50GB

 

설치 환경: Ubuntu 20.04.4 LTS

  • Sui에서 권장하는 OS는 Ubuntu version 18.04 (Bionic Beaver)
sudo apt-get update

 

fullnode 설치에 필요한 라이브러리와 소프트웨어를 다운로드해줍니다.

sudo apt-get install -y --no-install-recommends \\
    tzdata \\
    git \\
    ca-certificates \\
    curl \\
    build-essential \\
    libssl-dev \\
    pkg-config \\
    libclang-dev \\
    cmake

rust 설치 및 업데이트

# install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# update
rustup update stable

 

네트워크 포트 개방

Sui는 네트워크 포트로 9000/tcp와 9184/tcp를 사용합니다. 포트 세팅은 https://extrememanual.net/12019 을 참고하였습니다.

 

ufw 방화벽 정책 설정 사용

sudo ufw enable

9000/tcp, 9184/tcp 개방

sudo ufw allow 9000/tcp
sudo ufw allow 9184/tcp

 포트 개방 후 상태 확인

sudo ufw status

 

Sui docker image로 fullnode 설치

official guide에 보시면 source code로 직접 빌드해서 설치하는 방법도 있으나 docker hub에 등록된 image를 받는게 제일 간단하기 때문에 docker를 이용하여 fullnode를 설치합니다.

 

https://github.com/MystenLabs/sui/tree/main/docker/fullnode#readme

 

GitHub - MystenLabs/sui: Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented

Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language - GitHub - MystenLabs/sui: Sui, a...

github.com

 

fullnode 설치를 위한 경로를 설정해줍니다. 설치 경로는 자유롭게 지정해도 좋습니다. 저는 심플한게 좋기 때문에 $HOME 디렉토리에 설치 경로를 세팅하였습니다.

mkdir ~/sui
cd sui
mkdir suidb

 

설치를 위한 파일들을 다운로드합니다.

wget https://raw.githubusercontent.com/MystenLabs/sui/main/docker/fullnode/docker-compose.yaml

wget https://github.com/MystenLabs/sui/raw/main/crates/sui-config/data/fullnode-template.yaml

wget https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob

 

docker-compose.yaml 수정

다운로드한 docker-compose.yaml을 아래와 같이 수정합니다.

---
version: "3.9"
services:
  fullnode:
    image: mysten/sui-node:stable
    ports:
    - "9000:9000"
    - "9184:9184"
    expose:
    - "9000"
    - "9184"
    volumes:
    - ./fullnode-template.yaml:/sui/fullnode.yaml:ro
    - ./genesis.blob:/sui/genesis.blob:ro
    - ./suidb:/sui/suidb:rw
    command: ["/usr/local/bin/sui-node", "--config-path", "fullnode.yaml"]
volumes:
  suidb:

 

fullnode-template.yaml 수정

sed -i 's/127.0.0.1/0.0.0.0/' fullnode-template.yaml

 

Sui fullnode 실행

docker-compose up -d

 

로그 확인

docker-compose logs -f

 

Sui fullnode 종료

docker-compose down --volume

 

동기화 상태 확인

최근의 트랜잭션 5개 조회

curl --location --request POST 'http://127.0.0.1:9000/' --header 'Content-Type: application/json' --data-raw '{ "jsonrpc":"2.0", "id":1, "method":"sui_getRecentTransactions", "params":[5] }'

transactionDigest로 특정 트랜잭션 조회

curl --location --request POST 'http://127.0.0.1:9000' \\
    --header 'Content-Type: application/json' \\
    --data-raw '{ "jsonrpc":"2.0", "id":1, "method":"sui_getTransaction", "params":["$RECENT_TXN_FROM_ABOVE"] }'

# example
curl --location --request POST 'http://127.0.0.1:9000'     --header 'Content-Type: application/json'     --data-raw '{ "jsonrpc":"2.0", "id":1, "method":"sui_getTransaction", "params":["b1BEEdpOU7gi1UTszhhLHUk8da7Ldq19gPe5W2FYhTI="] }'

 

SuiTester로 노드 상태 확인

https://node.sui.zvalid.com/

 

SUI NODETESTER

 

node.sui.zvalid.com

SuiTester라는 페이지로 fullnode가 잘 설치되어 돌아가고 있는지 확인할 수 있습니다. 설치한 노드의 port가 잘 열려있고 외부 네트워크로부터 블록을 sync한다면 아래와 같은 화면을 보실 수 있습니다.

ok-1
ok-2