搭建fabric开发环境

2024-08-29 16:08
文章标签 开发 搭建 环境 fabric

本文主要是介绍搭建fabric开发环境,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

  • 1. 准备运行 Fabric 所需工具
  • 2. 准备 Fabric 镜像、程序以及测试代码
  • 3. 运行一个简单的 byfn 测试网
  • 4. 参考资料

1. 准备运行 Fabric 所需工具

本文所述运行环境均在 centos 系统下进行。

搭建开发环境需要安装以下工具:

  • docker
  • docker-compose
  • git
  • golang

安装 docker:

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
$ sudo systemctl start docker

安装 docker-compose:

$ yum install docker-compose

安装 git:

$ yum install git

安装 golang:

$ wget https://golang.org/dl/go1.15.6.linux-amd64.tar.gz
$ tar -C /usr/local -xzf go1.15.6.linux-amd64.tar.gz

$HOME/.bash_profile 添加:

export GO111MODULE=auto
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

生效变量修改:

$ source $HOME/.bash_profile

2. 准备 Fabric 镜像、程序以及测试代码

运行 byfn 测试网的准备工作,也是搭建开发环境的过程,最终,测试网能成功运行也说明环境搭建成功。

新建一个目录并进入:

$ mkdir hyperledger && cd hyperledger

下载执行脚本,此脚本用来自动化下载 fabric 镜像、程序和测试网运行脚本等工具:

$ wget https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh
--2020-12-15 14:07:12--  https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.76.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.76.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6521 (6.4K) [text/plain]
Saving to: ‘bootstrap.sh’bootstrap.sh              100%[==================================>]   6.37K  --.-KB/s    in 0s2020-12-15 14:07:12 (102 MB/s) - ‘bootstrap.sh’ saved [6521/6521]

给脚本添加执行权限:

$ chmod +x bootstrap.sh

执行脚本,指定下载 v1.3.0 版本的相关工具:

$ ./bootstrap.sh 1.3.0 1.3.0
点击查看脚本执行结果
Clone hyperledger/fabric-samples repo===> Cloning hyperledger/fabric-samples repo
Cloning into 'fabric-samples'...
remote: Enumerating objects: 6935, done.
remote: Total 6935 (delta 0), reused 0 (delta 0), pack-reused 6935
Receiving objects: 100% (6935/6935), 4.05 MiB | 2.07 MiB/s, done.
Resolving deltas: 100% (3608/3608), done.
===> Checking out v1.3.0 of hyperledger/fabric-samplesPull Hyperledger Fabric binaries===> Downloading version 1.3.0 platform specific fabric binaries
===> Downloading:  https://github.com/hyperledger/fabric/releases/download/v1.3.0/hyperledger-fabric-linux-amd64-1.3.0.tar.gz% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100   667  100   667    0     0   1450      0 --:--:-- --:--:-- --:--:--  1450
100 43.3M  100 43.3M    0     0  2411k      0  0:00:18  0:00:18 --:--:-- 3436k
==> Done.
===> Downloading version 1.3.0 platform specific fabric-ca-client binary
===> Downloading:  https://github.com/hyperledger/fabric-ca/releases/download/v1.3.0/hyperledger-fabric-ca-linux-amd64-1.3.0.tar.gz% Total    % Received % Xferd  Average Speed   Time    Time     Time  CurrentDload  Upload   Total   Spent    Left  Speed
100   670  100   670    0     0   1196      0 --:--:-- --:--:-- --:--:--  1196
100 5109k  100 5109k    0     0  1602k      0  0:00:03  0:00:03 --:--:-- 2321k
==> Done.Pull Hyperledger Fabric docker imagesFABRIC_IMAGES: peer orderer ccenv tools
===> Pulling fabric Images
====> hyperledger/fabric-peer:1.3.0
1.3.0: Pulling from hyperledger/fabric-peer
3b37166ec614: Pull complete
504facff238f: Pull complete
ebbcacd28e10: Pull complete
c7fb3351ecad: Pull complete
2e3debadcbf7: Pull complete
8ff2951c3d3f: Pull complete
1fe35bf6bbad: Pull complete
9c1ac744ea5e: Pull complete
8bbadd32d9dc: Pull complete
2c5a546e366f: Pull complete
Digest: sha256:6756c7c48234ae6b0a8822a378681017cf6dbfeadfbf1f8a528ee6c4db343621
Status: Downloaded newer image for hyperledger/fabric-peer:1.3.0
docker.io/hyperledger/fabric-peer:1.3.0
====> hyperledger/fabric-orderer:1.3.0
1.3.0: Pulling from hyperledger/fabric-orderer
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
8ff2951c3d3f: Already exists
1fe35bf6bbad: Already exists
9c1ac744ea5e: Already exists
245ee9cc02c1: Pull complete
d904630190ca: Pull complete
Digest: sha256:6ee1abcfd84031765d67544e5d6b4f3af08c3f064312c65715587d392fe7c3eb
Status: Downloaded newer image for hyperledger/fabric-orderer:1.3.0
docker.io/hyperledger/fabric-orderer:1.3.0
====> hyperledger/fabric-ccenv:1.3.0
1.3.0: Pulling from hyperledger/fabric-ccenv
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
8ff2951c3d3f: Already exists
1fe35bf6bbad: Already exists
f3bda0ed3a94: Pull complete
bd61b4bf6419: Pull complete
e8dc2740dfec: Pull complete
4f3dcdea854d: Pull complete
bfb507a16746: Pull complete
9b1c9eb92240: Pull complete
f161031e61cc: Pull complete
Digest: sha256:05fce5513fcae3110ac041469ed9e0e4c9661f44782f52ef5d8930eb416c2197
Status: Downloaded newer image for hyperledger/fabric-ccenv:1.3.0
docker.io/hyperledger/fabric-ccenv:1.3.0
====> hyperledger/fabric-tools:1.3.0
1.3.0: Pulling from hyperledger/fabric-tools
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
8ff2951c3d3f: Already exists
1fe35bf6bbad: Already exists
f3bda0ed3a94: Already exists
bd61b4bf6419: Already exists
e8dc2740dfec: Already exists
4f3dcdea854d: Already exists
8aa8fc04c03e: Pull complete
d5b255748f84: Pull complete
8c54f840b9e3: Pull complete
Digest: sha256:058cff3b378c1f3ebe35d56deb7bf33171bf19b327d91b452991509b8e9c7870
Status: Downloaded newer image for hyperledger/fabric-tools:1.3.0
docker.io/hyperledger/fabric-tools:1.3.0
===> Pulling fabric ca Image
====> hyperledger/fabric-ca:1.3.0
1.3.0: Pulling from hyperledger/fabric-ca
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
8ff2951c3d3f: Already exists
1fe35bf6bbad: Already exists
439bddb5d064: Pull complete
2c28e4d49d97: Pull complete
457b98c91ee8: Pull complete
45b3e17861f4: Pull complete
2b1b8d679889: Pull complete
Digest: sha256:83abc367c5273a12d59ef9777637eb6c1abf04a5d00d66a0bffc55c40075850e
Status: Downloaded newer image for hyperledger/fabric-ca:1.3.0
docker.io/hyperledger/fabric-ca:1.3.0
===> List out hyperledger docker images
hyperledger/fabric-ca        1.3       5c6b20ba944f   2 years ago   244MB
hyperledger/fabric-ca        1.3.0     5c6b20ba944f   2 years ago   244MB
hyperledger/fabric-ca        latest    5c6b20ba944f   2 years ago   244MB
hyperledger/fabric-tools     1.3       c056cd9890e7   2 years ago   1.5GB
hyperledger/fabric-tools     1.3.0     c056cd9890e7   2 years ago   1.5GB
hyperledger/fabric-tools     latest    c056cd9890e7   2 years ago   1.5GB
hyperledger/fabric-ccenv     1.3       953124d80237   2 years ago   1.38GB
hyperledger/fabric-ccenv     1.3.0     953124d80237   2 years ago   1.38GB
hyperledger/fabric-ccenv     latest    953124d80237   2 years ago   1.38GB
hyperledger/fabric-orderer   1.3       f430f581b46b   2 years ago   145MB
hyperledger/fabric-orderer   1.3.0     f430f581b46b   2 years ago   145MB
hyperledger/fabric-orderer   latest    f430f581b46b   2 years ago   145MB
hyperledger/fabric-peer      1.3       f3ea63abddaa   2 years ago   151MB
hyperledger/fabric-peer      1.3.0     f3ea63abddaa   2 years ago   151MB
hyperledger/fabric-peer      latest    f3ea63abddaa   2 years ago   151MB

从以上脚本执行结果不难发现除了下载 v1.3.0 的 docker 镜像外,还下载相关二进制程序:

$ ll fabric-samples/bin
total 184944
-rwxrwxr-x 1 1001 1001 18551624 Oct 10  2018 configtxgen
-rwxrwxr-x 1 1001 1001 19693584 Oct 10  2018 configtxlator
-rwxrwxr-x 1 1001 1001 11909544 Oct 10  2018 cryptogen
-rwxrwxr-x 1 1001 1001 19532432 Oct 10  2018 discover
-rwxr-xr-x 1 1001 1001 22956616 Oct  1 03:51 fabric-ca-client
-rwxr-xr-x 1 1001 1001 30289504 Oct  1 03:52 fabric-ca-server
-rwxrwxr-x 1 1001 1001      810 Oct 10  2018 get-docker-images.sh
-rwxrwxr-x 1 1001 1001 10724192 Oct 10  2018 idemixgen
-rwxrwxr-x 1 1001 1001 23890528 Oct 10  2018 orderer
-rwxrwxr-x 1 1001 1001 31812608 Oct 10  2018 peer

将这些程序复制到 GOPATH/bin 路径下以供之后的开发使用:

$ cp fabric-samples/bin/* $GOPATH/bin

至此,fabric v1.3.0 的开发和测试环境就算搭建完毕,接下来就可以运行一个简单的测试网络来检验环境搭建是否成功。

3. 运行一个简单的 byfn 测试网

fabric-samples 目录下包含多个测试用例,最简单的测试用例即为 first-network 下的 byfn.sh 脚本的测试网络:

$ cd fabric-samples/first-network
$ ./byfn.sh up
点击查看脚本执行结果
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n]
proceeding ...
LOCAL_VERSION=1.3.0
DOCKER_IMAGE_VERSION=1.3.0
/root/hyperledger/fabric-samples/bin/cryptogen##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
+ cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
+ res=0
+ set +x/root/hyperledger/fabric-samples/bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
+ configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
2020-12-22 16:58:04.720 CST [common/tools/configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen for output operations is deprecated.  Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.
2020-12-22 16:58:04.720 CST [common/tools/configtxgen] main -> INFO 002 Loading configuration
2020-12-22 16:58:04.749 CST [common/tools/configtxgen] doOutputBlock -> INFO 003 Generating genesis block
2020-12-22 16:58:04.750 CST [common/tools/configtxgen] doOutputBlock -> INFO 004 Writing genesis block
+ res=0
+ set +x#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2020-12-22 16:58:04.798 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2020-12-22 16:58:04.823 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2020-12-22 16:58:04.825 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 003 Writing new channel tx
+ res=0
+ set +x#################################################################
#######    Generating anchor peer update for Org1MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2020-12-22 16:58:04.872 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2020-12-22 16:58:04.900 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2020-12-22 16:58:04.900 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
+ res=0
+ set +x#################################################################
#######    Generating anchor peer update for Org2MSP   ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2020-12-22 16:58:04.939 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2020-12-22 16:58:04.965 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2020-12-22 16:58:04.965 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
+ res=0
+ set +xCreating network "net_byfn" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating peer0.org2.example.com ... done
Creating orderer.example.com    ... done
Creating peer1.org2.example.com ... done
Creating peer1.org1.example.com ... done
Creating peer0.org1.example.com ... done
Creating cli                    ... done____    _____      _      ____    _____
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |___) |   | |    / ___ \  |  _ <    | |
|____/    |_|   /_/   \_\ |_| \_\   |_|Build your first network (BYFN) end-to-end testChannel name : mychannel
Creating channel...
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --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
+ res=0
+ set +x
2020-12-22 08:58:08.849 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-12-22 08:58:08.883 UTC [cli/common] readBlock -> INFO 002 Received block: 0
===================== Channel 'mychannel' created =====================Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-12-22 08:58:08.962 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-12-22 08:58:09.000 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org1 joined channel 'mychannel' =====================+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-12-22 08:58:12.085 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-12-22 08:58:12.123 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org1 joined channel 'mychannel' =====================+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-12-22 08:58:15.212 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-12-22 08:58:15.255 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org2 joined channel 'mychannel' =====================+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-12-22 08:58:18.333 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-12-22 08:58:18.369 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org2 joined channel 'mychannel' =====================Updating anchor peers for org1...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org1MSPanchors.tx --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
+ res=0
+ set +x
2020-12-22 08:58:21.447 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-12-22 08:58:21.458 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org1MSP' on channel 'mychannel' =====================Updating anchor peers for org2...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --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
+ res=0
+ set +x
2020-12-22 08:58:24.535 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-12-22 08:58:24.547 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' =====================Installing chaincode on peer0.org1...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-12-22 08:58:27.630 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-12-22 08:58:27.630 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-12-22 08:58:27.841 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
===================== Chaincode is installed on peer0.org1 =====================Install chaincode on peer0.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-12-22 08:58:27.920 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-12-22 08:58:27.920 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-12-22 08:58:28.112 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
===================== Chaincode is installed on peer0.org2 =====================Instantiating chaincode on peer0.org2...
+ peer chaincode instantiate -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 -l golang -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P 'AND ('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')'
+ res=0
+ set +x
2020-12-22 08:58:28.195 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-12-22 08:58:28.195 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
===================== Chaincode is instantiated on peer0.org2 on channel 'mychannel' =====================Querying chaincode on peer0.org1...
===================== Querying on peer0.org1 on channel 'mychannel'... =====================
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer0.org1 ...3 secs
+ res=0
+ set +x100
===================== 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:7051 --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
2020-12-22 08:59:01.751 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
2020-12-22 08:59:01.833 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-12-22 08:59:01.833 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-12-22 08:59:02.046 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
===================== Chaincode is installed on peer1.org2 =====================Querying chaincode on peer1.org2...
===================== Querying on peer1.org2 on channel 'mychannel'... =====================
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer1.org2 ...3 secs
+ res=0
+ set +x90
===================== Query successful on peer1.org2 on channel 'mychannel' ============================== All GOOD, BYFN execution completed ===========_____   _   _   ____
| ____| | \ | | |  _ \
|  _|   |  \| | | | | |
| |___  | |\  | | |_| |
|_____| |_| \_| |____/

从上面的运行结果可发现 fabric 环境搭建成功,同时后台正在运行一个由多个容器组成的测试网,可查看容器状态:

$ docker ps
CONTAINER ID   IMAGE                                                                                                  COMMAND                  CREATED              STATUS              PORTS                                              NAMES
0d491d9af2ab   dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab   "chaincode -peer.add…"   About a minute ago   Up About a minute                                                      dev-peer1.org2.example.com-mycc-1.0
adcc2532ea01   dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9   "chaincode -peer.add…"   About a minute ago   Up About a minute                                                      dev-peer0.org1.example.com-mycc-1.0
90fb7eaa241e   dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b   "chaincode -peer.add…"   About a minute ago   Up About a minute                                                      dev-peer0.org2.example.com-mycc-1.0
06fd0733952b   hyperledger/fabric-tools:latest                                                                        "/bin/bash"              2 minutes ago        Up 2 minutes                                                           cli
86f35856f630   hyperledger/fabric-peer:latest                                                                         "peer node start"        2 minutes ago        Up 2 minutes        0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp     peer1.org1.example.com
6683350bd5ba   hyperledger/fabric-peer:latest                                                                         "peer node start"        2 minutes ago        Up 2 minutes        0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp     peer0.org1.example.com
84b00d07df34   hyperledger/fabric-peer:latest                                                                         "peer node start"        2 minutes ago        Up 2 minutes        0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp   peer1.org2.example.com
046558652c66   hyperledger/fabric-peer:latest                                                                         "peer node start"        2 minutes ago        Up 2 minutes        0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp     peer0.org2.example.com
c0769f29999b   hyperledger/fabric-orderer:latest                                                                      "orderer"                2 minutes ago        Up 2 minutes        0.0.0.0:7050->7050/tcp                             orderer.example.com

想要停止测试网也很简单:

$ ./byfn.sh down
点击查看脚本执行结果
Stopping for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n]
proceeding ...
Stopping cli                    ... done
Stopping peer1.org1.example.com ... done
Stopping peer0.org1.example.com ... done
Stopping peer1.org2.example.com ... done
Stopping peer0.org2.example.com ... done
Stopping orderer.example.com    ... done
Removing cli                    ... done
Removing peer1.org1.example.com ... done
Removing peer0.org1.example.com ... done
Removing peer1.org2.example.com ... done
Removing peer0.org2.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_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.
0d491d9af2ab
adcc2532ea01
90fb7eaa241e
Untagged: dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab:latest
Deleted: sha256:c429727b979706dfc6eddf82e2938e8d450cb08097e9d5de6b71a398f0a3160a
Deleted: sha256:53f46be463bfc6eda48964fd9258402f18bef463523dedcddeced57f0976f6af
Deleted: sha256:d52ef5e6b976d0f9611f4a8e266ee156662165bdc0d8bd015010b898249a72cb
Deleted: sha256:8cd50d43c21f01469a48085a851df1327068e9c6d61818f7679501611e755c03
Untagged: dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9:latest
Deleted: sha256:1e8ab6007eab1542f9d1963d6cfb434c4b13e4e723c44c3f7e0b820f223b3499
Deleted: sha256:dadb5ad33ad330a0113cf3ab2aa264d9508b1043d2495c69d62161f08d0c8d67
Deleted: sha256:d12ba73262a090d3142ea2dbe3c788f6c1b669449cc45e575a9c4a8d54e2f3d0
Deleted: sha256:b8c6e9529351ed44fae47e62c0b0a1a0103d8d1dc03192f0c913a2afae4b1865
Untagged: dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b:latest
Deleted: sha256:981325df75500ce39d8c3b5caa09b4620bd5fe56c07c2a641c8e0b1aeb793487
Deleted: sha256:bbad1e5da01ee190fbfef8c76863a8253e7a3dad3b4511a7e450fea307c2a211
Deleted: sha256:69dfd4702a9dca81b474fc8966248c164ee3bd650d94e0cabe26f4190666e32c
Deleted: sha256:fb45098007c68bdc6031e15829926dd76ede880e925cb8b029f1553e5295fd2f

4. 参考资料

  • Install Samples, Binaries and Docker Images
  • Building Your First Network

这篇关于搭建fabric开发环境的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1118327

相关文章

这15个Vue指令,让你的项目开发爽到爆

1. V-Hotkey 仓库地址: github.com/Dafrok/v-ho… Demo: 戳这里 https://dafrok.github.io/v-hotkey 安装: npm install --save v-hotkey 这个指令可以给组件绑定一个或多个快捷键。你想要通过按下 Escape 键后隐藏某个组件,按住 Control 和回车键再显示它吗?小菜一碟: <template

Hadoop企业开发案例调优场景

需求 (1)需求:从1G数据中,统计每个单词出现次数。服务器3台,每台配置4G内存,4核CPU,4线程。 (2)需求分析: 1G / 128m = 8个MapTask;1个ReduceTask;1个mrAppMaster 平均每个节点运行10个 / 3台 ≈ 3个任务(4    3    3) HDFS参数调优 (1)修改:hadoop-env.sh export HDFS_NAMENOD

嵌入式QT开发:构建高效智能的嵌入式系统

摘要: 本文深入探讨了嵌入式 QT 相关的各个方面。从 QT 框架的基础架构和核心概念出发,详细阐述了其在嵌入式环境中的优势与特点。文中分析了嵌入式 QT 的开发环境搭建过程,包括交叉编译工具链的配置等关键步骤。进一步探讨了嵌入式 QT 的界面设计与开发,涵盖了从基本控件的使用到复杂界面布局的构建。同时也深入研究了信号与槽机制在嵌入式系统中的应用,以及嵌入式 QT 与硬件设备的交互,包括输入输出设

OpenHarmony鸿蒙开发( Beta5.0)无感配网详解

1、简介 无感配网是指在设备联网过程中无需输入热点相关账号信息,即可快速实现设备配网,是一种兼顾高效性、可靠性和安全性的配网方式。 2、配网原理 2.1 通信原理 手机和智能设备之间的信息传递,利用特有的NAN协议实现。利用手机和智能设备之间的WiFi 感知订阅、发布能力,实现了数字管家应用和设备之间的发现。在完成设备间的认证和响应后,即可发送相关配网数据。同时还支持与常规Sof

阿里开源语音识别SenseVoiceWindows环境部署

SenseVoice介绍 SenseVoice 专注于高精度多语言语音识别、情感辨识和音频事件检测多语言识别: 采用超过 40 万小时数据训练,支持超过 50 种语言,识别效果上优于 Whisper 模型。富文本识别:具备优秀的情感识别,能够在测试数据上达到和超过目前最佳情感识别模型的效果。支持声音事件检测能力,支持音乐、掌声、笑声、哭声、咳嗽、喷嚏等多种常见人机交互事件进行检测。高效推

活用c4d官方开发文档查询代码

当你问AI助手比如豆包,如何用python禁止掉xpresso标签时候,它会提示到 这时候要用到两个东西。https://developers.maxon.net/论坛搜索和开发文档 比如这里我就在官方找到正确的id描述 然后我就把参数标签换过来

搭建Kafka+zookeeper集群调度

前言 硬件环境 172.18.0.5        kafkazk1        Kafka+zookeeper                Kafka Broker集群 172.18.0.6        kafkazk2        Kafka+zookeeper                Kafka Broker集群 172.18.0.7        kafkazk3

安装nodejs环境

本文介绍了如何通过nvm(NodeVersionManager)安装和管理Node.js及npm的不同版本,包括下载安装脚本、检查版本并安装特定版本的方法。 1、安装nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash 2、查看nvm版本 nvm --version 3、安装

【IPV6从入门到起飞】5-1 IPV6+Home Assistant(搭建基本环境)

【IPV6从入门到起飞】5-1 IPV6+Home Assistant #搭建基本环境 1 背景2 docker下载 hass3 创建容器4 浏览器访问 hass5 手机APP远程访问hass6 更多玩法 1 背景 既然电脑可以IPV6入站,手机流量可以访问IPV6网络的服务,为什么不在电脑搭建Home Assistant(hass),来控制你的设备呢?@智能家居 @万物互联

高并发环境中保持幂等性

在高并发环境中保持幂等性是一项重要的挑战。幂等性指的是无论操作执行多少次,其效果都是相同的。确保操作的幂等性可以避免重复执行带来的副作用。以下是一些保持幂等性的常用方法: 唯一标识符: 请求唯一标识:在每次请求中引入唯一标识符(如 UUID 或者生成的唯一 ID),在处理请求时,系统可以检查这个标识符是否已经处理过,如果是,则忽略重复请求。幂等键(Idempotency Key):客户端在每次