指导文档
1、获取最新BSC镜像
镜像地址
2、下载BSC节点配置
通过以下方式下载genesis.json和config.toml
主网:
wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
unzip mainnet.zip
测试网
wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
unzip testnet.zip
3、编写docker-compose yaml文件
version: '3'
services:
bsc:
image: ghcr.io/bnb-chain/bsc:1.2.8
container_name: bsc
command: --http.addr 0.0.0.0 --http.port 8545 --http.vhosts '*' --verbosity 5
ports:
- 8000:8545
volumes:
- ./config:/bsc/config
- ./data/:/bsc/node
restart: always
注:
Docker 变量和配置文件位置
需要注意的重要环境变量:
$BSC_HOME = /bsc
$DATA_DIR = /data
文件位置:
BSC_CONFIG=${BSC_HOME}/config/config.toml
BSC_GENESIS=${BSC_HOME}/config/genesis.json
4、启动节点
root@iZj6c9oahptfht9r6j85e3Z:/data/docker-compose/bsc# docker-compose up -d
Pulling bsc (ghcr.io/bnb-chain/bsc:1.2.8)...
1.2.8: Pulling from bnb-chain/bsc
4db1b89c0bd1: Pull complete
a34266e32dee: Pull complete
4999da8f4ad8: Pull complete
f26222169b59: Pull complete
e43db73d308e: Pull complete
0b2cfd4e54fd: Pull complete
66a3300a431a: Pull complete
Digest: sha256:3ce9d32c405ec630a46455f56fd31dcb36d191827aecc145303935918bc4bd5d