Blockchain Explorer Fails to query installed chaincodes - Hyperledger Fabric - hyperledger-fabric

Connected the blockchain explorer (https://github.com/hyperledger/blockchain-explorer) to the Composer channel. All good for the most part, and I can browse and call API for blocks and transactions, however querying installed chaincodes fails. The stack is below. Any suggestions here? Much appreciated!
=====
Please open Internet explorer to access :http://localhost:4000/
[2017-11-19 10:50:07.735] [INFO] Helper - Successfully loaded member from persistence
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: chaincode error (status: 500, message: Authorization for GETINSTALLEDCHAINCODES on channel getinstalledchaincodes has been denied with error Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [This identity is not an admin])
at /Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/grpc/src/client.js:554:15
error: [Client.js]: Failed Installed Chaincodes Query. Error: Error: chaincode error (status: 500, message: Authorization for GETINSTALLEDCHAINCODES on channel getinstalledchaincodes has been denied with error Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [This identity is not an admin])
at /Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/grpc/src/client.js:554:15
[2017-11-19 10:50:07.764] [ERROR] Query - Error: chaincode error (status: 500, message: Authorization for GETINSTALLEDCHAINCODES on channel getinstalledchaincodes has been denied with error Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [This identity is not an admin])
at /Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/grpc/src/client.js:554:15
[2017-11-19 10:50:08.784] [ERROR] Query - TypeError: Cannot read property 'toArray' of null
at EC.sign (/Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/elliptic/lib/elliptic/ec/index.js:102:30)
at CryptoSuite_ECDSA_AES.sign (/Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:267:25)
at Signer.sign (/Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/fabric-client/lib/msp/identity.js:167:28)
at SigningIdentity.sign (/Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/fabric-client/lib/msp/identity.js:218:23)
at Object.module.exports.signProposal (/Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/fabric-client/lib/client-utils.js:116:28)
at Function.sendTransactionProposal (/Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/fabric-client/lib/Channel.js:1367:37)
at Client.queryInstalledChaincodes (/Users/andrei/Development/Zest/Blockchain/blockchain-explorer/node_modules/fabric-client/lib/Client.js:590:18)
at helper.getOrgAdmin.then (/Users/andrei/Development/Zest/Blockchain/blockchain-explorer/app/query.js:118:18)
at <anonymous>

I suspect this Fabric error is that the admin you're using is not recognized by your Fabric CA server (container): did you restart your CA server.
If installed on Linux or Mac (Windows not supported by Hyperledger Composer as yet FYI) - you could use a local Fabric Blockchain Explorer setup to query Composer business networks installed as follows:
eg (where channel name is composerchannel ):
curl -X GET "http://localhost:8080/apis/chaincodes?channel=composerchannel" -H "accept:application/json"
will return the current list of composer business networks installed on that channel.
or list of chaincodes deployed:
curl -X POST http://localhost:8080/chaincodelist -H 'cache-control: no-cache' -H 'content-type: application/json' -d ''

Related

hyperledger fabric No such file or directory when invoke chaincode by sdk-node

This is a tracing network with one channel composed of 3 Orgs, 1 anchor peer per organization, 1 MSP per org, and 1 CA for org3. And I'm not using TLS (because I couldn't find a dependable sample with TLS ON)
I'm trying to use Fabric-sdk-node to build a web front end for it, and I'm using fabcar sample. and when I use invoke.js (almost the same as the example), I find this.
root#oyu-virtual-machine:~/hyperledger-fabric/test/webapp# node get2.js
Wallet path: /root/hyperledger-fabric/test/webapp/wallet
2021-05-05T10:34:16.275Z - warn: [Query]: evaluate: Query ID "[object Object]" of peer "peer0.sell.trace.com" failed: message=cannot retrieve package for chaincode sellcc/1.0, error open /var/hyperledger/production/chaincodes/sellcc.1.0: no such file or directory, stack=Error: cannot retrieve package for chaincode sellcc/1.0, error open /var/hyperledger/production/chaincodes/sellcc.1.0: no such file or directory
at /root/hyperledger-fabric/test/webapp/node_modules/fabric-client/lib/Peer.js:144:36
at Object.onReceiveStatus (/root/hyperledger-fabric/test/webapp/node_modules/grpc/src/client_interceptors.js:1212:9)
at InterceptingListener._callNext (/root/hyperledger-fabric/test/webapp/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/root/hyperledger-fabric/test/webapp/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/root/hyperledger-fabric/test/webapp/node_modules/grpc/src/client_interceptors.js:847:24), status=500, , url=grpc://localhost:7051, name=peer0.sell.trace.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.sell.trace.com, request-timeout=3000000, isProposalResponse=true
Failed to evaluate transaction: Error: cannot retrieve package for chaincode sellcc/1.0, error open /var/hyperledger/production/chaincodes/sellcc.1.0: no such file or directory
In my opinion, the most important message is
error open /var/hyperledger/production/chaincodes/sellcc.1.0: no such file or directory
It once occurred when I forgot install other orgs' chaincodes on the SellOrg(InvokeChaincode API require), but I definitetly install it this time. I dont know what's going on.
I'm a very newbie in both fabric and nodejs, so any kind of help would be great. Thanks in advance.
Now I know where the problem is, all of my peers have the same addr of localhost:7051, and it link to another org's peer. The peer's name in the error message is completely wrong, it just show the name in my connection.json !

Channel creation failed. Problem with key group channel application

Couldn't create my channel and got following error:
2021-01-27 10:32:42.643 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'mychannel': error authorizing update: error validating ReadSet: proposed update requires that key [Group] /Channel/Application be at version 0, but it is currently at version 1
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
Any idea how to solve this error?
How can I change this key [Group] /Channel/Application version?
Make sure you are inside the test-network directory and run the following commands
source scriptUtils.sh
. scripts/envVar.sh
export FABRIC_CFG_PATH=$PWD/../config/
Now try to run the create channel command
Make sure you have configtx.yaml present inside config directory

Hyperledger Febric Error : Channel:mychannel received discovery error:access denied

I was trying to run fabric-samples/asset-transfer-basic/application-javascript/app.js file
but got discovery error.
It is showing discovery error after I gave command "node app.js"
Delete
user.id
appUser.id
identities from your /home/pritam/fabric-samples/asset-transfer-basic/application-javascript/wallet directory.
The error that occurred is already documented in the app.js file that exists under the asset-transfer-basic directory:
// NOTE: If you see kind an error like these:
/*
2020-08-07T20:23:17.590Z - error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:access denied
******** FAILED to run the application: Error: DiscoveryService: mychannel error: access denied
OR
Failed to register user : Error: fabric-ca request register failed with errors [[ { code: 20, message: 'Authentication failure' } ]]
******** FAILED to run the application: Error: Identity not found in wallet: appUser
*/
// Delete the /fabric-samples/asset-transfer-basic/application-javascript/wallet directory
// and retry this application.
//
// The certificate authority must have been restarted and the saved certificates for the
// admin and application user are not valid. Deleting the wallet store will force these to be reset
// with the new certificate authority.

unable to Instantiate any chaincodes on peers of newly Added org

I added org3 to existing network for balance transfer example once I added I am trying to install new chaincode on peers of org1 and org3 while instantiating I am getting this error
cannot get package for chaincode (marbles02:v0)
recoveryParam: 0 }
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: chaincode error (status: 500, message: cannot get package for chaincode (marbles02:v0))
at /home/ubuntu/fabric-samples/balance-transfer/node_modules/grpc/src/node/src/client.js:554:15
[2018-04-28 15:53:46.018] [INFO] instantiate-chaincode - instantiate proposal was good
[2018-04-28 15:53:46.018] [ERROR] instantiate-chaincode - instantiate proposal was bad
[2018-04-28 15:53:46.018] [DEBUG] instantiate-chaincode - Failed to send Proposal and receive all good ProposalResponse
[2018-04-28 15:53:46.019] [ERROR] instantiate-chaincode - Failed to instantiate. cause:Failed to send Proposal and receive all good ProposalResponse
I checked the peers whether the code is existing or not its there at this path
root#9a8377b5940d:/var/hyperledger/production/chaincodes# ls
fabcar.v0 marbles02.v0
this is the command I ran to instantiate version and cc name is unchanged
echo "POST instantiate chaincode on peer1 of Org3"
echo
curl -s -X POST \
http://localhost:4000/channels/mychannel/chaincodes \
-H "authorization: Bearer $ORG3_TOKEN" \
-H "content-type: application/json" \
-d "{
\"chaincodeName\":\"marbles02\",
\"chaincodeVersion\":\"v0\",
\"chaincodeType\": \"$LANGUAGE\",
\"args\":[]
}"
Seems like chaincode install may have been unsuccessful. Before instantiating in the channel through a peer, please make sure that chaincode installation was run on that peer and it completed successfully.
Install the chaincode with correct path (I recomend copying your chaincode to the path of artifacts/src/github inside the balance-transfer folder ) and do go build -o $chaincode_name from that path and try to instantiate the chaincode. It worked for me when I faced the same error.

Hyperledger Fabric Errror : Query - Error: chaincode error (status: 500, message: Failed to get block number 1, error Entry not found in index

I am trying to execute balance-transfer application that ship in fabric-samples of hyperledger. Source code path git clone https://github.com/hyperledger/fabric-samples.git
All steps executed as below
Channel created Joined channel on Org1
Joined channel on Org2
Successfully Installed chaincode on organization org1
Successfully Installed chaincode on organization org2
but instantiate of chaincode operation is failing on peers.
Can anyone please help me to solve this issue. I am struggling from last one week. I am using docker container on ubuntu v16.
Error Log:
[2017-10-02 05:11:11.374] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature {<br/>
r: <BN: 4824699f0a1d1a0fc696df545fb3379dffc6b46124619f53672359a6755bc7ff>,<br/>
s: <BN: 49fc91b2a7800eff5396053d4d8ff2683167a9e3f52ccc43228143f9b5741168>,<br/>
recoveryParam: 0 }
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: chaincode error (status: 500, message: Failed to get block number 1, error Entry not found in index)<br/>
at /home/02102017/fabric-samples/balance-transfer/node_modules/grpc/src/node/src/client.js:554:15<br/>
error: [Channel.js]: Failed Query block. Error: Error: chaincode error (status: 500, message: Failed to get block number 1, error Entry not found in index)<br/>
at /home/02102017/fabric-samples/balance-transfer/node_modules/grpc/src/node/src/client.js:554:15<br/>
[2017-10-02 05:11:11.472] [ERROR] Query - Error: chaincode error (status: 500, message: Failed to get block number 1, error Entry not found in index)<br/>
at /home/02102017/fabric-samples/balance-transfer/node_modules/grpc/src/node/src/client.js:554:15<br/>
Isssue resolve after increasing request-timeout in file fabric-samples-master/balance-transfer/node_modules/fabric-client/config/default.json
There is no need to overwrite fabric-samples-master/balance-transfer/node_modules/fabric-client/config/default.json. There is a open issue on JIRA https://jira.hyperledger.org/browse/FABN-884 regarding request timeout.
and For now as a workaround you could set it globally before making the call.
const temp = client.getConfigSetting('request-timeout');
client.setConfigSetting('request-timeout', 60000);
... make your call ...
client.setConfigSetting('request-timeout', temp);
Hope it will work for you.

Resources