我遵循了商业票据的文档,但是停留在实例化上。
我使用了Fabric 1.4,尝试在线搜索,但没有发现任何人遇到问题,这可能与 Error: ["Missing contract org.hyperledger.fabric in metadata"]
Error: ["Missing contract org.hyperledger.fabric in metadata"]
当我跑步
docker exec cliMagnetoCorp peer chaincode instantiate -n papercontract -v 0 -l node -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' -C mychannel -P "AND ('Org1MSP.member')"
我懂了:
2019-04-25 16:11:24.620 UTC [chaincodeCmd] InitCmdFactory -> INFO 001 Get chain(mychannel) orderer endpoint: orderer.example.com:7050 2019-04-25 16:11:24.622 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default escc 2019-04-25 16:11:24.623 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default vscc Error: Error endorsing chaincode: rpc error: code = Unknown desc = timeout expired while starting chaincode papercontract:0(networkid:dev,peerid:peer0.org1.example.com,tx:b72dd3f848069660d7cf8c783008c2d8896ff4d4329eecfc8e2405966d0bff10)
码头工人ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 94678322b1d2 hyperledger/fabric-tools "/bin/bash" 19 minutes ago Up 19 minutes cliMagnetoCorp 3083be9ec849 gliderlabs/logspout "/bin/logspout" 20 minutes ago Up 20 minutes 127.0.0.1:8000->80/tcp logspout 3380437d78dd hyperledger/fabric-peer "peer node start" 21 minutes ago Up 21 minutes 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com b4ecdd45d01a hyperledger/fabric-couchdb "tini -- /docker-ent…" 21 minutes ago Up 21 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb cccf5c6bd853 hyperledger/fabric-ca "sh -c 'fabric-ca-se…" 21 minutes ago Up 21 minutes 0.0.0.0:7054->7054/tcp ca.example.com e8a5a59682b1 hyperledger/fabric-orderer "orderer" 21 minutes ago Up 21 minutes 0.0.0.0:7050->7050/tcp orderer.example.com
并从logspout记录日志:
dev-peer0.org1.example.com-papercontract-0|> papercontract@0.0.3 start /usr/local/src dev-peer0.org1.example.com-papercontract-0|> fabric-chaincode-node start "--peer.address" "peer0.org1.example.com:7052" dev-peer0.org1.example.com-papercontract-0| dev-peer0.org1.example.com-papercontract-0|schema $id ignored http://json-schema.org/draft-07/schema# dev-peer0.org1.example.com-papercontract-0|schema $id ignored http://json-schema.org/draft-07/schema# dev-peer0.org1.example.com-papercontract-0|schema $id ignored http://json-schema.org/draft-07/schema# dev-peer0.org1.example.com-papercontract-0|2019-04-25T16:11:26.667Z info [contracts-spi/bootstrap.js] info: Metadata validated against schema correctly {"timestamp":"2019-04-25T16:11:26.667Z"} dev-peer0.org1.example.com-papercontract-0|2019-04-25T16:11:26.668Z info [contracts-spi/bootstrap.js] info: Metadata file has been located {"timestamp":"2019-04-25T16:11:26.668Z"} dev-peer0.org1.example.com-papercontract-0|2019-04-25T16:11:26.669Z info [contracts-spi/chaincodefromcontract.js] info: Using serializers {"transaction":"jsonSerializer","serializers":{},"timestamp":"2019-04-25T16:11:26.669Z"} dev-peer0.org1.example.com-papercontract-0|fabric-chaincode-node start --peer.address localhost:7051 --chaincode-id-name mycc dev-peer0.org1.example.com-papercontract-0| dev-peer0.org1.example.com-papercontract-0|Options: dev-peer0.org1.example.com-papercontract-0| --help Show help [boolean] dev-peer0.org1.example.com-papercontract-0| -v, --version Show version number [boolean] dev-peer0.org1.example.com-papercontract-0| --peer.address [string] [required] dev-peer0.org1.example.com-papercontract-0| --grpc.max_send_message_length [number] [default: -1] dev-peer0.org1.example.com-papercontract-0| --grpc.max_receive_message_length [number] [default: -1] dev-peer0.org1.example.com-papercontract-0| --grpc.keepalive_time_ms [number] [default: 110000] dev-peer0.org1.example.com-papercontract-0| --grpc.http2.min_time_between_pings_ms [number] [default: 110000] dev-peer0.org1.example.com-papercontract-0| --grpc.keepalive_timeout_ms [number] [default: 20000] dev-peer0.org1.example.com-papercontract-0| --grpc.http2.max_pings_without_data [number] [default: 0] dev-peer0.org1.example.com-papercontract-0| --grpc.keepalive_permit_without_calls [number] [default: 1] dev-peer0.org1.example.com-papercontract-0| --ssl-target-name-override [string] dev-peer0.org1.example.com-papercontract-0| --chaincode-id-name [string] [required] dev-peer0.org1.example.com-papercontract-0| --module-path [string] [default: "/usr/local/src"] dev-peer0.org1.example.com-papercontract-0| dev-peer0.org1.example.com-papercontract-0|Error: ["Missing contract org.hyperledger.fabric in metadata"] dev-peer0.org1.example.com-papercontract-0| at new ChaincodeFromContract (/usr/local/src/node_modules/fabric-shim/lib/contract-spi/chaincodefromcontract.js:63:19) dev-peer0.org1.example.com-papercontract-0| at Function.register (/usr/local/src/node_modules/fabric-shim/lib/contract-spi/bootstrap.js:35:27) dev-peer0.org1.example.com-papercontract-0| at Function.bootstrap (/usr/local/src/node_modules/fabric-shim/lib/contract-spi/bootstrap.js:49:19) dev-peer0.org1.example.com-papercontract-0| at <anonymous> dev-peer0.org1.example.com-papercontract-0|npm ERR! code ELIFECYCLE dev-peer0.org1.example.com-papercontract-0|npm ERR! errno 1 dev-peer0.org1.example.com-papercontract-0|npm ERR! papercontract@0.0.3 start: `fabric-chaincode-node start "--peer.address" "peer0.org1.example.com:7052"` dev-peer0.org1.example.com-papercontract-0|npm ERR! Exit status 1 dev-peer0.org1.example.com-papercontract-0|npm ERR! dev-peer0.org1.example.com-papercontract-0|npm ERR! Failed at the papercontract@0.0.3 start script. dev-peer0.org1.example.com-papercontract-0|npm ERR! This is probably not a problem with npm. There is likely additional logging output above. dev-peer0.org1.example.com-papercontract-0| dev-peer0.org1.example.com-papercontract-0|npm ERR! A complete log of this run can be found in: dev-peer0.org1.example.com-papercontract-0|npm ERR! /root/.npm/_logs/2019-04-25T16_11_26_714Z-debug.log peer0.org1.example.com|2019-04-25 16:16:24.311 UTC [chaincode] Launch -> ERRO 03b launchAndWaitForRegister failed: timeout expired while starting chaincode papercontract:0(networkid:dev,peerid:peer0.org1.example.com,tx:b72dd3f848069660d7cf8c783008c2d8896ff4d4329eecfc8e2405966d0bff10) orderer.example.com|2019-04-25 16:16:24.312 UTC [orderer/common/broadcast] Handle -> WARN 019 Error reading from 172.21.0.7:34890: rpc error: code = Canceled desc = context canceled peer0.org1.example.com|github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).launchAndWaitForRegister peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:579 peer0.org1.example.com|github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Launch peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:741 peer0.org1.example.com|github.com/hyperledger/fabric/core/chaincode.Execute peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/exectransaction.go:45 peer0.org1.example.com|github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:152 peer0.org1.example.com|github.com/hyperledger/fabric/core/endorser.(*Endorser).simulateProposal peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:262 peer0.org1.example.com|github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:477 peer0.org1.example.com|github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:31 peer0.org1.example.com|github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:112 peer0.org1.example.com|github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:781 peer0.org1.example.com|github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:981 peer0.org1.example.com|github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1 peer0.org1.example.com| /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:551 peer0.org1.example.com|runtime.goexit peer0.org1.example.com| /opt/go/src/runtime/asm_amd64.s:2337
在解决https://jira.hyperledger.org/browse/FAB-15287之前,目前的解决方法是修改magnetocorp / contract和digibank / contract目录中的package.json文件。查找条目
"dependencies" : { "fabric-contract-api" : "~1.4.0", "fabric-shim": "~1.4.0" },
并~从版本号中删除(tilda),即
~
"dependencies" : { "fabric-contract-api" : "1.4.0", "fabric-shim": "1.4.0" },
这应该将其还原为使用1.4.0而不是1.4.1,在撰写本文时,它是当前的1.4版本,该示例应该可以使用。