安装 Docker 和 docker-compose(Install Docker and docker-compose)
# Install Docker
sudo wget -O get-docker.sh https://get.docker.com
sudo sh get-docker.sh
rm -f get-docker.sh
# Install docker-compose
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
sudo chmod +x /usr/local/bin/docker-compose
sudo docker -v
sudo docker-compose -v
sudo mkdir -p ~/sui-node/devnet && cd ~/sui-node/devnet
下载编排文件及 genesis(Download files)
sudo wget -O fullnode-template.yaml https://github.com/MystenLabs/sui/raw/main/crates/sui-config/data/fullnode-template.yaml
sudo wget -O genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob
sudo wget -O docker-compose.yaml https://raw.githubusercontent.com/MystenLabs/sui/main/docker/fullnode/docker-compose.yaml
sudo sed -i 's/127.0.0.1:9184/0.0.0.0:9184/' fullnode-template.yaml
sudo sed -i 's/127.0.0.1:9000/0.0.0.0:9000/' fullnode-template.yaml
sudo docker-compose pull
sudo docker-compose up -d
如果您的节点端口不通,请关闭服务器防火墙,并在云服务器提供商的安全策略中放行如下端口:
全节点:
9000:full node REST API 端口;
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] }'
# 进入之前创建的 sui-node 目录,之后的操作都会在该目录下进行
cd ~/sui-node/devnet
# 关闭节点并删除数据卷
sudo docker-compose down -v
# 下载 创世节点文件
sudo wget -O ./genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob
sudo docker-compose up -d