安装最新版本的curl. 执行更新操作
要求:Docker version 17.06.2-ce or greater is required。不低于17.06.2-ce版本.
#官网文档;
https://docs.docker.com/
#下载地址
https://download.docker.com/linux/ubuntu/dists/ 从pool/stable/目录下选择适合的版本
#安装步骤请参考官网进行安装.
#验证
> docker version
Client:
Version: 18.09.4
API version: 1.39
Go version: go1.10.8
Git commit: d14af54
Built: Wed Mar 27 18:34:51 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.4
API version: 1.39 (minimum version 1.12)
Go version: go1.10.8
Git commit: d14af54
Built: Wed Mar 27 18:01:48 2019
OS/Arch: linux/amd64
Experimental: false
要求:Go version 1.11.x is required。不低于1.11
#下载地址:
https://studygolang.com/dl/golang/go1.11.4.linux-amd64.tar.gz
#解压到/usr/local目录下
sudo tar -xzf go1.11.4.linux-amd64.tar.gz -C /usr/local
#配置全局变量
sudo vi ~/.bashrc
export GOROOT=/usr/local/go
export GOPATH=/data/gopath
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
#配置生效
source ~/.bashrc
#验证
go version
> go version go1.11.4 linux/amd64
要求:不低于version 8.9.x
#下载地址
http://nodejs.cn/download/
#安装
sudo tar -xzf node-v10.15.0-linux-x64.tar.xz -C /usr/local
#配置全局变量
sudo vi ~/.bashrc
export NODE_HOME=/usr/local/node
export PATH=$GOROOT/bin:$GOPATH/bin:$NODE_HOME/bin:$PATH
#配置生效
source ~/.bashrc
#验证
node -v
要求:不低于version 2.7
#安装
sudo apt-get install python
#验证
python --version
#下载bootstrap脚本
https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh
wget https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh
#执行脚本
root@ubuntu:/data# ./bootstrap.sh
脚本功能:下载fabric-samples v1.4、下载二进制文件、下载镜像.
#配置全局变量
sudo vi ~/.bashrc
export PATH=$GOROOT/bin:$GOPATH/bin:$NODE_HOME/bin:/data/fabric-samples/bin:$PATH
#配置生效
source ~/.bashrc
cd fabric-samples/first-network
#生成网络组件
./byfn.sh generate
#说明:1、为区块链网络生成证书和密钥。2、genesis block:用来引导order服务。 3、与交易相关的channel配置。
./byfn.sh up
---
===================== Chaincode is instantiated on peer0.org2 on channel 'mychannel' =====================
Querying chaincode on peer0.org1...
===================== Querying on peer0.org1 on channel 'mychannel'... =====================
Attempting to Query peer0.org1 ...3 secs
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
+ res=0
+ set +x
100
===================== Query successful on peer0.org1 on channel 'mychannel' =====================
Sending invoke transaction on peer0.org1 peer0.org2...
+ 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 --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","10"]}'
+ res=0
+ set +x
2019-03-29 07:05:11.303 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200
===================== Invoke transaction successful on peer0.org1 peer0.org2 on channel 'mychannel' =====================
Installing chaincode on peer1.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2019-03-29 07:05:11.474 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-03-29 07:05:11.474 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-03-29 07:05:14.770 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:
===================== Chaincode is installed on peer1.org2 =====================
Querying chaincode on peer1.org2...
===================== Querying on peer1.org2 on channel 'mychannel'... =====================
Attempting to Query peer1.org2 ...3 secs
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
+ res=0
+ set +x
90
===================== Query successful on peer1.org2 on channel 'mychannel' =====================
========= All GOOD, BYFN execution completed ===========
_____ _ _ ____
| ____| | \ | | | _ \
| _| | \| | | | | |
| |___ | |\ | | |_| |
|_____| |_| \_| |____/
代表启动成功
./byfn.sh down
Stopping for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
Stopping cli ... done
Stopping peer0.org1.example.com ... done
Stopping peer0.org2.example.com ... done
Stopping peer1.org2.example.com ... done
Stopping peer1.org1.example.com ... done
Stopping orderer.example.com ... done
Removing cli ... done
Removing peer0.org1.example.com ... done
Removing peer0.org2.example.com ... done
Removing peer1.org2.example.com ... done
Removing peer1.org1.example.com ... done
Removing orderer.example.com ... done
Removing network net_byfn
Removing volume net_orderer.example.com
Removing volume net_peer0.org1.example.com
Removing volume net_peer1.org1.example.com
Removing volume net_peer0.org2.example.com
Removing volume net_peer1.org2.example.com
Removing volume net_orderer2.example.com
WARNING: Volume net_orderer2.example.com not found.
Removing volume net_orderer3.example.com
WARNING: Volume net_orderer3.example.com not found.
Removing volume net_orderer4.example.com
WARNING: Volume net_orderer4.example.com not found.
Removing volume net_orderer5.example.com
WARNING: Volume net_orderer5.example.com not found.
Removing volume net_peer0.org3.example.com
WARNING: Volume net_peer0.org3.example.com not found.
Removing volume net_peer1.org3.example.com
WARNING: Volume net_peer1.org3.example.com not found.
3479ac5f89e2
b25edb9cff06
f99da8e6fa79
Untagged: dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab:latest
Deleted: sha256:50605be6f48296b0d197deb813665cc4e19aafe5d74fc72210492663d2145443
Deleted: sha256:8fb5b7d8dc450c08bbcf7706a763346563b22b654df773084fbbc98a99f6cfa9
Deleted: sha256:d13b666e3224a7e7fc668854fc1db854392aefce30163b1190c6d7c64674e0e2
Deleted: sha256:6a18c726fb0fc4a9c3816a53b7734faf43719e8b480cc7b7bdc5dd3eb207e6d1
Untagged: dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9:latest
Deleted: sha256:b642a550022f0a02ce96525cfa54a4bb4714e70c668f11e0c043130aefab37f0
Deleted: sha256:be23627ce807b51ada615b104959c6146cb618626e0c60f024dcce786f30c4d6
Deleted: sha256:c36060150f46c97857c5029974897406033586e3faa02759eda6d223849ac450
Deleted: sha256:2ac0744e192575be6dce69f5d6c9486d66c07b33a9c93dd82b0e0d9a1643a3f4
Untagged: dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b:latest
Deleted: sha256:5a42b1cb8cfca3fb05d26a93567f10b2b33e16b585206dfd5eb7ef8d2627d755
Deleted: sha256:9fbfd7f6af9d47b157db9b2f52dbf055bffebe3ef0f95c8f3134a13bb46a8b07
Deleted: sha256:177963f5a41bc9cd65da5539b92620f6d897a7ab937e70134b34990db2e1b473
Deleted: sha256:ff3e0238b0b89157ea3431f101d046d6fba112a0cfe823396230520293caf092