Centos7 區塊鏈 HyperLedger Fabric1.0.0安裝
阿新 • • 發佈:2019-01-10
前提條件
centos 7.4 64位
安裝docker並配置阿里雲加速器
安裝docker compose
安裝golang
由於被禁的關係,是沒有辦法直接訪問golang.org網站的, 不過國內提供下載的網站很多, 自己百度一下就可以了。
本人安裝路徑是/usr/local/src/go
編輯/etc/profile檔案新增相關環境變數如下
安裝git
yum install git
下載fabric原始碼
mkdir -p ~/go/src/github.com/hyperledger
cd ~/go/src/github.com/hyperledger
git clone https://github.com /hyperledger/fabric.git
git checkout v1.0.0
下載fabric映象
cd fabric/examples/e2e_cli/
chmod +x download-dockerimages.sh
./download-dockerimages -c x86_64-1.0.0 -f x86_64-1.0.0
docker images
執行fabric網路
./network_setup.sh up
跑一下Example,測試一下網路
docker exec -it cli bash
查詢賬戶餘額
peer chaincode query -C mychannel -n mycc -c '{"Args" :["query","a"]}'
從a賬戶轉賬20元到b賬戶
peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","20"]}'
查詢賬戶餘額
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
關閉網路
./network_setup.sh down