Alaya节点部署及mtool配置-简化版

云主机选择:
国外:AWS、阿里国际
国内:七牛、华为、百度、阿里国际
配置:推荐4c8GB,至少2c8GB,系统盘40G,数据盘50G(建议挂载到/opt,可在线扩容),网络按流量计费

基础知识自行百度:
sudo配置
磁盘挂载
磁盘在线扩容

ntp安装:
sudo apt-get update && sudo apt-get install -y gnupg2 curl software-properties-common ntp && sudo systemctl enable ntp && sudo systemctl start ntp

检查:
ntpq -4c rv | grep leap_none
返回类似:
associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync,

节点安装:>>>>>>>>>>>>>>>>>>>
数据盘挂载到/opt,配置用户有/opt写权限
cd /opt && wget http://download.alaya.network/alaya/platon/0.13.2/platon-ubuntu-amd64-Alaya_0.13.2.tar.gz
tar -xvf platon-ubuntu-amd64-Alaya_0.13.2.tar.gz && mv platon-ubuntu-amd64-Alaya_0.13.2 platon-node && cd platon-node && mkdir data
检查:
./platon version
创建软连接:
sudo ln -s /opt/platon-node/platon /usr/bin/platon && sudo ln -s /opt/platon-node/keytool /usr/bin/keytool
生成节点keys,/opt/platon-node/目录下执行:
keytool genkeypair | tee >(grep “PrivateKey” | awk ‘{print $2}’ > ./data/nodekey) >(grep “PublicKey” | awk ‘{print $3}’ > ./data/nodeid)
keytool genblskeypair | tee >(grep “PrivateKey” | awk ‘{print $2}’ > ./data/blskey) >(grep “PublicKey” | awk ‘{print $3}’ > ./data/blspub)
nohup platon --identity platon --datadir ./data --port 16789 --alaya --rpcport 6789 --rpcapi “db,platon,net,web3,admin,personal” --rpc --nodekey ./data/nodekey --cbft.blskey ./data/blskey --verbosity 3 --rpcaddr 127.0.0.1 --syncmode “fast” > platon.log 2>&1 &
检查:
platon attach http://127.0.0.1:6789 -exec “platon.blockNumber”

Mtool>>>>>>>>>>>>>>>>>>> /opt/platon-node目录下执行
wget http://download.alaya.network/alaya/mtool/linux/0.13.2/mtool-client.zip
(if ! command -v unzip;then sudo apt install unzip; fi;) && unzip mtool-client.zip && cd mtool-client
wget http://download.alaya.network/opensource/scripts/mtool_install.sh
chmod +x mtool_install.sh && ./mtool_install.sh
source ~/.bashrc #使环境变量生效,必须执行!

mtool-client account new staking
mtool-client account new reward
增加一个脚本config.sh
#!/usr/bin/env bash
node_dir=/opt/platon-node
rate=$1
nodename=$2
details=$3
nodeid=$(cat $node_dir/data/nodeid)
blsPubKey=$(cat $node_dir/data/blspub)
rewardWalletAddress=$(cat $node_dir/mtool-client/keystore/reward.json|cut -c 24-65)
cat>$node_dir/mtool-client/validator/validator_config.json<<EOF
{
“delegatedRewardRate”: “${rate}”,
“nodePublicKey”: “${nodeid}”,
“blsPubKey”: “${blsPubKey}”,
“benefitAddress”: “${rewardWalletAddress}”,
“nodeAddress”: “http://127.0.0.1”,
“nodePort”: “16789”,
“nodeRpcPort”: “6789”,
“nodeName”: “${nodename}”,
“details”: “${details}”,
“externalId”: “MyKeyBaseId”,
“webSite”: “http://www.mycompany.com
}
EOF
if [ 0 -ne $? ]; then
echo -e “\033[;31mgenerate validator_config.json failed!!! \033[0m”
exit 1
fi

上述内容写入config.sh,执行chmod +x config.sh
生成配置文件,后面3个参数自己决定:
./config.sh rate nodename details

检查
mtool-client account balance staking.json --config $MTOOLDIR/validator/validator_config.json

常用命令:
fast模式下查询块高同步情况:
for i in {1…10}; do platon attach http://127.0.0.1:6789 -exec platon.syncing|grep curr; done
查看邻居:
platon attach http://127.0.0.1:6789 -exec admin.peers
查看块高:
platon attach http://127.0.0.1:6789 -exec platon.blockNumber
查看节点信息:
platon attach http://127.0.0.1:6789 -exec admin.nodeInfo

欢迎拍砖,一起alaya!

可以用云服务器啊?

有朋友反映脚本用不了,貌似双引号被论坛自动替换成中文的了,大家要用脚本的话,批量替换下吧。

good :thinking:

不会操作呀!手机版本需要更新吗?