Problem with Wallet Creation, signature error - hyperledger-fabric

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

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

Data size limit. Error: Received message larger than max

I am running a node script which connects to the business network and adds assets to the network.
I get the below error.
Error: Error trying invoke business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: Received message larger than max (5153800 vs. 4194304)
at _initializeChannel.then.then.then.then.catch (/home/sneha/node-app-v1/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:916:34)
at <anonymous>
I followed this solved issue: https://jira.hyperledger.org/browse/FAB-3301
and changed remote.js file in respective node modules [ composer-playground,composer-client,composer-admin,composer-common etc.. ]
Even after the changes, I can't add the asset through the node script. It throws the same error.
If I add the asset through composer playground it successfully adds the asset but then I can't access the network [ in composer playground ] it throws this error
Error: No connection found with ID 2db7d182-8856-44d5-a9d8-5f7178726423
How can I solve both errors?
How can I set the limit to infinite?
I am using:
Node version: v8.9.4
Composer version: v0.16.5
To change grpc message limits requires you to create/update your connection profile. See https://hyperledger.github.io/composer/reference/connectionprofile
for information about connection profiles.
A no connection profile with id found usually implies you have restarted playground, but not restarted your interaction with playground. Would suggest closing the playground tab and creating new tab to use playground in.

Chaincode events are bugged in hyperledger fabric

Currently chaincode events in hyperledger will only raise duplicate events n number of times, where n is the number of chaincode events in a block and the event raised is the first event in the block.
const profileRegId = this.event_hub.registerChaincodeEvent(request.chaincodeId, "Profile Added", event => {
this.event_hub.unregisterChaincodeEvent(profileRegId);
em.emit(event.payload);
});
Above is how we are calling the registerChaincodeEvent function in our node application.
createEvent(APIstub, "Profile Added", profile)
Above is how we implement in the chaincode.
Is there a way to raise this as a bug with hyperledger myself?
The procedure of opening a new bugs or submitting issues into Hyperledger Fabric is fairly simple, you need to register your linux foundation id (read here the details) and login into https://jira.hyperledger.org/, once done you can open an issue.
While from your description it's not really clear/obvious there is an issue, if you have n valid transactions each has created an event not sure whenever it was expected to have only single notification. Also please note, since release of v1.1.0 of Fabric there is a new event delivery service: FAB-7069 and here some docs about it.
However, if you still think there is a bug or possible improvement, please submit JIRA.

The current identity has not been registered:

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.

Visibility of variables from different consoles in Ethereum

I'm new in Ethereum.
And I'm trying to develop contracts using Azure's cluster (I have trial account).
I connected using geth to my network from machine in Azure:
gethadmin#XXXXXX-tx0:~$ geth attach http://ether2ore.eastus.cloudapp.azure.com:8545
Then I initialize variable
>var test_var = 555
undefined
>test_var
555
It's - OK.
But when I tried to connect to same point from my laptop:
C:\Users\boris>geth attach http://ether2ore.eastus.cloudapp.azure.com:8545
I tried to check this variable:
> test_var
ReferenceError: 'test_var' is not defined
at <anonymous>:1:1
I see that it's not defined.
On both consoles I see same accounts:
From - C:\Users\boris>
eth.accounts ["0xab14c61930343149c2f54044054cd46b90c0dee6", "0x7cc276b28bfdbb57151ed3b5552aafb2f2592964", "0xc9b8b9d57219b2c0935d8c28d4d2247fe70232f3", "0x2aed463fd54aa41fed898a9629bee6f0935b74fb"]
From - gethadmin#XXXXXX-tx0
eth.accounts
["0xab14c61930343149c2f54044054cd46b90c0dee6", "0x7cc276b28bfdbb57151ed3b5552aafb2f2592964", "0xc9b8b9d57219b2c0935d8c28d4d2247fe70232f3", "0x2aed463fd54aa41fed898a9629bee6f0935b74fb"]
Command admin.peers on both consoles gives me same results
So, it's same networks.
Maybe I don't understand how it should works, but I suspect that, if I define variable in same network it must be visible from all consoles. Is not it?
Same situation with contracts. I compiled contract in first console and can operate with it, but it's not reachable from another console.
Please, can you explain me why this situation happens or give me proper links to get answer on this question.
Many thanks
The variables you are instantiating are local variables within the console.
Each time you connect, a new JavaScript Console with the web3 API exposed is created locally and it wraps the ethereum function calls so that you can use them within JS rather than having to write the raw calls.
To persist data on the network you would need to deploy a contract with storage. You could then fetch the data from the contract storage without executing a transaction using a getStorageAt or call and the signature of your public variable. However, you will need to execute a transaction calling a contract function (similar to the example in the solidity documentation above) in order to update the data stored in the contract.

Resources