centos7.4运行hyperLedger fabric 1.3.0 first network

按照官方教程运行。
需要注意的是,避免干扰,一定要清空运行的docker以及images。

docker rm $(docker ps -aq)
docker rmi $(docker images -q)

跟着官网的例子运行,下面是对应的images和运行的docker。

[root@bc1 fabric-test]# docker images
REPOSITORY                                                                                             TAG                 IMAGE ID            CREATED             SIZE
dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b   latest              b75ace954a86        29 seconds ago      141MB
dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9   latest              376f30e564c9        31 minutes ago      141MB
hyperledger/fabric-tools                                                                               latest              0a44f4261a55        11 days ago         1.56GB
hyperledger/fabric-ccenv                                                                               latest              5b31d55f5f3a        11 days ago         1.43GB
hyperledger/fabric-orderer                                                                             latest              54f372205580        11 days ago         150MB
hyperledger/fabric-peer                                                                                latest              304fac59b501        11 days ago         157MB
hyperledger/fabric-baseos                                                                              amd64-0.4.14        75f5fb1a0e0c        3 months ago        124MB
[root@bc1 fabric-test]# docker ps -a
CONTAINER ID        IMAGE                                                                                                  COMMAND                  CREATED             STATUS              PORTS                                              NAMES
9bc320cc7b14        dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9   "chaincode -peer.add…"   18 minutes ago      Up 18 minutes                                                          dev-peer0.org1.example.com-mycc-1.0
a4207513da31        hyperledger/fabric-tools:latest                                                                        "/bin/bash"              20 minutes ago      Up 20 minutes                                                          cli
22aba3071203        hyperledger/fabric-peer:latest                                                                         "peer node start"        20 minutes ago      Up 20 minutes       0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp     peer0.org1.example.com
77c763edc48c        hyperledger/fabric-peer:latest                                                                         "peer node start"        20 minutes ago      Up 20 minutes       0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp     peer0.org2.example.com
0704d6a22573        hyperledger/fabric-orderer:latest                                                                      "orderer"                20 minutes ago      Up 20 minutes       0.0.0.0:7050->7050/tcp                             orderer.example.com
252d050a8294        hyperledger/fabric-peer:latest                                                                         "peer node start"        20 minutes ago      Up 20 minutes       0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp   peer1.org2.example.com
ba81600b3a8c        hyperledger/fabric-peer:latest                                                                         "peer node start"        20 minutes ago      Up 20 minutes       0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp     peer1.org1.example.com

此外,不仅要在org1安装chaincode,也要在org2安装。因为链码定义org1和org2两个组织都背书才可提交,否则会报如下错误

root@a4207513da31:/opt/gopath/src/github.com/hyperledger/fabric/peer# 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 $CHANNEL_NAME -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"]}'
2019-01-21 07:55:05.156 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-01-21 07:55:05.170 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
Error: could not assemble transaction: ProposalResponsePayloads do not match - proposal response: version:1 response:<status:200 > payload:"\n \271d\360n\277\200S\302\004\363\250yVF\336F!Ul\3712\324\334\035\036\025\n\264\376\272\265\374\022Y\nE\022\024\n\004lscc\022\014\n\n\n\004mycc\022\002\010\003\022-\n\004mycc\022%\n\007\n\001a\022\002\010\003\n\007\n\001b\022\002\010\003\032\007\n\001a\032\00290\032\010\n\001b\032\003210\032\003\010\310\001\"\013\022\004mycc\032\0031.0" endorsement:<endorser:"\n\007Org1MSP\022\246\006-----BEGIN CERTIFICATE-----\nMIICJzCCAc6gAwIBAgIQW+yQgjWIwerZW4MHTBJ0dzAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xOTAxMjEwNzQ0MDBaFw0yOTAxMTgwNzQ0MDBa\nMGoxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMQ0wCwYDVQQLEwRwZWVyMR8wHQYDVQQDExZwZWVyMC5vcmcx\nLmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEVtuxUYYKZGCk\nE7n+mVb7Ct3GZCFl1fmbqk00EemcK1mwsk5EXoo7n7oS2tiQdA5w7oN4Ltevob2F\nrnznZSAKZ6NNMEswDgYDVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0j\nBCQwIoAgeaYMCJ/gSTQb2RJs4QN/4tu54DVGkN4aim0M/S9hWSEwCgYIKoZIzj0E\nAwIDRwAwRAIgfmcjYEd+axTlV7QGNO1w6D1f+8mLMtdTR+iFD2H3fSoCIGsRBTYq\nTFxmSCoU5ntYJQkmWS1AITt1M6QKtwCYU9oI\n-----END CERTIFICATE-----\n" signature:"0E\002!\000\216hT.\002\216\301\004r\377\302\206\235\343jz\215\255\302\333\263\003]\006s:\330\213\303@\276\245\002 \032\223R\302\240\303\311)fv`1\242<\255\233\224\350\206>\037?\300:\320DS= > 

在cli的bash窗口执行如下命令,再次invoke就正常。

CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp CORE_PEER_ADDRESS=peer0.org2.example.com:7051 CORE_PEER_LOCALMSPID="Org2MSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt peer chaincode install -n mycc -v 1.0 -p github.com/chaincode/chaincode_example02/go/

你可能感兴趣的:(hyperledger,fabric,centos7.4,fabric1.3.0)