Hyperledger Febric Error : Channel:mychannel received discovery error:access denied - hyperledger-fabric

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.

Related

Error while running invoke.js in ibm blockchain platform using vscode?

I have been using IBM blockchain platform using vs code. Everything is working fine, I can connect to fabric local, but the main problem is while I run invoke.js
Connected to Fabric gateway.
2019-10-24T03:40:03.358Z - error: [Channel.js]: Channel:mychannel received discovery error:access denied
2019-10-24T03:40:03.358Z - error: [Channel.js]: Error: Channel:mychannel Discovery error:access denied
2019-10-24T03:40:03.358Z - error: [Network]: _initializeInternalChannel: Unable to initialize channel. Attempted to contact 1 Peers. Last error was Error: Channel:mychannel Discovery error:access denied
Error processing transaction. Error: Unable to initialize channel. Attempted to contact 1 Peers. Last error was Error: Channel:mychannel Discovery error:access denied
Error: Unable to initialize channel. Attempted to contact 1 Peers. Last error was Error: Channel:mychannel Discovery error:access denied
at Network._initializeInternalChannel (/home/cybrosys/VSCodeLocalNetwork/node_modules/fabric-network/lib/network.js:112:12)
Disconnect from Fabric gateway.
done

Hyperledger fabric Error : mychannel received discovery error:access denied

Getting the following error while running query.js of the fabric sample fabcar.
root#ubcourt:/home/fabric-samples/fabcar/javascript# node query.js
Wallet path: /home/fabric-samples/fabcar/javascript/wallet
2019-08-03T08:45:31.027Z - error: [Channel.js]: Channel:mychannel received discovery error:access denied
2019-08-03T08:45:31.028Z - error: [Channel.js]: Error: Channel:mychannel Discovery error:access denied
2019-08-03T08:45:31.040Z - error: [Channel.js]: Channel:mychannel received discovery error:access denied
2019-08-03T08:45:31.040Z - error: [Channel.js]: Error: Channel:mychannel Discovery error:access denied
First, delete files inside the wallet directory:
sudo rm -r * // inside wallet directory
node enrollAdmin.js && node registerUser.js
node query.js // you will get output
Did you follow the register and enroll step ?
node enrollAdmin.js && node registerUser.js && node query.js
If yes :
First delete the folder wallet.
In fabcar directory run : ./startFabric.sh javascript
Repeat the register and enroll step: node enrollAdmin.js && node registerUser.js && node query.js
Make sure you have "mychannel" channel in network.
Just delete the ./wallet directory and execute app.js again.
1) Check whether you have executed the "node enrollAdmin.js" and "node registerUser.js" files.
2) Then check the wallet folder inside the directory "/fabric-samples/fabcar/javascript" if it contains 2 files "admin.id" and "user1.id".
3) Then just delete that 2 files and perform the 2 above mentioned file execution again. Then the error will be solved.
I solved the problem: Error message: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:access denied.
By fixing the chaincodeName and channelName values to be the correct values...
This can also happen when the peer leaves the channel or some error related to it.
Try to list the peers that are in the channel and see if yours is there,
peer channel list
If your channel is not listed, add again
peer join channel -b .block
here .block is you genesis block

Composer rest server multiuser: Error trying to login and get user Context

I did the following tutorial: https://www.codementor.io/gangachris125/passport-jwt-authentication-for-hyperledger-composer-rest-server-jqfgkoljn
Now I completed everything and I imported a user card into the wallet. But now when I try to make a API request to an endpoint, I get this output:
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Error trying login and get user Context. Error: Error trying to enroll user. Error: Enrollment failed with errors [[{\"code\":20,\"message\":\"Authorization failure\"}]]",
"stack": "Error: Error trying login and get user Context. Error: Error trying to enroll user. Error: Enrollment failed with errors [[{\"code\":20,\"message\":\"Authorization failure\"}]]\n at HLFConnection.login (/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:477:30)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:189:7)"
}
}
Already searched for a solution but couldn't find anyone.
My solution was:
1) export the card
composer card export -c admin#network -f admin-plus-cert.card
2) delete the old card
composer card delete -c admin#network
3) import the new card
composer card import -f admin-plus-cert.card

Blockchain Explorer Fails to query installed chaincodes - 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 ''

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