部署ImageCoin主节点
source link: https://hypersharp.net/ops/106-deploy-img-masternode/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
最近帮朋友部署一种区块链技术的数字 ImageCoin (IMG图像币) 和 ImageCash (IMGC 图像现金)。两种货币同出一源,操作基本类似,下面我先介绍下ImageCoin的部署步骤。
服务器端操作
服务器环境
我使用的服务器是阿里云ECS Ubuntu系统,首先需要先修复Python配置:
#!/bin/bash cat << EOF > /root/.pip/pip.conf ## Note, this file is written by cloud-init on first boot of an instance ## modifications made here will not survive a re-bundle. ### [global] #index-url=http://mirrors.cloud.aliyuncs.com/pypi/simple/ index-url=https://pypi.org/simple/ [install] #trusted-host=mirrors.cloud.aliyuncs.com trusted-host=pypi.org EOF cat << EOF > /root/.pydistutils.cfg ## Note, this file is written by cloud-init on first boot of an instance ## modifications made here will not survive a re-bundle. ### [easy_install] #index-url=http://mirrors.cloud.aliyuncs.com/pypi/simple/ index-url=https://pypi.org/simple/ EOF
然后安装一些依赖软件库:
apt-get update && \ apt-get install -y software-properties-common && \ add-apt-repository ppa:bitcoin/bitcoin && apt-get update && \ apt-get install -y wget curl binutils && \ apt-get install -y build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils && \ apt-get install -y libboost-all-dev && \ apt-get install -y libdb4.8-dev libdb4.8++-dev && \ apt-get install -y libminiupnpc-dev libzmq3-dev && \ apt-get install -y python-virtualenv
安装主节点服务器端
首先需要下载安装脚本,我们可以从官方库中获取,然后执行这个安装脚本:
wget https://raw.githubusercontent.com/mceme/ImageCoin/master/imginstall/img-install.sh ./img-install.sh
按脚本内的提示安装后,可以从屏幕上获取到MASTERNODE PRIVATEKEY
这个值。
修改 /root/.imagecoincore/imagecoin.conf
配置文件,插入以下文本:
rpcport=6999 checkblocks=6 checklevel=2 addnode=23.101.61.34:6998 addnode=51.77.144.203:6998 addnode=5.189.162.110:6998 addnode=94.16.122.165:6998 addnode=79.135.200.25:6998 addnode=54.38.158.185:6998 addnode=37.187.127.238:6998
安装Sentinel
Sentinel是一个必备的节点监控程序,若不安装这个程序,节点状态就会变成 WATCHDOG_EXPIRED
。我们可以执行以下脚本可以安装Sentinel:
#!/bin/bash wget https://github.com/dashpay/sentinel/archive/v1.3.0.tar.gz tar -xzf v1.3.0.tar.gz rm -f v1.3.0.tar.gz mv "sentinel-v1.3.0" /root/.imagecoincore/sentinel cd /root/.imagecoincore/sentinel virtualenv ./venv && ./venv/bin/pip install -r requirements.txt cat << EOF > /root/.imagecoincore/sentinel/sentinel.conf dash_conf=/root/.imagecoincore/imagecoin.conf network=mainnet db_name=database/sentinel.db db_driver=sqlite EOF cat << EOF > /etc/cron.d/sentinel * * * * * root cd /root/.imagecoincore/sentinel && ./venv/bin/python bin/sentinel.py >/dev/null 2>&1 EOF
客户端操作
- 10000 个 ImageCoin
- 主节点名称(Alias),例如:
img_mn1
- 主节点地址(Address),例如:
127.0.0.1:6998
- 主节点密钥(Privkey),例如:
eH1gXBGLALQZE93HY4sK1Yc137tGBD64xiqaYBVUCYjEMeQL8Xg
- 打开ImageCoin钱包
- 进入接受标签页,创建一个新的收款地址:
- 标签框填写主节点名称
- 总额框填写10000
- 点击请求付款按钮
- 进入发送标签页,根据上面创建的收款地址发送10000个ImageCoin,等待确认数量超过15个以后继续下面操作。
- 点击菜单工具->Debug控制台, 输入命令
masternode outputs
,回车运行后会出现类似于下面这样的内容:
{ "00b51e42ff291e10b7ae39d8a9ace069ef3db301dfa8a32155abcd45704264e3": "1" }
我们把每一行按冒号分开,前面引号内的大段数据叫做交易哈希(TxHash),后面引号内的数字叫做输出索引(Output index)
- 点击菜单工具->Open Masternode Configuration File,在打开的文本文件中添加一行文本,格式如下
节点名称 节点地址 节点密钥 交易哈希 输出索引
按上面的格式,每个数据中间用一个空格隔开,例如:
img_mn1 127.0.0.1:6998 eH1gXBGLALQZE93HY4sK1Yc137tGBD64xiqaYBVUCYjEMeQL8Xg 00b51e42ff291e10b7ae39d8a9ace069ef3db301dfa8a32155abcd45704264e3 1
保存并关闭文件
- 确保解锁你的钱包(在菜单设置->解锁钱包)
- 进入Masternodes标签页,如果看不到这个标签页,需要在菜单设置->选项,打开窗口中启用钱包->Show Masternodes Tab选项。
- 点击Update status按钮,如果在My Masternodes标签页中没有发现新加的节点,请重启钱包。
- 点击菜单工具->Debug控制台, 输入命令
masternode start-alias "img_mn1"
,这边的img_mn1需要替换为你自己的主节点名称。 - 进入Masternodes标签页,点击Update status按钮,查看节点的Status是否是ENABLED
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK