'Hyperledger fabric nodejs chaincode - devMode
I am following the below link which outlines a GO example and runs fine, I am trying to alter it to run a nodejs smart contract.
https://hyperledger-fabric.readthedocs.io/en/latest/peer-chaincode-devmode.html#build-the-chaincode
For GO - works fine
go build -o simpleChaincode ./integration/chaincode/simple/cmd
CORE_CHAINCODE_LOGLEVEL=debug CORE_PEER_TLS_ENABLED=false CORE_CHAINCODE_ID_NAME=mycc:1.0 ./simpleChaincode -peer.address 127.0.0.1:7052
For Nodejs
cd ./chaincode/asset-transfer-basic/chaincode-typescript
CORE_CHAINCODE_LOGLEVEL=debug CORE_PEER_TLS_ENABLED=false CORE_CHAINCODE_ID_NAME=$CORE_CHAINCODE_ID_NAME npm run start:server-debug -peer.address 127.0.0.1:7052
For Nodejs - in the peer logs
# 2022-04-05 16:30:56.427 PDT 013b DEBU [chaincode] CheckInvocation -> [0cda8fd8] getting chaincode data for cscc on channel
# 2022-04-05 16:30:56.427 PDT 013c DEBU [chaincode] Execute -> Entry
# 2022-04-05 16:30:56.428 PDT 013d INFO [ledgermgmt] CreateLedger -> Creating ledger [ch1] with genesis block
# 2022-04-05 16:30:56.429 PDT 013e DEBU [chaincode] handleMessage -> [0cda8fd8] Fabric side handling ChaincodeMessage of type: COMPLETED in state ready
# 2022-04-05 16:30:56.429 PDT 013f DEBU [chaincode] Notify -> [0cda8fd8] notifying Txid:0cda8fd80e6b204e45bfc10716924e689da5a2e50fc5c03de36692e3845a22a9, channelID:
# 2022-04-05 16:30:56.429 PDT 0140 DEBU [chaincode] Execute -> Exit
# 2022-04-05 16:30:56.429 PDT 0141 INFO [endorser] callChaincode -> finished chaincode: cscc duration: 1ms channel= txID=0cda8fd8
# 2022-04-05 16:30:56.429 PDT 0142 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=127.0.0.1:55599 grpc.code=OK grpc.call_duration=1.393458ms
Below messages for Peer are listed in GO but not in NodeJS
# 2022-04-05 16:30:56.822 PDT 0143 DEBU [chaincode] handleMessage -> [] Fabric side handling ChaincodeMessage of type: REGISTER in state created
# 2022-04-05 16:30:56.822 PDT 0144 DEBU [chaincode] HandleRegister -> Received REGISTER in state created
# 2022-04-05 16:30:56.822 PDT 0145 DEBU [chaincode] Register -> registered handler complete for chaincode mycc:1.0
# 2022-04-05 16:30:56.822 PDT 0146 DEBU [chaincode] HandleRegister -> Got REGISTER for chaincodeID = mycc:1.0, sending back REGISTERED
# 2022-04-05 16:30:56.822 PDT 0147 DEBU [chaincode] HandleRegister -> Changed state to established for mycc:1.0
# 2022-04-05 16:30:56.822 PDT 0148 DEBU [chaincode] sendReady -> sending READY for chaincode mycc:1.0
# 2022-04-05 16:30:56.822 PDT 0149 DEBU [chaincode] sendReady -> Changed to state ready for chaincode mycc:1.0
When I try to invoke the Nodejs chaincode
CORE_PEER_ADDRESS=127.0.0.1:7051 peer chaincode invoke -o 127.0.0.1:7050 -C ch1 -n $CC_NAME -c '{"Args":["InitLedger"]}' --isInit
I receive the below error which indicates that the peer is expecting the chaincode to installed in peer, but for devmode it should happen automatically.
Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction edd6e811393cf4938a02b8d7773be85e57b5053ab5bfb2b38c06e8f88044d340: could not launch chaincode mycc-node:1.0: error building chaincode: error building image: failed to get chaincode package for external build: could not get legacy chaincode package 'mycc-node:1.0': open /var/hyperledger/production/chaincodes/mycc-node.1.0: no such file or directory"
Any suggestions or guidance will be greatly appreciated.
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
