在本地搭建hyperledger fabric 网络

参考了官方文档,直接就可以了https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html 很好用


➜  ~ cd $GOPATH/src/github.com/hyperledger/fabric/master/scripts/
cd: no such file or directory: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/master/scripts/~ cd $GOPATH/src/github.com/hyperledger/fabric/scripts
➜  scripts git:(be235fd3a) ✗ ls
bootstrap.sh             check_go_version.sh      check_trailingspaces.sh  goListFiles.sh           multiarch.sh             run-unit-tests.sh
changelog.sh             check_license.sh         compile_protos.sh        golinter.sh              pull_build_artifacts.sh
check_deps.sh            check_spelling.sh        generateHelpDocs.sh      metrics_doc.sh           run-integration-tests.sh
➜  scripts git:(be235fd3a) ✗ ./bootstrap.sh

Installing hyperledger/fabric-samples repo

===> Cloning hyperledger/fabric-samples repo and checkout v1.4.0
Cloning into 'fabric-samples'...
remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (43/43), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 3140 (delta 13), reused 32 (delta 11), pack-reused 3097
Receiving objects: 100% (3140/3140), 1.04 MiB | 25.00 KiB/s, done.
Resolving deltas: 100% (1528/1528), done.
Note: checking out 'v1.4.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at bb39b6e [FAB-13570] Align fabric-samples with 1.4.0 release

Installing Hyperledger Fabric binaries

===> Downloading version 1.4.0 platform specific fabric binaries
===> Downloading:  https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/darwin-amd64-1.4.0/hyperledger-fabric-darwin-amd64-1.4.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 39.8M  100 39.8M    0     0   190k      0  0:03:34  0:03:34 --:--:--  254k
==> Done.
===> Downloading version 1.4.0 platform specific fabric-ca-client binary
===> Downloading:  https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric-ca/hyperledger-fabric-ca/darwin-amd64-1.4.0/hyperledger-fabric-ca-darwin-amd64-1.4.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 4806k  100 4806k    0     0   161k      0  0:00:29  0:00:29 --:--:--  160k
==> Done.

Installing Hyperledger Fabric docker images

===> Pulling fabric Images
==> FABRIC IMAGE: peer

1.4.0: Pulling from hyperledger/fabric-peer
3b37166ec614: Pull complete
504facff238f: Pull complete
ebbcacd28e10: Pull complete
c7fb3351ecad: Pull complete
2e3debadcbf7: Pull complete
fc435e46e32e: Pull complete
a4922bafdce8: Pull complete
7d9964965066: Pull complete
625153a09c48: Pull complete
291344806a10: Pull complete
Digest: sha256:9707c97f787de1d4d6dd60994d6b8ea2e5cc28b0f42e6849df3fb41c64b41372
Status: Downloaded newer image for hyperledger/fabric-peer:1.4.0
==> FABRIC IMAGE: orderer

1.4.0: Pulling from hyperledger/fabric-orderer
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
fc435e46e32e: Already exists
a4922bafdce8: Already exists
7d9964965066: Already exists
1aa1f5822ea4: Pull complete
f3adcb95411e: Pull complete
Digest: sha256:644265186b4887c7d9dcb91895124ccead3c0125c2c4f9eadc421dc9555d7495
Status: Downloaded newer image for hyperledger/fabric-orderer:1.4.0
==> FABRIC IMAGE: ccenv

1.4.0: Pulling from hyperledger/fabric-ccenv
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
fc435e46e32e: Already exists
a4922bafdce8: Already exists
14675a1189ca: Pull complete
33f930d7053e: Pull complete
7aa21e006739: Pull complete
806ba27e29bb: Pull complete
0292b0ff822a: Pull complete
5d4ce0f5fd82: Pull complete
3bde20c14104: Pull complete
Digest: sha256:6d797cac9fd39d4c9964fbcf02e47137ce8ae321af60832c41d511f0c7ed4d3e
Status: Downloaded newer image for hyperledger/fabric-ccenv:1.4.0
==> FABRIC IMAGE: tools

1.4.0: Pulling from hyperledger/fabric-tools
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
fc435e46e32e: Already exists
a4922bafdce8: Already exists
14675a1189ca: Already exists
33f930d7053e: Already exists
7aa21e006739: Already exists
806ba27e29bb: Already exists
72b2b3c78600: Pull complete
f36a6f470154: Pull complete
19fc6d1044df: Pull complete
Digest: sha256:aee256916d0cb938d8023fa32ed2745991d32cfe79018e360f1720707ebfbdb5
Status: Downloaded newer image for hyperledger/fabric-tools:1.4.0
==> FABRIC IMAGE: baseos

Error response from daemon: manifest for hyperledger/fabric-baseos:1.4.0 not found
Error response from daemon: No such image: hyperledger/fabric-baseos:1.4.0
==> FABRIC IMAGE: nodeenv

Error response from daemon: manifest for hyperledger/fabric-nodeenv:1.4.0 not found
Error response from daemon: No such image: hyperledger/fabric-nodeenv:1.4.0
==> FABRIC IMAGE: javaenv

1.4.0: Pulling from hyperledger/fabric-javaenv
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
fc435e46e32e: Already exists
a4922bafdce8: Already exists
14675a1189ca: Already exists
33f930d7053e: Already exists
7aa21e006739: Already exists
806ba27e29bb: Already exists
af7eebe5d909: Pulling fs layer
c0ad74369a8f: Pulling fs layer
e36a0232c697: Pulling fs layer
c44da90e9317: Pull complete
91686ed50f7f: Pull complete
1bc0e6d0fb0f: Pull complete
db373eca3e52: Pull complete
942e34fe9650: Pull complete
e49b8e9d853d: Pull complete
094ba7d3af94: Pull complete
4bf56bdf76e0: Pull complete
138eeaa643a0: Pull complete
2b405cbef2dc: Pull complete
386086ff2840: Pull complete
32bb4435cb82: Pull complete
3280cfa711dc: Pull complete
6b14cff5081c: Pull complete
04743de5a814: Pull complete
5360864ccda4: Pull complete
2fd4fc8d8137: Pull complete
bd0e3b20a1bb: Pull complete
a298ecbfeab2: Pull complete
c7b9277c5a65: Pull complete
201919c3a1fe: Pull complete
539bfc561087: Pull complete
4e779849c7ea: Pull complete
3a7304a5b624: Pull complete
Digest: sha256:f392f0c568e515b3e14c9afce14340ba18bc456cfd831ffcb4f72db58dbbcc34
Status: Downloaded newer image for hyperledger/fabric-javaenv:1.4.0
===> Pulling fabric ca Image
==> FABRIC CA IMAGE

1.4.0: Pulling from hyperledger/fabric-ca
3b37166ec614: Already exists
504facff238f: Already exists
ebbcacd28e10: Already exists
c7fb3351ecad: Already exists
2e3debadcbf7: Already exists
fc435e46e32e: Already exists
a4922bafdce8: Already exists
c8ec0cae397c: Pull complete
3153e2e7116e: Pull complete
d84abf263d15: Pull complete
45ff112943d3: Pull complete
c4678d50bc7a: Pull complete
Digest: sha256:c1dce534d9e9202697e0aaad7c5521d958700fda0b05127dafb9333c22e15f74
Status: Downloaded newer image for hyperledger/fabric-ca:1.4.0
===> Pulling thirdparty docker images
==> THIRDPARTY DOCKER IMAGE: couchdb

0.4.15: Pulling from hyperledger/fabric-couchdb
Digest: sha256:f6c724592abf9c2b35d2f4cd6a7afcde9c1052cfed61560b20ef9e2e927d1790
Status: Downloaded newer image for hyperledger/fabric-couchdb:0.4.15
==> THIRDPARTY DOCKER IMAGE: kafka

0.4.15: Pulling from hyperledger/fabric-kafka
34667c7e4631: Already exists
d18d76a881a4: Already exists
119c7358fbfc: Already exists
2aaf13f3eff0: Already exists
3f89de4cf84b: Already exists
24194f819972: Already exists
78e4eabd31a5: Already exists
c7652b6bde40: Already exists
b4646dd65c45: Already exists
5e6defad8a30: Already exists
d0459116a54a: Pull complete
1bbcec7bfdef: Pull complete
5911218c5933: Pull complete
Digest: sha256:62418a885c291830510379d9eb09fbdd3d397052d916ed877a468b0e2026b9e3
Status: Downloaded newer image for hyperledger/fabric-kafka:0.4.15
==> THIRDPARTY DOCKER IMAGE: zookeeper

0.4.15: Pulling from hyperledger/fabric-zookeeper
34667c7e4631: Already exists
d18d76a881a4: Already exists
119c7358fbfc: Already exists
2aaf13f3eff0: Already exists
3f89de4cf84b: Already exists
24194f819972: Already exists
78e4eabd31a5: Already exists
c7652b6bde40: Already exists
b4646dd65c45: Already exists
5e6defad8a30: Already exists
0e045d9c2cdc: Pull complete
7ef4d8920518: Pull complete
dbeed81d9a45: Pull complete
aeea025ecc4e: Pull complete
Digest: sha256:180553e88d09167370aa62a41587a9a95b819b981ad74cad218689412b85f130
Status: Downloaded newer image for hyperledger/fabric-zookeeper:0.4.15

===> List out hyperledger docker images
hyperledger/fabric-ca                                                                                  <none>              3a1799cda5d7        4 weeks ago         252MB
hyperledger/fabric-tools                                                                               <none>              432c24764fbb        4 weeks ago         1.55GB
hyperledger/fabric-ccenv                                                                               <none>              d7433c4b2a1c        4 weeks ago         1.43GB
hyperledger/fabric-orderer                                                                             <none>              ec4ca236d3d4        4 weeks ago         173MB
hyperledger/fabric-peer                                                                                <none>              a1e3874f338b        4 weeks ago         178MB
hyperledger/fabric-zookeeper                                                                           0.4.15              20c6045930c8        7 weeks ago         1.43GB
hyperledger/fabric-zookeeper                                                                           latest              20c6045930c8        7 weeks ago         1.43GB
hyperledger/fabric-kafka                                                                               0.4.15              b4ab82bbaf2f        7 weeks ago         1.44GB
hyperledger/fabric-kafka                                                                               latest              b4ab82bbaf2f        7 weeks ago         1.44GB
hyperledger/fabric-couchdb                                                                             0.4.15              8de128a55539        7 weeks ago         1.5GB
hyperledger/fabric-couchdb                                                                             latest              8de128a55539        7 weeks ago         1.5GB
hyperledger/fabric-baseos                                                                              amd64-0.4.15        9d6ec11c60ff        7 weeks ago         145MB
hyperledger/fabric-baseos                                                                              latest              9d6ec11c60ff        7 weeks ago         145MB
hyperledger/fabric-javaenv                                                                             1.4.0               3d91b3bf7118        3 months ago        1.75GB
hyperledger/fabric-javaenv                                                                             latest              3d91b3bf7118        3 months ago        1.75GB
hyperledger/fabric-tools                                                                               1.4.0               0a44f4261a55        4 months ago        1.56GB
hyperledger/fabric-tools                                                                               latest              0a44f4261a55        4 months ago        1.56GB
hyperledger/fabric-ccenv                                                                               1.4.0               5b31d55f5f3a        4 months ago        1.43GB
hyperledger/fabric-ccenv                                                                               latest              5b31d55f5f3a        4 months ago        1.43GB
hyperledger/fabric-orderer                                                                             1.4.0               54f372205580        4 months ago        150MB
hyperledger/fabric-orderer                                                                             latest              54f372205580        4 months ago        150MB
hyperledger/fabric-peer                                                                                1.4.0               304fac59b501        4 months ago        157MB
hyperledger/fabric-peer                                                                                latest              304fac59b501        4 months ago        157MB
hyperledger/fabric-ca                                                                                  1.4.0               1a804ab74f58        4 months ago        244MB
hyperledger/fabric-ca                                                                                  latest              1a804ab74f58        4 months ago        244MB
➜  scripts git:(be235fd3a) ✗ ls
bootstrap.sh             check_go_version.sh      check_trailingspaces.sh  generateHelpDocs.sh      metrics_doc.sh           run-integration-tests.sh
changelog.sh             check_license.sh         compile_protos.sh        goListFiles.sh           multiarch.sh             run-unit-tests.sh
check_deps.sh            check_spelling.sh        fabric-samples           golinter.sh              pull_build_artifacts.sh
➜  scripts git:(be235fd3a) ✗ cd fabric-samples
➜  fabric-samples git:(bb39b6e) ls
CODE_OF_CONDUCT.md       LICENSE                  balance-transfer         chaincode                config                   high-throughput
CONTRIBUTING.md          MAINTAINERS.md           basic-network            chaincode-docker-devmode fabcar                   interest_rate_swaps
Jenkinsfile              README.md                bin                      commercial-paper         first-network            scripts
➜  fabric-samples git:(bb39b6e)
➜  fabric-samples git:(bb39b6e)
➜  fabric-samples git:(bb39b6e) ls
CODE_OF_CONDUCT.md       LICENSE                  balance-transfer         chaincode                config                   high-throughput
CONTRIBUTING.md          MAINTAINERS.md           basic-network            chaincode-docker-devmode fabcar                   interest_rate_swaps
Jenkinsfile              README.md                bin                      commercial-paper         first-network            scripts
➜  fabric-samples git:(bb39b6e) cd first-network
➜  first-network git:(bb39b6e) ls
README.md                        channel-artifacts                docker-compose-cli.yaml          docker-compose-e2e-template.yaml eyfn.sh
base                             configtx.yaml                    docker-compose-couch-org3.yaml   docker-compose-kafka.yaml        org3-artifacts
byfn.sh                          crypto-config.yaml               docker-compose-couch.yaml        docker-compose-org3.yaml         scripts
➜  first-network git:(bb39b6e) ./byfn.sh
Usage:
  byfn.sh <mode> [-c <channel name>] [-t <timeout>] [-d <delay>] [-f <docker-compose-file>] [-s <dbtype>] [-l <language>] [-o <consensus-type>] [-i <imagetag>] [-v]
    <mode> - one of 'up', 'down', 'restart', 'generate' or 'upgrade'
      - 'up' - bring up the network with docker-compose up
      - 'down' - clear the network with docker-compose down
      - 'restart' - restart the network
      - 'generate' - generate required certificates and genesis block
      - 'upgrade'  - upgrade the network from version 1.3.x to 1.4.0
    -c <channel name> - channel name to use (defaults to "mychannel")
    -t <timeout> - CLI timeout duration in seconds (defaults to 10)
    -d <delay> - delay duration in seconds (defaults to 3)
    -f <docker-compose-file> - specify which docker-compose file use (defaults to docker-compose-cli.yaml)
    -s <dbtype> - the database backend to use: goleveldb (default) or couchdb
    -l <language> - the chaincode language: golang (default) or node
    -o <consensus-type> - the consensus-type of the ordering service: solo (default) or kafka
    -i <imagetag> - the tag to be used to launch the network (defaults to "latest")
    -v - verbose mode
  byfn.sh -h (print this message)

Typically, one would first generate the required certificates and
genesis block, then bring up the network. e.g.:

    byfn.sh generate -c mychannel
    byfn.sh up -c mychannel -s couchdb
        byfn.sh up -c mychannel -s couchdb -i 1.4.0
    byfn.sh up -l node
    byfn.sh down -c mychannel
        byfn.sh upgrade -c mychannel

Taking all defaults:
    byfn.sh generate
    byfn.sh up
    byfn.sh down
➜  first-network git:(bb39b6e) ./byfn.sh generate
Generating certs and genesis block for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
/Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/../bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
+ cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
+ res=0
+ set +x

/Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/../bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
CONSENSUS_TYPE=solo
+ '[' solo == solo ']'
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
2019-05-11 09:39:24.844 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2019-05-11 09:39:24.885 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: solo
2019-05-11 09:39:24.885 CST [common.tools.configtxgen.localconfig] Load -> INFO 003 Loaded configuration: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2019-05-11 09:39:24.929 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 004 orderer type: solo
2019-05-11 09:39:24.929 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 005 Loaded configuration: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2019-05-11 09:39:24.932 CST [common.tools.configtxgen] doOutputBlock -> INFO 006 Generating genesis block
2019-05-11 09:39:24.933 CST [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block
+ res=0
+ set +x

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2019-05-11 09:39:24.986 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2019-05-11 09:39:25.027 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2019-05-11 09:39:25.061 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2019-05-11 09:39:25.061 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2019-05-11 09:39:25.061 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 005 Generating new channel configtx
2019-05-11 09:39:25.064 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 006 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
2019-05-11 09:39:25.132 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2019-05-11 09:39:25.174 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2019-05-11 09:39:25.212 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2019-05-11 09:39:25.212 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2019-05-11 09:39:25.212 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update
2019-05-11 09:39:25.214 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 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
2019-05-11 09:39:25.267 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2019-05-11 09:39:25.304 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2019-05-11 09:39:25.341 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2019-05-11 09:39:25.342 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /Volumes/Data/Work/golang/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2019-05-11 09:39:25.342 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update
2019-05-11 09:39:25.342 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 Writing anchor peer update
+ res=0
+ set +x

➜  first-network git:(bb39b6e) ./byfn.sh up
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
LOCAL_VERSION=1.4.0
DOCKER_IMAGE_VERSION=1.4.0
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 peer1.org1.example.com ... done
Creating peer1.org2.example.com ... done
Creating orderer.example.com    ... done
Creating peer0.org2.example.com ... done
Creating peer0.org1.example.com ... done
Creating cli                    ... done

 ____    _____      _      ____    _____
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |
 ___) |   | |    / ___ \  |  _ <    | |
|____/    |_|   /_/   \_\ |_| \_\   |_|

Build your first network (BYFN) end-to-end test

Channel 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
2019-05-11 01:39:58.550 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-05-11 01:39:58.646 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
2019-05-11 01:39:58.821 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-05-11 01:39:58.905 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
2019-05-11 01:40:02.111 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-05-11 01:40:02.197 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
2019-05-11 01:40:05.360 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-05-11 01:40:05.437 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
2019-05-11 01:40:08.580 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-05-11 01:40:08.656 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
2019-05-11 01:40:11.815 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-05-11 01:40:11.849 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
2019-05-11 01:40:15.029 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-05-11 01:40:15.065 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
2019-05-11 01:40:18.265 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-05-11 01:40:18.265 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-05-11 01:40:19.176 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
2019-05-11 01:40:19.414 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-05-11 01:40:19.415 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-05-11 01:40:19.697 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
2019-05-11 01:40:19.900 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-05-11 01:40:19.901 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 +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: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
2019-05-11 01:40:25.793 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-05-11 01:40:25.945 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-05-11 01:40:25.945 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-05-11 01:40:26.280 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 +x

90
===================== Query successful on peer1.org2 on channel 'mychannel' =====================

========= All GOOD, BYFN execution completed ===========


 _____   _   _   ____
| ____| | \ | | |  _ \
|  _|   |  \| | | | | |
| |___  | |\  | | |_| |
|_____| |_| \_| |____/

猜你喜欢

转载自www.cnblogs.com/jackluo/p/10847770.html