Oasis ノードの構築手順
システムユーザーの作成
Oasis ノードを実行するためのシステムユーザーを追加します。
sudo adduser --system oasis --shell /usr/sbin/nologinそのユーザーに SGX の利用権限を付与します。
adduser oasis sgx
adduser oasis sgx_prvディレクトリ構成
必要なディレクトリを、適切なパーミッションで作成します。
mkdir -m700 -p /node/{etc,bin,runtimes,data,web3_gateway}ファイルのダウンロード
genesis ファイル、Oasis ノード、ランタイムをダウンロードします。
wget https://github.com/oasisprotocol/testnet-artifacts/releases/download/2023-10-12/genesis.json -P /node/etc/
wget https://github.com/oasisprotocol/oasis-core/releases/download/v25.4/oasis_core_25.4_linux_amd64.tar.gz -P /node/bin
wget https://github.com/oasisprotocol/pontusx-paratime/releases/download/v0.0.2-testnet/pontusx-paratime.orc -P /node/runtimes/アテステーションツールをダウンロードします。
wget https://github.com/oasisprotocol/tools/releases/download/attestation-tool-0.3.4/attestation-toolSGX のインストール
信頼実行環境(TEE)の構築は、Oasis のドキュメントに従って行ってください。
Oasis ノードの設定
ノードの設定ファイルを /node/etc/config.yml に作成し、次の内容を記述します。
mode: compute
common:
data_dir: /node/data
log:
level:
cometbft: info
cometbft/context: info
default: debug
format: JSON
consensus:
prune:
strategy: keep_n
num_kept: 10000
external_address: tcp://${SERVER_IP}:26656
listen_address: tcp://0.0.0.0:26656
state_sync:
enabled: true
trust_period: 720h
trust_height: <! Latest - 200.000 !>
trust_hash: <! Hash from Blocknumber above !>
genesis:
file: /node/etc/genesis.json
ias:
proxy_addresses:
- y4XO1ZETqgtHeZzLLmJLYAzpEfdGSJLvtd8bhIz+v3s=@34.86.197.181:8650
- jaFE5Lq6GS76ya1V7a+XlGQTgttAagXEtknO4Tv1wLs=@185.56.138.83:8650
p2p:
port: 30002
registration:
addresses:
- ${SERVER_IP}:30002
seeds:
- HcDFrTp/MqRHtju5bCx6TIhIMd6X/0ZQ3lUG73q5898=@34.86.165.6:26656
- HcDFrTp/MqRHtju5bCx6TIhIMd6X/0ZQ3lUG73q5898=@34.86.165.6:9200
registration:
entity: /node/etc/entity.json
runtime:
paths:
- /node/runtimes/pontusx-paratime.orc
sgx_loader: /node/bin/oasis-core-runtime-loaderOasis ノードのサービス化
Oasis ノードをシステムサービスとして設定します。
サービスファイル /etc/systemd/system/oasis-node.service を作成し、次の内容を記述します。
[Unit]
Description=Oasis Node
After=network.target
[Service]
Type=simple
User=oasis
WorkingDirectory=/node
ExecStart=/node/bin/oasis-node --config /node/etc/config.yml
Restart=on-failure
RestartSec=3
LimitNOFILE=1024000
[Install]
WantedBy=multi-user.targetOasis Gateway の構築
Oasis Web3 Gateway をダウンロードします。
wget https://github.com/oasisprotocol/oasis-web3-gateway/releases/download/v5.3.4/oasis_web3_gateway_5.3.4_linux_amd64.tar.gz -P /node/web3_gateway/Docker 用のディレクトリを作成します。
mkdir -m700 /node/web3_gateway/dockerPostgreSQL を実行するための docker-compose.yaml を作成し、データベースユーザーのパスワードを任意の値に設定します。
version: '3'
services:
postgres:
image: postgres:14
ports:
- '127.0.0.1:4432:5432'
command:
[
"postgres",
"-cshared_preload_libraries=pg_stat_statements"
]
environment:
POSTGRES_USER: pontusx_admin
POSTGRES_PASSWORD: "${PASSWORD}"
POSTGRES_DB: pontusx
PGDATA: "/var/lib/postgresql/data"
volumes:
- ./data/postgres:/var/lib/postgresql/data
- ./postgresql.conf:/etc/postgresql/postgresql.confpostgresql.conf を作成します。
# PostgreSQL のカスタム設定
logging_collector = on
log_statement = 'all'
log_connections = on
log_directory = '/var/log/postgresql/'Oasis Gateway の設定ファイル /node/web3_gateway/gateway.yaml を作成します。
# 下の runtime_id のコメントを外してください。
runtime_id: 00000000000000000000000000000000000000000000000004a6f9071c007069
# Oasis ノードのデータディレクトリ直下にある internal.sock へのパス。
node_address: "unix:/node/data/internal.sock"
# 既定ではブロックチェーンの全履歴をインデックスします。
# ディスク容量が逼迫している場合や、ゲートウェイをトランザクション送信専用に使う場合は、
# 以下の pruning を有効にしてください。
enable_pruning: false
pruning_step: 100000
indexing_start: 0
log:
level: debug
format: json
database:
# PostgreSQL を別の場所で動かしている場合は、host と port を変更してください。
host: "127.0.0.1"
port: 4432
# データベース名、ユーザー名、パスワードを記入してください。
db: pontusx
user: pontusx_admin
password: "${PASSWORD}"
dial_timeout: 15
read_timeout: 30
write_timeout: 15
max_open_conns: 0
gateway:
chain_id: 32457
http:
# 外部から Web3 にアクセスさせる場合は、host を外部 IP アドレスに変更してください。
host: "0.0.0.0"
# 複数の Web3 ゲートウェイをローカルで動かす場合は、インスタンスごとに別のポートを使ってください。
port: 8545
cors: ["*"]
ws:
# 外部から Web3 にアクセスさせる場合は、host を外部 IP アドレスに変更してください。
host: "0.0.0.0"
# 複数の Web3 ゲートウェイをローカルで動かす場合は、インスタンスごとに別のポートを使ってください。
port: 8546
origins: ["*"]
method_limits:
get_logs_max_rounds: 300Oasis Gateway のサービス化
サービスファイル /etc/systemd/system/oasis-gateway.service を作成し、次の内容を記述します。
[Unit]
Description=Oasis Gateway
After=network.target
[Service]
Type=simple
User=oasis
WorkingDirectory=/node
ExecStart=/node/web3_gateway/oasis-web3-gateway --config /node/web3_gateway/gateway.yml
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.target