Hyperledger Composer Error Identity has not been registered once issued - hyperledger-fabric

I have been following this Tutorial and I am able to complete it. I issue a new identity, to an existing participant and I create a business card for this identity with the following command:
composer identity issue --card admin#tutorial-network -f usr001#tutorial-network.card -u usr001 -a "resource:org.acme.biznet.Trader#usr001" -x true
Then, I import that business card via POST /wallet/import and I am able to call different REST API operations. After that, I stop the composer-rest-server and after a few minutes I start the composer-rest-server again with the command composer-rest-server -c admin#tutorial-network -m true -a true
Then, I authenticate to the REST API using the configured authentication mechanism (in this case passport-github strategy) and if I try to call one operation fro REST API it throws a A business network card has not been specified error message, then I import the previous business card via POST /wallet/import getting a no content which is supposed to be correct.
Finally, when I try to call another REST API operation I get the following error:
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity has not been registered: usr001)",
"stack": "Error: Error trying to ping. Error: Error trying to query business network. Error: chaincode error (status: 500, message: Error: The current identity has not been registered: usr001)\n at _checkRuntimeVersions.then.catch (/home/username/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:679:34)\n at <anonymous>"
}
}
This is the main issue, I don't know why my identity is not being recongized by the REST API if I used it previously to call some operations.

the problem is one of persistence as captured here -> https://hyperledger.github.io/composer/v0.16/integrating/enabling-multiuser.html and the link for persisting identities (ie instructions) is captured here -> https://hyperledger.github.io/composer/v0.16/integrating/deploying-the-rest-server.html
All user information is persisted in a LoopBack data source by using a LoopBack connector. By default, the REST server uses the LoopBack "memory" connector to persist user information, which is lost when the REST server is terminated. The REST server should be configured with a LoopBack connector that stores data in a highly available data source, for example a database.

Related

Access forbidden, contact your app developer or support#rpcpool.com on metaplex candymachine?

I deployed an nft collection on solana using metaplex and candymachine. It was working fine for 4-5 days now suddenly I am receiving this error. I was able to connect wallet and mint fine for a couple of days. I am not sure what's wrong now what I am getting 403 from rpc pool?
Uncaught (in promise) Error: failed to get balance of account
: Error: 403 Forbidden: {"jsonrpc":"2.0","error":{"code":
403, "message":"Access forbidden, contact your app developer or
support#rpcpool.com."}, "id": "" }
So Metaplex and NFT calls are not allowed on the free RPCs. You'll have to use a paid provider or go with https://api.metaplex.solana.com/
If you're doing any sort of NFT drop, it is still recommended to get a paid RPC.
You shouldn't have to re-upload again, as long as you did successfully on the other RPC.

Failing to enroll new user in Hyperledger Fabric

I am trying to modify the balance-transfer example of hyperledger fabric to use with different org and domain instead of Org1.example.com. but when trying to enroll new user I am getting below error.
Failed to get registered user: Jim with error: Error: Enrollment
failed with errors [[{"code":20,"message":"Authentication failure"}]]
when checked the ca docker logs it shows below error.
POST /api/v1/enroll 401 23 "Failed to get user: : scode: 404, code:
63, msg: Failed to get User: sql: no rows in result set".
I had a similar problem that I fixed by going back to the config.json and undoing some of the changes I had made. Specifically keeping "Org1": and "Org2": instead of replacing them with my specific organization names.

while running Hyperldger Query from multi user rest server It gives error "Invalid or extraneous parameter access_token has been specified"

I am using a multi user rest server with ldap based authentication on. I can successfully login , get an access token and perform any number of transactions. Chaincode running for this transaction can also run the queries generate by me. But the issue is I am not able t run this queries directly from my Web browser while using same access token. I am facing this error which says that access_token is invalid or extraneous parameter while running query. But when I try to run query without access token it gives me error as "AUTHORIZATION_REQUIRED" Which as per my understanding is okay. Also this queries are running fine in single user rest server.
Do i need to perform something different while running queries using multi user rest server with access token generated from LDAP.
"{"error":{"statusCode":500,"name":"Error","message":"2 UNKNOWN: error
executing chaincode: transaction returned with failure: Error: Invalid
or extraneous parameter access_token has been
specified","code":2,"metadata":{"_internal_repr":{}},"details":"error
executing chaincode: transaction returned with failure: Error: Invalid
or extraneous parameter access_token has been
specified","stack":"Error: 2 UNKNOWN: error executing chaincode:
transaction returned with failure: Error: Invalid or extraneous
parameter access_token has been specified\n at new
createStatusError
(/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/grpc/src/client.js:64:15)\n at
/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/grpc/src/client.js:583:15"}}"
Actually We have made some changes to make it work actually issue is with the way we were passing the access token. In hyperledger Documents there are 2 ways through which we can pass token :
curl -v http://localhost:3000/api/system/ping?access_token=xxxxx
curl -v -H 'X-Access-Token: xxxxx' http://localhost:3000/api/system/ping
I was using the 1st method to pass access token and all my transactions were working fine but query failed seems access token was passed on to query and it was not able to identify parameter. So I tried second way and was able to run the query. I Suppose Hyperleder forums should mention such limitations.

Hyperledger Fabric - Lost my network card, how to export it again?

I have setup a dev hyperledger fabric blockchain successfully and added an user/participant to the network. Execute the operations again and the blockchain all worked fine with using the card that was generated initially. But now, I have lost this card, can I export/download it again? I tried using identity "revoke" api, but it is failing with this error -
Error: Error trying invoke business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN: error executing chaincode: transaction returned with failure: Error: attempt to get property state on an InvalidRelationship is not allowed. InvalidRelationship created due to Object with ID 'partcipant_1' in collection with ID 'Asset:org.hyperledger.composer.system.Identity' does not exist
I am not exactly sure what you mean when you say you "lost" the card.
The process goes like this:
you have an admin user with full rights to the network and an admin card to connect with, using this admin
you request a new identity, this gives you the required certificates, both public and private
you create a network card for this new identity using the certificates. This results in a physical .card file on disk
you import the physical file and you have a properly registered card and can now interact with the ledger, using this new identity.
if anything happens to the card itself, ie you deleted the registered card and got rid of the file as well, then you need to go through the process and recreate the card from scratch.
your commands could look like this:
composer identity request -c PeerAdmin#hlfv1 -u admin -s adminpw -d alice
this requests everything for a new user called alice, using the peer admin card which is created against the original network admin
composer card create -p your_connection.json -u alice -n your-network -c alice/admin-pub.pem -k alice/admin-priv.pem
this creates the card file
composer card import -f alice#your-network.card
this imports the card
composer network ping -c alice#your-network
check everything works
so, if you no longer have a registered card, you should still have the .card file and if you have that you can simply import it again.
if you don't have the .card file either, you should still have the certificates for "alice" and should be able to create the .card file
if you don't have the certs either then request them again ( I've never tried this particular scenario so we need to see what happens in that case )

Use non-admin card with composer-rest-server in hyperledger fabric

I am not able to start a composer-rest-server without a network admin card.
When I tried a normal user card, it generates the following error:
Connection fails: Error: 2 UNKNOWN: error executing chaincode:
transaction returned with failure:
AccessException: Participant 'com.tuzz.agloan.Dccb#dccb1' does not have 'READ' access to resource 'org.hyperledger.composer.system.Network#aloan#0.0.2-deploy.17'
You can try adding a rule that gives the participant access to the network.
in .acl file, add this rule then update the network and start the REST server
rule Rule1 {
description: "Grant access to the network"
participant: "com.tuzz.agloan.Dccb"
operation: READ
resource: "org.hyperledger.composer.system.Network"
action: ALLOW
}
For more details, you can refer Granting network access control section in ACL reference

Resources