walton-blockchain-institute-2nd-term / hyperledger

0 stars 1 forks source link

Hyperledger Fabric query.js ; Failed to evaluate transaction: Error: #3

Closed infiduk closed 5 years ago

infiduk commented 5 years ago

image

Wallet path: /home/bstudent/fabric-samples/my-network/application/wallet
2019-07-23T08:43:29.581Z - warn: [Query]: evaluate: Query ID "[object Object]" of peer "peer0.org1.example.com" failed: message=make sure the chaincode mycc_ex has been successfully instantiated and try again: chaincode mycc_ex not found, stack=Error: make sure the chaincode mycc_ex has been successfully instantiated and try again: chaincode mycc_ex not found
    at self._endorserClient.processProposal (/home/bstudent/fabric-samples/my-network/application/node_modules/fabric-client/lib/Peer.js:140:36)
    at Object.onReceiveStatus (/home/bstudent/fabric-samples/my-network/application/node_modules/grpc/src/client_interceptors.js:1207:9)
    at InterceptingListener._callNext (/home/bstudent/fabric-samples/my-network/application/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/home/bstudent/fabric-samples/my-network/application/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/home/bstudent/fabric-samples/my-network/application/node_modules/grpc/src/client_interceptors.js:845:24), status=500, , url=grpc://localhost:7051, name=peer0.org1.example.com, grpc.max_receive_message_length=-1, grpc.max_send_message_length=-1, grpc.keepalive_time_ms=120000, grpc.http2.min_time_between_pings_ms=120000, grpc.keepalive_timeout_ms=20000, grpc.http2.max_pings_without_data=0, grpc.keepalive_permit_without_calls=1, name=peer0.org1.example.com, request-timeout=300000, isProposalResponse=true
Failed to evaluate transaction: Error: make sure the chaincode mycc_ex has been successfully instantiated and try again: chaincode mycc_ex not found

node query.js 가 또...

infiduk commented 5 years ago

chaincode 배포.. peer chaincode install.. instantiate..하셨나요?

docker exec -it cli bash
peer chaincode list --installed

위 명령어 돌리시면 아마 아무것도 안 나올거예요. 아무것도 안 나온다는건 peer가 설치한 chaincode가 없다는 뜻 입니다.

(우리 프로젝트 기준) peer chaincode install -n mycc_ex -v 1.1 -p github.com/
(기본 형식) peer chaincode install -n 'chaincode 명' -v '버전' -p '경로'

chaincode를 install 해줍니다.

(우리 프로젝트 기준) peer chaincode instantiate -n mycc_ex -v 1.1 -C mychannel -c '{"Args":["a", "100"]}' -P 'OR ("Org1MSP.member")'
(기본 형식) peer chaincode instantiate -n 'chaincode 명' -v '버전' -C '채널 명' -c 'chaincode안의 init 함수가 실행될 때(즉, chaincode가 배포될 때) 필요한 args들..' -P '배포 시 policy'

위 명령어는 chaincode를 instantiate(배포)하는 명령어 입니다.

peer chaincode list --installed

그리고 다시 설치된 리스트를 보는 명령어를 입력해주면? 리스트가 뜹니다!

exit

밖으로 나오셔서 다시 node query.js를 실행하시면 에러 해 결