文章閱讀頁通欄

亦來云DPoS節點搭建指南

來源: 亦來云Elastos 作者:亦來云
6月3日,亦來云區塊鏈開發者團隊對主網節點進行了升級,目前亦來云主網具備了全面面向社區節點開放的條件。同時,此次主網升級也標志著亦來云主網......
6月3日,亦來云區塊鏈開發者團隊對主網節點進行了升級,目前亦來云主網具備了全面面向社區節點開放的條件。同時,此次主網升級也標志著亦來云主網AuxPOW和DPoS兩大混合共識正式向社區全面開放。

升級后,參與DPoS節點競選的節點可以在北京時間6月3日——6月15日內正式搭建DPoS節點。期間, 亦來云區塊鏈團隊和中英文社區團隊將為大家提供相關節點服務支持。
 
今天,對之前發布的DPoS節點搭建指南做了細節優化,大家在搭建節點時可進行參考。

* 注:本文檔主要用于亦來云DPoS節點的搭建。

DPoS節點組成:

1. ela主鏈節點
2. did側鏈節點
3. token側鏈節點
4. carrier節點

環境要求:

?  系統: Ubuntu 16.04 LTS 64-bit
?  CPU: 2核或2核以上
?  內存: 不小于4GB
?  硬盤: 不少于40GB
?  網絡: aws標準網絡,具有可訪問的公網IP或域名
? 防火墻需要將ELAPort[TCP:20338、20339]和CarrierPort[UDP:3478、33445,TCP:33445]端口設置為全網開放
?  系統權限: 具有sudo權限

搭建節點:

1. 搭建ela主鏈節點

1.1 下載節點程序及默認配置文件

?  ela
(https://github.com/elastos/Elastos.ELA/releases/download/v0.3.2/ela)

?  ela-cli
(https://github.com/elastos/Elastos.ELA/releases/download/v0.3.2/ela-cli)

?  dpos_config.json.sample  
(https://raw.githubusercontent.com/elastos/Elastos.ELA/master/docs/dpos_config.json.sample)

1.2 將節點及配置文件拷貝至ela節點運行目錄

?  創建節點運行目錄,建議節點目錄: ~/node/ela/
?  將ela節點程序、dpos_config.json.sample拷貝至ela節點目錄,并將dpos_config.json.sample重命名為config.json

1.3 創建你的keystore.dat文件

1.3.1  將ela-cli拷貝至ela節點目錄
1.3.2  創建節點公鑰keystore.dat文件

keystore.dat文件存儲節點公鑰,dpos超級節點使用該文件完成節點通信等業務。

創建keystore.dat文件的命令如下。該密碼為該keystore.dat文件的加密密碼,需要添加至ela節點啟動命令中,建議設置具有一定加密強度的密碼。

# 執行命令后,將提示輸入密碼
./ela-cli wallet create
# 以明文的形式輸入密碼elastos
./ela-cli wallet create -p elastos

1.3.3  查看節點公鑰

查看keystore.dat文件對應的公鑰,該公鑰為節點公鑰,需要將該公鑰提供給候選人。候選人需要將該公鑰填入“報名參選”頁面;已注冊候選人需要在“選舉管理”的“更新信息”頁面填入該公鑰,并更新信息。點擊更新信息后需要再次輸入支付密碼,以保證更新的信息被提交并記錄在區塊鏈上。

# 執行命令后,將提示輸入密碼
./ela-cli wallet account
# 以明文的形式輸入密碼elastos
./ela-cli wallet account -p elastos

1.4 修改ela配置文件config.json

? 將"IPAddress"修改為服務器公網IP或域名
? "RpcConfiguration"為對RPC接口的訪問限制
–  "WhiteIPList"為允許訪問本ela節點的IP白名單,"0.0.0.0"表示不限制訪問IP
–   "User"與"Pass"為訪問RPC接口的用戶名及密碼,如設置為"",則無需用戶名密碼即可訪問
–   "WhiteIPList"與"User"、"Pass"必須同時滿足,才能訪問RPC接口
–   RPC接口具有一定的控制權限,請妥善設置RPC接口訪問權限

1.5 運行ela節點

1.5.1  啟動ela節點

ela節點啟動命令中需要輸入keystore.dat文件的密碼,可以將該密碼添加至ela節點啟動命令:

# 啟動命令,本示例中keystore.dat密碼為elastos
echo elastos | nohup ./ela > /dev/null 2>output &

1.5.2  查詢節點信息 

節點啟動后,可以用ela-cli查看節點高度、版本等信息

# 未設置User及Pass
./ela-cli info getnodestate
# 設置User及Pass,并修改RpcPort為30336(默認RPC端口為20336)
./ela-cli --rpcport 30336 --rpcuser User --rpcpassword PASS info getnodestate

節點返回結果如下:

{
    "compile":"v0.3.2",
    "height":230913,
    "neighbors":[
        {
    "conntime":"2019-04-25 09:59:04.559138458 +0000 UTC m=+184952.601678086",
    "inbound":false,
    "lastblock":230913,
    "lastpingmicros":11290,
    "lastpingtime":"2019-04-26 06:36:34.571244957 +0000 UTC m=+259202.613784567",
    "lastrecv":"2019-04-26 06:36:34 +0000 UTC",
    "lastsend":"2019-04-26 06:36:34 +0000 UTC",
    "netaddress":"18.208.17.78:22338",
    "relaytx":false,
    "services":"SFNodeNetwork|SFTxFiltering|SFNodeBloom",
    "startingheight":230913,
    "timeoffset":0,
    "version":20000
        },
        {
    "conntime":"2019-04-26 00:08:13.830248318 +0000 UTC m=+235901.872787897",
    "inbound":false,
    "lastblock":230913,
    "lastpingmicros":11295,
    "lastpingtime":"2019-04-26 06:36:43.842142254 +0000 UTC m=+259211.884681888",
    "lastrecv":"2019-04-26 06:36:43 +0000 UTC",
    "lastsend":"2019-04-26 06:36:43 +0000 UTC",
    "netaddress":"34.225.140.100:22338",
    "relaytx":false,
    "services":"SFNodeNetwork|SFTxFiltering|SFNodeBloom",
    "startingheight":230913,
    "timeoffset":0,
    "version":20000
        }
    ],
    "port":22338,
    "restport":0,
    "rpcport":22336,
     "services":"SFNodeNetwork|SFTxFiltering|SFNodeBloom",
    "version":20000,
    "wsport":0
}

其他查詢命令可以查看ela-cli使用文檔:
CN :
https://github.com/elastos/Elastos.ELA/blob/master/docs/cli_user_guide_CN.md
EN:
https://github.com/elastos/Elastos.ELA/blob/master/docs/cli_user_guide.md

1.5.3  log分析

ela節點的log記錄與elastos/logs/目錄下,其中node目錄中為節點同步信息相關log,dpos目錄為dpos共識相關log

如果為當選節點,可以看到類似如下log:

2019/05/31 02:44:11.460839 [INF] GID 400, [OnBlockReceived] listener received block
2019/05/31 02:44:11.460875 [INF] GID 32, [OnBlockReceived] start
2019/05/31 02:44:11.460903 [INF] GID 32, [ProcessHigherBlock] broadcast inv and try start new consensus
2019/05/31 02:44:11.460946 [INF] GID 32, [BroadcastMessage] msg: inv
2019/05/31 02:44:11.460999 [INF] GID 32, [Normal][OnBlockReceived] received first unsigned block, start consensus
2019/05/31 02:44:11.461030 [INF] GID 32, [StartConsensus] consensus start
2019/05/31 02:44:11.461096 [INF] GID 32, [OnViewStarted] OnDutyArbitrator: 03488b0aace5fe5ee5a1564555819074b96cee1db5e7be1d74625240ef82ddd295, StartTime: 2019-05-31 02:44:11.451 +0000 UTC, Offset: 0, Height: 234655
2019/05/31 02:44:11.461130 [INF] GID 32, [StartConsensus] consensus end
2019/05/31 02:44:11.461196 [INF] GID 32, [OnBlockReceived] end
2019/05/31 02:44:11.815189 [INF] GID 32, [OnProposalReceived] started
2019/05/31 02:44:11.815229 [INF] GID 32, [Normal][ProcessProposal] start
2019/05/31 02:44:11.815270 [INF] GID 32, [ProcessProposal] start
2019/05/31 02:44:11.815611 [INF] GID 32, [TryStartSpeculatingProposal] start
2019/05/31 02:44:11.815655 [INF] GID 32, [TryStartSpeculatingProposal] end
2019/05/31 02:44:11.815702 [INF] GID 32, [acceptProposal] start
2019/05/31 02:44:11.815750 [INF] GID 32, [ProcessVote] start
2019/05/31 02:44:11.816032 [INF] GID 32, [countAcceptedVote] start
2019/05/31 02:44:11.816084 [INF] GID 32, [countAcceptedVote] Received needed sign, collect it into AcceptVotes!
2019/05/31 02:44:11.816160 [INF] GID 32, [countAcceptedVote] end
2019/05/31 02:44:11.816206 [INF] GID 32, [ProcessVote] end

22019/05/31 02:44:11.865495 [INF] GID 32, [OnVoteReceived] started
2019/05/31 02:44:11.865530 [INF] GID 32, [Normal-ProcessAcceptVote] start
2019/05/31 02:44:11.865568 [INF] GID 32, [ProcessVote] start
2019/05/31 02:44:11.865908 [INF] GID 32, [countAcceptedVote] start
2019/05/31 02:44:11.865955 [INF] GID 32, [countAcceptedVote] Received needed sign, collect it into AcceptVotes!
2019/05/31 02:44:11.865997 [INF] GID 32, Collect majority signs, finish proposal.
2019/05/31 02:44:11.866039 [INF] GID 32, [FinishProposal] start
2019/05/31 02:44:11.866097 [INF] GID 32, [AppendConfirm] append confirm.
2019/05/31 02:44:11.866202 [INF] GID 32, [FinishConsensus] start
2019/05/31 02:44:11.866242 [INF] GID 32, [onDutyArbitratorChanged] not onduty
2019/05/31 02:44:11.866324 [INF] GID 32, Clean proposals
2019/05/31 02:44:11.866363 [INF] GID 32, [FinishConsensus] end
2019/05/31 02:44:11.866398 [INF] GID 32, [FinishProposal] end
2019/05/31 02:44:11.866430 [INF] GID 32, [countAcceptedVote] end
2019/05/31 02:44:11.866460 [INF] GID 32, [ProcessVote] end
2019/05/31 02:44:11.866488 [INF] GID 32, [Normal-ProcessAcceptVote] end

2. 搭建did側鏈節點

2.1 下載節點程序及默認配置文件

?  did
(https://github.com/elastos/Elastos.ELA.SideChain.ID/releases/download/v0.1.2/did)

?  mainnet_config.json.sample
(https://raw.githubusercontent.com/elastos/Elastos.ELA.SideChain.ID/master/docs/mainnet_config.json.sample)

2.2 將節點及配置文件拷貝至did側鏈節點運行目錄

?  創建節點運行目錄,建議節點路徑: ~/node/did/
?將did節點程序、mainnet_config.json.sample拷貝至did側鏈節點目錄,并將mainnet_config.json.sample重命名為config.json

2.2.1 修改配置文件

?根據運維需要,修改RpcConfiguration中的"WhiteIPList"、"User"及"Pass",訪問規則與ela的RPC訪問限制一致

2.3 運行did側鏈節點

2.3.1  啟動did節點 

# 啟動命令
nohup ./did > /dev/null 2>output &

2.3.2  查看did節點狀態

# 通過RPC接口查看節點狀態,需根據配置情況修改Authorization
curl -X POST \
  http://localhost:20606 \
  -H 'Authorization: Basic ZWxhOmVsYQ==' \
  -H 'Content-Type: application/json' \
  -d '{"method":"getnodestate"}'

其他RPC接口請查閱DID-RPC文檔:
(https://github.com/elastos/Elastos.ELA.SideChain.ID/blob/master/docs/jsonrpc_apis.md)

3.  搭建token側鏈節點

3.1 下載節點程序及默認配置文件

?  token
(https://github.com/elastos/Elastos.ELA.SideChain.Token/releases/download/v0.1.2/token)

?  mainnet_config.json.sample
(https://raw.githubusercontent.com/elastos/Elastos.ELA.SideChain.Token/master/docs/mainnet_config.json.sample)

3.2 將節點及配置文件拷貝至token側鏈節點運行目錄

?  創建節點運行目錄,建議節點路徑: ~/node/token/
? 將token節點程序、mainnet_config.json.sample拷貝至token側鏈節點目錄,并將mainnet_config.json.sample重命名為config.json

3.2.1 修改配置文件

? 根據運維需要,修改RpcConfiguration中的"WhiteIPList"、"User"及"Pass",訪問規則與ela的RPC訪問限制一致

3.3 運行token側鏈節點

3.3.1  啟動token節點 

# 啟動命令
nohup ./token > /dev/null 2>output &

3.3.2  查看token節點狀態

# 通過RPC接口查看節點狀態,需根據配置情況修改Authorization
curl -X POST \
  http://localhost:20616 \
  -H 'Authorization: Basic ZWxhOmVsYQ==' \
  -H 'Content-Type: application/json' \
  -d '{"method":"getnodestate"}'

其他RPC接口請查閱TOKEN-RPC文檔:
(https://github.com/elastos/Elastos.ELA.SideChain.Token/blob/master/docs/jsonrpc_apis.md)

4. 搭建carrier節點

4.1 下載節點安裝包

?  carrier
(https://github.com/elastos/Elastos.NET.Carrier.Bootstrap/releases/download/release-v5.2.3/elastos-carrier-bootstrap-5.2.623351-linux-x86_64-Debug.deb)

4.2 將節點安裝包拷貝至carrier節點運行目錄

?  創建節點運行目錄,建議節點路徑: ~/node/carrier/
?  將carrier節點安裝包拷貝至carrier節點目錄

4.3 運行carrier節點

4.3.1 啟動carrier節點

$ sudo dpkg -i /path/to/elastos-carrier-bootstrap-5.2.623351-linux-x86_64-Debug.deb

4.3.2 查看carrier節點狀態

$ sudo systemctl status ela-bootstrapd

如果carrier節點正常運行, 會有如下打印:
 
active (running).

4.3.3 配置文件

配置文件: /etc/elastos/bootstrapd.conf
如果服務器無法獲取到公網IP,則需要手動修改配置文件,將external_ip設置為真實的公網IP

turn = {
port = 3478
realm = "elastos.org"
pid_file_path = "/var/run/ela-bootstrapd/turnserver.pid"
userdb = "/var/lib/ela-bootstrapd/db/turndb"
verbose = true
external_ip = "X.X.X.X"
}
 
修改配置文件后,需要重啟服務

$ sudo systemctl restart ela-bootstrapd

systemctl使用說明:
(https://www.freedesktop.org/software/systemd/man/systemctl.html)

以上是搭建亦來云DPoS節點的環境要求與搭建流程。參選節點如在搭建過程中遇到問題,可向亦來云區塊鏈團隊和中英文社區團隊咨詢。同時,近期也會舉行針對節點搭建相關問題的亦來Talk專題分享,參選節點可及時關注社區動態,了解節點搭建詳情。
關鍵詞: 亦來云  DPoS  節點  
0/300
? 小霸王曾道人