一.搭建第一條區(qū)塊鏈
也可以參考該鏈接
搭建第一個區(qū)塊鏈網(wǎng)絡(luò) — FISCO BCOS 2.0 v2.9.0 文檔
1.創(chuàng)建操作目錄, 下載安裝腳本(環(huán)境具備)
2.搭建單群組4節(jié)點聯(lián)盟鏈
bash build_chain.sh -l 127.0.0.1:4 -p 30300,20200,8545 -e ./fisco-bcos
3?啟動FISCO BCOS鏈
bash nodes/127.0.0.1/start_all.sh
4.檢查進程
ps -ef | grep fisco
5.檢查日志輸出
tail -f nodes/127.0.0.1/node0/log/log* | grep connected
二.Console部署與驗證?
1.查看進程(需要進入fisco-bcos)
ps -ef | grep fisco
2.啟動FISCO BCOS鏈
之后按照上面的命令檢查進程
bash nodes/127.0.0.1/start_all.sh
?
?3.拷貝控制臺配置文件
注意該路徑需要按照你自己配置的環(huán)境進行,可以先去fisco-bcos/nodes中輸入tree -a,查看配置文件的位置,復(fù)制到console/conf中,姑該命令在console中進行
cd console
cp ../nodes/127.0.0.1/sdk/* conf/
4.啟動sdk工具,啟動并使用控制臺
bash start.sh
5.獲取區(qū)塊高度
getBlockNumber
#退出
exit
?
三 Webase一鍵部署
可以參考一鍵部署 — WeBASE v1.5.5 文檔
1.關(guān)閉所有FISCO BCOS服務(wù)
bash nodes/127.0.0.1/stop_all.sh
關(guān)閉之后檢查
2.啟動webase
需要先cd webase-deploy
cd webase-deploy
#啟動
python3 deploy.py startAll
3.?訪問webase
?注意,需要有驗證碼,下面是解決沒有驗證碼問題
如果沒有驗證碼,檢查webase-node-mgr
修改conf/application.yml,添加如下信息
?
重新啟動webase-node-mgr并檢查
?
4.驗證
驗證webase-front,webase.node.mgr,webase.sign,節(jié)點
#webase-front
ps -ef | grep webase-front
#webase.node.mgr
ps -ef | grep webase.node.mgr
#webase.sign
ps -ef | grep webase.sign
#節(jié)點
ps -ef | grep node
四.console基礎(chǔ)操作
配置連接正在運行的FISCO BCOS區(qū)塊鏈,并啟動
?
1.準備環(huán)境
cd console
cp ~/fisco-bcos/webase-deploy/nodes/127.0.0.1/sdk/* conf/
?
2.啟動console
bash start.sh
?
?3.創(chuàng)建賬戶
newAccount
4.. 查看所有賬戶?
listAccount
5.查看區(qū)塊高度?
getBlockNumber
6.?查看共識節(jié)點列表
getSealerList
7.查詢節(jié)點ID
getNodeIDList
8.查看共識狀態(tài)
getConsensusStatus
9.查看同步狀態(tài)
getSyncStatus
10.查看節(jié)點 peers 信息
getPeers
11.?查詢當前節(jié)點版本
getNodeVersion
?
五.使用console命令部署helloworld合約
1.需要先啟動console
cd fisco-bcos
cd console
bash start.py
?2.部署 helloworld 合約
deploy HelloWorld
可以查看helloworld合約
3.調(diào)用部署的 helloworld 合約
call HelloWorld 上面部署的helloworld的合約的地址 get
call HelloWorld 上面部署的helloworld的合約的地址 set "你需要的內(nèi)容"
.通過交易號查看指定交易
getTransactionByHash 上面那個交易的hash
六.節(jié)點擴容?
1.查看webase是否開啟
cd fisco-bcos/webase-deploy
ps -ef | grep fisco
?2.下載腳本
cd nodes/127.0.0.1
curl -#LO https://gitee.com/FISCO-BCOS/FISCO-BCOS/raw/master-2.0/tools/gen_node_cert.sh
3.生成節(jié)點node2
bash gen_node_cert.sh -c ../cert/agencyA -o node2
?
4.拷貝配置文件
cp node0/config.ini node0/start.sh node0/stop.sh node2/
?5.修改 node2 配置 config.ini
vim node2/config.ini
6.拷貝 group1 配置
cp node0/conf/group.1.genesis node0/conf/group.1.ini node2/conf/
7.啟動節(jié)點,查看node2節(jié)點連接數(shù)量
bash node2/start.sh
tail -f node2/log/log* | grep "connected count"
8,進入webase頁面?,查看節(jié)點
如果需要改變節(jié)點類型,可以點擊私鑰管理,點擊新增用戶,點擊確定,然后點擊鏈管理,點擊修改,選擇節(jié)點類型即可。
七.WeBASE-Front 操作
1.進入頁面
2.WeBASE與WeBASE-Front交互操作
使用WeBASE導(dǎo)出admin用戶至WeBASE-Front
通過WeBASE-Front部署StringGetSet合約,點擊保存,編譯,部署
pragma solidity ^0.4.24;
contract StringGetSet {
string myValue;
function StringGetSet(){
myValue = "demo";
}
function get()constant returns(string) {
return myValue;
}
function set(string input) {
myValue = input;
}
}
調(diào)用StringGetSet合約驗證
剛開始點擊get會返回demo
八.權(quán)限管理操作
1.webase平臺創(chuàng)建三個賬戶
先創(chuàng)建用戶uesr1,user2,user3
2.委員新增
?
?
3.權(quán)重修改
?4.閾值修改
?
5.委員撤銷?
注意:此時的user1的權(quán)重有50,比較大,不需要投兩次票就可以直接撤銷
九.用群組Group 2啟動控制臺
①解壓控制臺安裝包
tar zxvf console.tar.gz
②復(fù)制編輯配置文件以及SDK
cp -n console/conf/config-example.toml console/conf/config.toml
cp nodes/127.0.0.1/sdk/* console/conf/
vim console/conf/config.toml
修改config.toml中的端口,?將文件中的20200替換成節(jié)點對應(yīng)的channel端口。
?文章來源:http://www.zghlxwxcb.cn/news/detail-845436.html
?③啟動控制臺
bash console/start.sh 2
?文章來源地址http://www.zghlxwxcb.cn/news/detail-845436.html
到了這里,關(guān)于區(qū)塊鏈部署與運維的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!