The current identity has not been registered: - hyperledger-fabric

I have successfully issued, imported and pinged a card on Hyperledger composer 0.16.0. However, when I try to execute transactions with the created identity, I get the following errors
"Error trying invoke business network. Error: No valid responses from any peers.\nResponse from attempted peer comms was an error: Error: chaincode error (status: 500, message: Error: The current identity has not been registered: roger)\n"
I am not sure whether I should now 'bind' the identity to a participant as demonstrated here. I did try this but there is a required certificate file --certificateFile which I am not sure where to find. Preliminary checks on .composer folder in my home directory indicate that I have a xxxx-pub and xxxx-priv file on the card details in client-data subdirectory. Would this xxxx-pub act as the required certificate?
Anyway, that was just my attempt at finding the solution but I would really appreciate if anyone could help me resolve the The current identity has not been registered: roger error.

Ok. I tried with the xxxx-pub file and it worked. So use -e /path/to/file/xxxx-pub in the composer identity bind command.

Related

Why can't I commit transactions with Caliper to Hyperledger Fabric?

I've got Caliper configured as a subtree of my custom Fabric blockchain. I have it configured correctly in order to connect the network and am running a small set of tests at the moment. The arguments I'm providing are absolutely correct in terms of the custom chaincode being run, but whenever I try to create a transaction via Caliper I get the error:
Failed to perform submit transaction [CreateAsset] using arguments [<ARGS>], with error: TypeError: Cannot read property 'status' of undefined
Anybody encountered this before with Caliper V0.4.2? It's interfacing with a Fabric 2.3.3 instance on local machine via Kubernetes, with the latest SDK bound.
The error occurs on line 237 of transactions.js inside the node_module fabric-network, where there is a strict property comparison on a commit object.
Also it's worth noting that the querying part of my test rounds is yielding expected results... none of those assets get created due to the error thrown, and when querying for a given asset an error like so occurs:
Failed to perform query transaction [ReadAsset] using arguments [<ID>], with error: Error: error in simulation: transaction returned with failure: Error: The asset <ID> does not exist
The closest thing I've been able to find is this ~2 year old issue which isn't exactly what I'm facing but it's the same sort of error at least... any help or pointers would be greatly appreciated because I'm struggling to glean useful information. (Link: https://github.com/hyperledger/caliper/issues/727)
The issue was due to the host names being converted to localhost when you want to work anything except a network running locally via docker. You need to launch caliper with the following extra option
--caliper-fabric-gateway-localhost false

Chaincode Deployment Failed

I am new to Hyperledger fabric. When I am trying to install the Chaincode, I am getting the below error :
Error: proposal failed with status: 500 - failed to invoke backing implementation of 'ApproveChaincodeDefinitionForMyOrg': attempted to redefine uncommitted sequence (1) for namespace marbles03 with unchanged content
Please shed a light on this.
Thank you
After doing some Googling, I found Nikhil Gupta's answer on the hyperledger.org site to be helpful.
This message states that you have already approved the chaincode definition as this org. The chaincode definition with sequence 1 has already been defined for that organization, and you cannot define the same sequence again.
Assuming that you are executing the peer lifecycle chaincode approvemyorg command, you have already approved the chaincode definition with sequence 1, and you cannot redefine it for this organization.

Problem with Wallet Creation, signature error

I want to create a wallet for new rest api server, but whenever I call code to generate new Wallet I'm getting error like
"Decoding SignatureHeader failed: Error illegal buffer ..."
Here is screen shot of my code, it is taken from virtual machine
I'm using hyperledger fabric 2.2 and run under the fabric-samples/test-network
I was clone this HyperledgerFabroc
Here is also print screen of the error:
I would appreciate if someone can navigate me how to manage successfully to create a wallet ?
Your error looks to be occurring within a chaincode transaction function. You should not be using the client SDK to do a transaction invocation from within chaincode. Instead look to use the invokeChaincode function on the stub:
https://hyperledger.github.io/fabric-chaincode-node/release-1.4/api/fabric-shim.ChaincodeStub.html#invokeChaincode

Hyperledger Fabric: Channel configuration has no channels defined

I got to the project that is based on BYFN sample, but limited to one organization only.
In the app when I call following code:
private Contract getContract(Gateway gw) {
return gw.getNetwork("mychannel").getContract("realchain");
}
following error is produced:
2019-10-30 09:34:51.433 INFO 23108 --- [nio-8080-exec-3] org.hyperledger.fabric.gateway.Gateway : Unable to load channel configuration from connection profile:
org.hyperledger.fabric.sdk.exception.NetworkConfigurationException: Channel configuration has no channels defined.
at org.hyperledger.fabric.sdk.NetworkConfig.loadChannel(NetworkConfig.java:519) ~[fabric-sdk-java-1.4.5-20190620.151745-1.jar:na]
at org.hyperledger.fabric.sdk.HFClient.loadChannelFromConfig(HFClient.java:161) ~[fabric-sdk-java-1.4.5-20190620.151745-1.jar:na]
at org.hyperledger.fabric.gateway.impl.GatewayImpl.getNetwork(GatewayImpl.java:258) ~[fabric-gateway-java-1.4.0-20191002.055106-31.jar:na]
...
...the app recovers somehow itself, but I suspect this error to slow down the whole interaction with the ledger.
Also I'd love to keep my logs clean from any exceptions if possible.
Anyone encountered and resolved the same error?
That is normal behaviour. If the connection profile does not contain a channel definition then the client uses peer definitions (currently for your client identity's organisation only) and assumes the channel exists for those peers. It should not impact performance at all.
You have the option of adding a channel definition to the connection profile, which will avoid this log message occurring, but we wanted to avoid this being necessary.
I agree that the exception appearing in the log gives the false impression that a real error has occurred and I have removed that in the current development code.

Hyperledger fabric 1.2 service discovery error

I use Hyperledger Fabric 1.2 to build a blockchain cluster, which contains 3 peers and 3 orderers. I can successfully deploy and invoke the chaincode via both CLI and Java SDK. Everything works fine. However, when I notice the service discovery function and try to use it, I met two problems. First, after I build the discover tool and try to use it to get some discovered information, I can't access the peer and get the message as follow
"failed connecting to discovery service: failed to create new
connection: context deadline exceeded"
The config command is
discover --configFile conf.yaml --userKey ./crypto-config/peerOrganizations/org1.forchain.com/peers/peer0.org1.forchain.com/msp/keystore/7458b29b1fb6a89768585430dbf0e522a40ff4aefe600fc1e4fafe62c3c972e4_sk --userCert ./crypto-config/peerOrganizations/org1.forchain.com/peers/peer0.org1.forchain.com/msp/signcerts/peer0.org1.forchain.com-cert.pem --MSP Org1MSP saveConfig
The query command is
discover --configFile conf.yaml peers --channel lajiao --server localhost:6051
I guess it may be caused by the TLS config so I canceled the TLS and tried again. This time I successfully access the peer and get some messages, but I met another problem. When I use 'discover peers xxx ' command, I always get null result, in fact there are two peers in that channel. When I use 'discover endorsers xxx' command, I always get the following error message
'failed constructing descriptor for chaincodes:'
In the meantime, the peer log outputs the following message:
'Principal set computation failed: chaincode isn't installed on
sufficient organizations required by the endorsement policy 2018-08-01
10:21:50.860 UTC [discovery] chaincodeQuery -> ERRO 1441 Failed
constructing descriptor for chaincode chaincodes:
,: chaincode isn't installed on sufficient organizations required by
the endorsement policy'
I can assure that the chaincode is successfully installed in all peers. And I didn't use the endorsement policy when I instantiated the chaincode. I think it is not the policy problem because I still can invoke the chaincode and propose a transaction.
I also tried to use the Java SDK and found that I can get the orderer nodes info but I can't get the other peer nodes or chaincode info. The log always output: "Discover of chaincode names was empty.". But the chaincode is definitely instantiated and can be invoke via SDK. I refered to the test code in "org.hyperledger.fabric.sdkintegration.ServiceDiscoveryIT" and some key Java code is as follow:
channel.addPeer(peer, createPeerOptions().setPeerRoles(EnumSet.of(Peer.PeerRole.SERVICE_DISCOVERY,Peer.PeerRole.LEDGER_QUERY, Peer.PeerRole.EVENT_SOURCE,Peer.PeerRole.CHAINCODE_QUERY)));
channel.initialize();
System.out.println("================ orderer ===============");
for (Orderer orderer : channel.getOrderers()) {
System.out.println(orderer.getName());
}
System.out.println("================ peer ===============");
for (Peer p: channel.getPeers()) {
System.out.println(p.getName());
}
System.out.println("================ chaincode ===============");
for (String s: channel.getDiscoveredChaincodeNames()) {
System.out.println(s);
}
So, how can I use the 'discover' command under TLS configuration and how can I get the discovered information?
For the config command - you need to pass a TLS root CA, via --peerTLSCA. Please look at the examples in the documentation and act accordingly.
Now - for the second problem, I think that the peers might not know each other in the channel.
Make sure you have anchor peers defined in the channel and that both peers have external endpoints configured.
Feel free to bug me (yacovm) on chat.hyperledger.org if you're struggling for too long and can't solve the problem.
You must add an anchor peer from each organization in the channel, this solved the problem for me. Anchor peers are required for the service discovery since the service discovery uses gossip protocol- thanks #yacovm
I stumbled a similar error (regarding to service discovery) as below.
Go Fabric Client logs:
Failed to get endorsing peers: error getting channel response for channel [myc]:
Discovery status Code: (11) UNKNOWN. Description: error received from Discovery Server:
failed constructing descriptor for chaincodes:<name:"mycc">
Peer logs:
Failed constructing descriptor for chaincode chaincodes:<name:"mycc" > ,:
cannot satisfy any principal combination
It's fixed when I provide CORE_PEER_GOSSIP_EXTERNALENDPOINT environment attribute with a correct value on peer's configuration (in docker yaml file in my case).
As I understood since this attribute is missing, discovery services running on peers failed to communicate with each other to have a conclusion of what current network looks like.

Resources