三种方式
1. 使用快照
快照链接
# 1. build exchaind 使用release最新版本
git clone -b latest_version https://github.com/okex/exchain.git # latest_version可以通过链接 https://github.com/okex/exchain/releases/latest 查看
cd exchain
make mainnet # 编译主网,默认是leveldb
make mainnet WITH_ROCKSDB=true # 编译主网,如果想启动rocksdb
注1:务必用 make mainnet 编译
注2:latest_version可以通过链接 https://github.com/okex/exchain/releases/latest 查看
注3:如果在编译rocksdb过程中遇到问题,请参考该链接
# 2. Initialize exchain node configurations
export EXCHAIND_PATH=~/.exchaind (或者其他目录)
exchaind init your_custom_moniker --chain-id exchain-66 --home ${EXCHAIND_PATH}
# 3. download snapshot
rm -rf ${EXCHAIND_PATH}/data
cd ${EXCHAIND_PATH}
wget https://ok-public-hk.oss-cn-hongkong.aliyuncs.com/cdn/okexchain/snapshot/okexchain-$version-$date-$height_xxx.tar.gz
tar -zxvf okexchain-$version-$date-$height_xxx.tar.gz
# 4. start exchaind
# 启动leveldb节点
exchaind start --chain-id exchain-66 --home ${EXCHAIND_PATH}
# 启动rocksdb节点
exchaind start --chain-id exchain-66 --db_backend rocksdb --home ${EXCHAIND_PATH}
2. 使用创世块文件
# 1. build exchain 使用release最新版本
git clone -b latest_version https://github.com/okex/exchain.git # latest_version可以通过链接 https://github.com/okex/exchain/releases/latest 查看
cd exchain
make mainnet # 编译主网,默认是leveldb
make mainnet WITH_ROCKSDB=true # 编译主网,如果想启动rocksdb
注1:务必用 make mainnet 编译
注2:latest_version可以通过链接 https://github.com/okex/exchain/releases/latest 查看
# 2. Initialize exchain node configurations
export EXCHAIND_PATH=~/.exchaind (或者其他目录)
exchaind init your_custom_moniker --chain-id exchain-66 --home ${EXCHAIND_PATH}
# 3. download genesis.json
wget https://raw.githubusercontent.com/okex/mainnet/main/genesis.json -O ${EXCHAIND_PATH}/config/genesis.json
# 4. start exchaind
# 启动leveldb节点
exchaind start --chain-id exchain-66 --home ${EXCHAIND_PATH}
# 启动rocksdb节点
exchaind start --chain-id exchain-66 --db_backend rocksdb --home ${EXCHAIND_PATH}
注意
如果你使用s3快照启动,务必在启动参数中加上pruning=nothing
,因为pruning的默认值是default,会裁剪数据。
另外,建议根据自己的需求配置如下参数
--max-open=10000 最大连接数,默认值1000,增加该值可以提供rpc服务能够接收的连接数。
--disable-abci-query-mutex=1 abci query中的锁开关,默认值为关闭,打开后可以提升查询性能
--fast-query=1 快速查询模式开关,默认值为关闭,打开后查询数据会额外记录到watch.db,提升查询性能
--enable-bloom-filter=1 bloom filter开关,默认值为关闭,打开可以提升eth_getLogs查询性能_
--mempool.size=10000 设置mempool大小,默认值2000,增加该值可以提高mempool中存储
tx数量。
3. 使用docker+快照启动
# 1. Initialize exchain node configurations
export EXCHAIND_PATH=~/.exchaind (或者其他目录)
exchaind init your_custom_moniker --chain-id exchain-66 --home ${EXCHAIND_PATH}
# 2. download snapshot
rm -rf ${EXCHAIND_PATH}/data
cd ${EXCHAIND_PATH}
# 该镜像使用rocksdb数据,所以要下载主网对应的rocksdb快照。
wget https://ok-public-hk.oss-cn-hongkong.aliyuncs.com/cdn/okexchain/snapshot/okexchain-$version-$date-$height_xxx.tar.gz
tar -zxvf okexchain-$version-$date-$height_xxx.tar.gz
# 3. download the docker image
docker pull okexchain/fullnode-mainnet:latest # 该镜像使用rocksdb快照数据。
# 4. run docker based the snapshot downloaded in the previous step Start based on snapshot.
docker run -d --name exchain-mainnet-fullnode -v ~/.exchaind/data:/root/.exchaind/data/ -p 8545:8545 -p 26656:26656 okexchain/fullnode-mainnet:latest