通过编译源代码部署Iron Fish节点挖矿

in hive-180932 •  3 years ago  (edited)

之前写了一篇用docker部署Iron Fish的文章:部署Iron Fish测试网节点

跑了一阵子,发现docker性能不行,而且老卡在某个区块同步不了。又不能修改源代码,所以决定直接通过编译源代码来部署节点

部署后,发现挖矿效率高了10倍!下面介绍一下怎么在Ubuntu上编译源代码并开启Iron Fish挖矿

image.png

安装必要的环境

sudo apt-get update -y && sudo apt-get upgrade -y;
sudo apt-get install build-essential -y;

安装/升级nodejs v16.x.x

查看系统node版本
node -v
如果命令出错,安装nodejs:

sudo apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install -y nodejs

如果版本不是v16.x.x, 安装v16.x.x版本:

npm install -g n
sudo n v16.2.0

安装Rust

curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

安装yarn

sudo apt install npm
npm install --global yarn

下载官方源代码

cd /root
git clone https://github.com/iron-fish/ironfish.git
chown -R root ironfish

修改源代码

源代码里面一次同步的块数是20,但是同步到16000多块的时候,会卡住不动,所以修改一下源代码,把同步的块数改成2(试过5,还是卡住)

运行下面命令修改

sed -i 's%const REQUEST_BLOCKS_PER_MESSAGE.*%const REQUEST_BLOCKS_PER_MESSAGE = 2%' /root/ironfish/ironfish/src/syncer.ts

编译源码

cd /root/ironfish
yarn install 
yarn build
    
cd /root/ironfish/ironfish-cli/
yarn build

启动节点(初次启动要同步数据比较慢)

cd /root/ironfish/ironfish-cli/
nohup yarn ironfish start >nohup.log &

配置Graffiti

yarn ironfish config:set blockGraffiti "xxxx"

开启挖矿

cd /root/ironfish/ironfish-cli/
nohup yarn ironfish miners:start -t -1 >mine.log &

查看节点状态

yarn ironfish status -f

查看挖矿速率

tail -f mine.log

查看余额

yarn ironfish accounts:balance

注册并查看测试网积分
网站:https://testnet.ironfish.network/leaderboard

点击"Sign Up"

image.png

输入邮箱,Graffiti(上面设置的Graffiti名), Discord ID 和国家

image.png

注册成功后,你就可以在leaderboard上查看你的挖矿成果了

image.png

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

牛皮!!shop

[WhereIn Android] (http://www.wherein.io)

  ·  3 years ago 

你好鸭,村长!

@fanlisuper2021给您叫了一份外卖!

咖啡

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~

  ·  3 years ago 

like

  ·  3 years ago 

高、精、尖👍👍👍 !shop
like

[WhereIn Android] (http://www.wherein.io)

  ·  3 years ago 

你好鸭,村长!

@adyiron给您叫了一份外卖!

加拿大人民早餐伴侣

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~

  ·  3 years ago 

👍👍👍!shop拍拍

  ·  3 years ago 

你好鸭,村长!

@haoeeicc给您叫了一份外卖!

水果月饼

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~

教教我😍

[WhereIn Android] (http://www.wherein.io)