(block chain marbles sample) Error: Missing parameter. Must have a username - node.js

I am new to block chain and hyperledger-fabric, I am trying to setup Marbles sample application. I followed tutorial
Use Local Hyperledger Network
While executing this command (node enrollAdmin.js) i got following error.
Node version : v6.2.1
Npm Version : 3.9.3
Docker Version: 18.03.1-ce
$ node enrollAdmin.js
Store path:/opt/blockchain/fabric-samples/fabcar/hfc-key-store
Successfully enrolled admin user "admin"
error: [Client.js]: Error: Missing parameter. Must have a username.
at _setUserFromConfig (/opt/blockchain/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:1280:27)
at Promise (/opt/blockchain/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:1432:11)
at setUserContext (/opt/blockchain/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:1413:10)
at promise.then.then.then.then (/opt/blockchain/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:1692:17)
Error: Failed to load key or certificate and save to local stores.
at promise.then.then.then.then.then.catch (/opt/blockchain/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:1702:19)
Failed to enroll admin: Error: Failed to enroll admin
Could anyone help me to resolve this error?
Thanks in advance.

it got worked when i ran following command
$ sudo node enrollAdmin.js

Related

Error: error getting chaincode code fabcar: failed to determine platform type: Unknown chaincodeType: UNDEFINED

I am new to Hyperledger Fabric and going thru their study tutorial https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html .
Issue : I made changes in query.js and invoke.js to replace local host with my IP Address which I reverted back to original . Now when I run startFabric.sh script , I am getting following error : " Error: error getting chaincode code fabcar: failed to determine platform type: Unknown chaincodeType: UNDEFINED " .
I have googled the issue whole day but still unable to solve . Please let me know how I may solve this issue .
You aren't specifying a chaincode type, the command is ./startFabric.sh <chaincode type> which you can specify as something like javascript or golang

Error in instantiating fabcar chaincode in node, fabric 1.3

I am following this section of fabcar tutorial. When i run :
./startFabric.sh
It works like charm. But when i run following command to run node.js chaincode:
./startFabric.sh node
I get the error:
Error: could not assemble transaction, err proposal response was not
successful, error code 500, msg timeout expired while starting
chaincode fabcar:1.0 for transaction
I am using Fabric 1.3.0. Let me know how can i resolve this.
I got it worked. Actually a chaincode with same name and version was existing. So i just changed the version and it worked like charm.

hyperledger fabric devmode

I am trying to deploy chaincode in devmod on my ubuntu machine. I am following this tutorial.
The issue is when I use this command : CORE_CHAINCODE_LOGLEVEL=debug CORE_PEER_ADDRESS=localhost:7052 npm start
it shows the following error:
2018-09-20T16:27:18.292Z ERROR [lib/handler.js] uncaughtException: The "peer.address" program argument must be set to a legitimate value of <host>:<port>
Full logs can be found here:
https://hastebin.com/arerozesad.sql
I am following this tutorial:
https://hyperledger-fabric.readthedocs.io/en/v1.0.6/peer-chaincode-devmode.html
First, I hope you are using Fabric v1.1 or later as Node.js chaincode is not supported in v1.0.x.
The instructions you listed are for running Go chaincode.
For Node.js chaincode, your command should look like
CORE_CHAINCODE_ID_NAME="mycc:v0" node mycc.js --peer.address grpc://localhost:7052
You should be able to replace node mycc.js with npm start as well.
See https://github.com/hyperledger/fabric-chaincode-node#test-nodejs-chaincode for more information.

Hyperledger on IBM Cloud, chaincode launched and waiting for registration

Code
Currently I followed this article to develop my BNA to IBM blockchain cloud platform (started plan). Unluckily, I got the error when I try to run this line of code:
composer network start -c admin#mynetwork-fabric -A admin -C ./creds/admin-pub.pem -f delete.card -n my_network -V 0.0.4
Error
I am very sure that all parameters are good, the full errors are:
Error: Error trying to start business network. Error: No valid responses
from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN:
premature execution - chaincode (my_network:0.0.4) launched and
waiting for registration
Or sometimes the error is:
Error: Error trying to start business network. Error: No valid responses
from any peers.
Response from attempted peer comms was an error: Error:
REQUEST_TIMEOUT
I understand sometimes maybe there is a timeout, but I do not really got the launched and waiting for registration error.
P.S.
My hyperledger composer version is 0.19.
I also view this deploying tutorial, there might be some different commands, because of the different versions of Hyperledger Composer. I checked the composer hep to transfer the commands to running on composer 0.19.
Solution:
down grade composer-cli to 0.18.1
change your package.json, composer-cli to 0.18.1
npm install to create new bna
reinstall
restart
If you are using IBM Cloud Starter Plan, then you need to be using v0.18.1 of Composer not v0.19.
Also, this is the doc you should be following:
https://console.bluemix.net/docs/services/blockchain/develop_starter.html#deploying-a-business-networks-on-starter-plan

hyperledger-fabric "Writing your first Application" query.js step fails

Steps "git clone...", "startFabric.sh" and "npm.install" complete with no errors. "node query.js" results in:
Set wallet path, and associate user PeerAdmin with application
error: [Client.js]: Failed to load user "PeerAdmin" from local key value store. Error: TypeError: this is not a typed array.
at Function.from (native)
at importKey (/home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:180:26)
at fromString (/home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/User.js:228:28)
at /home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:968:22
error: [Client.js]: Failed to load an instance of requested user "PeerAdmin" from the state store on this Client instance. Error: TypeError: this is not a typed array.
at Function.from (native)
at importKey (/home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/impl/CryptoSuite_ECDSA_AES.js:180:26)
at fromString (/home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/User.js:228:28)
at /home/peter/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:968:22
Caught Error [TypeError: this is not a typed array.]
Note: after the git clone step, there is no "chaincode" in fabric-samples/fabcar as stated in the docs, but there is a chaincode/fabcar in fabric-samples. This does not seem to cause a problem.
Note: All steps in "Building Your First Network" complete with no problems.
Hyperledger Fabric 1.0 has been tested against Node.js version >= 6.9 and < 7.x. If you get a similar error, recommend updating the version of Node.js (or use a version manager such as nvm) and re-try. If you have already run npm install with an older version of Node, you should delete the node_modules tree and re-run npm install to be sure you are installing the correct dependencies.

Resources