Skip to content
dappstore123 edited this page Aug 26, 2019 · 15 revisions

安装 ipos 第一阶段 主网

1.安装go语言开发环境

https://dl.google.com/go/go1.12.linux-amd64.tar.gz

sudo tar -zxvf ~/go1.12.linux-amd64.tar.gz -C /usr/local/

vim /etc/profile

export GOROOT=/usr/local/go

export PATH=$PATH:$GOROOT/bin

export GOPATH=$HOME/gopath

source /etc/profile

go version

2.下载 代码。

git clone https://github.com/IPOSIO/main-net.git

3.编译

进入到代码目录。cd main-net/

make all

4.准备运行

4.1新建工作目录,

如 ~/ipos-net

进入目录

4.2 生成节点key

/root/main-net/build/bin/bootnode --genkey=boot.key

4.3 启动

/root/main-net/build/bin/ipos --rpc --rpccorsdomain "*" --rpcaddr 127.0.0.1 --rpcapi "eth,web3" --datadir node0 --port 30303 --nodekey=boot.key console

5. 挖矿

设置挖矿账号

miner.setEtherbase("0x123456793663953103cf70235fe37b9893a4db6f")

开启一个线程挖矿

miner.start(1)

查看余额

web3.fromWei(web3.eth.getBalance("0x123456793663953103cf70235fe37b9893a4db6f"),"ether")

停止挖矿

miner.stop()

5.1 直接启用挖矿

/root/main-net/build/bin/ipos --rpc --rpccorsdomain "*" --rpcaddr 127.0.0.1    --rpcapi "eth,web3" --datadir node0 --port 30303  --nodekey=boot.key  --etherbase 0x123456793663953103cf70235fe37b9893a4db6f --mine --minerthreads 4 -targetgaslimit 80000000
矿工请设置 -targetgaslimit 80000000 ,增大块的计算能力。

0x123456793663953103cf70235fe37b9893a4db6f 一定要换成自己的地址。

5.2 使用gpu挖矿

下载 程序 https://github.com/ethereum-mining/ethminer/releases

解压后 用命令执行

ethminer -G -P http://127.0.0.1:8545

http://127.0.0.1:8545 是ipos 的rpc端口。

--rpcapi "eth,miner,web3" geth启动 要 miner 并且开启挖矿任务。

可以用http请求开启和关闭

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"miner_start","params":[],"id":74}' http://127.0.0.1:8545

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"miner_stop","params":[],"id":74}' http://127.0.0.1:8545

注意事项

防火墙 要打开30303 端口。 如果你是公网ip。

其他常用命令

管理 查看节点信息

admin.nodeInfo.enode

添加节点

admin.addPeer("enode://2c80d09b7cdbfc961448117d374b0c2a3848c06e9acd5e486b9bc2e95cc3e5772d2433bb015a4eb42f047e7f852c159921fbed53a98a86695ddd5537ea555fe1@47.91.236.121:30303")

admin.addPeer("enode://b369d7d63c7f547220c508038957e69c38a19aa15cd3b925125cdf1047458176a9ef60ebf99ec11a9de9e82734e2b4ec8d745a79d92c162b6f5e25a687fd6a1f@124.156.106.248:30303")

admin.addPeer("enode://8dd910d2f3415823986d15aa88088913248a67dec64a80c2970d241ee7c9586bd6fd066e42f824c223ea0059b0ed69b01c19afd30dcca4d8ce80c5d7924a015f@94.237.73.73:30303")

admin.addPeer("enode://a8ab6392eaa1749a3e1435ac1c87bd58494541281001c8fa4f64a52fedfd66ff0c5ece29544cd58dca48a321551dfb4cb6af3e3c42b50865277456319df0a966@35.196.48.21:30303")

admin.nodeInfo

创建地址

personal.newAccount()

查看块高

eth.blockNumber

查看挖矿收益地址

eth.coinbase

查看交易池子 txpool.content

查看本节点信息 admin.peers

查看节点连接数 net.peerCount