[Error: EACCES: permission denied, open '/home/ubuntu/.hfc-key-store/ - amazon-ec2

I am getting following error while running composer rest server. I am using aws ubuntu 16.04 server.
Hyperledger Composer
? Enter your Fabric Connection Profile Name: hlfv1
? Enter your Business Network Identifier : digitalproperty-network
? Enter your Fabric username : admin
? Enter your secret: Xurw3yU9zI0l
? Specify if you want namespaces in the generated REST API: never use namespaces
? Specify if you want the generated REST API to be secured: No
To restart the REST server using the same options, issue the following command:
composer-rest-server -p hlfv1 -n digitalproperty-network -i admin -s Xurw3yU9zI0l -N never
Discovering types from business network definition ...
Connection fails: Error: error trying login and get user Context.
Error: error trying to enroll user. Error: Failed to generate key for
enrollment due to error [Error: EACCES: permission denied, open
'/home/ubuntu/.hfc-key-store/be8405cef82cc00455de296664ccdcb35e4c707bb0e63a00d0bef76546528e13-priv']
It will be retried for the next request. Error: error trying login and
get user Context. Error: error trying to enroll user. Error: Failed to
generate key for enrollment due to error [Error: EACCES: permission
denied, open
'/home/ubuntu/.hfc-key-store/be8405cef82cc00455de296664ccdcb35e4c707bb0e63a00d0bef76546528e13-priv']
at client.getUserContext.then.then.catch (/home/ubuntu/.nvm/versions/node/v6.11.0/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:293:34)
ubuntu#ip-172-31-19-220:~/composer-sample-networks/packages/digitalproperty-network$

when connecting to the running v1.0 Fabric dev environment using hlfv1 or running the REST server (as shown above) - you need to provide the default admin password of 'adminpw' - please try running composer-rest-server again and use the correct password. cheers Paul

On the similar set up, I could able to work with following command, basically use PeerAdmin user instead of admin. For example:
composer-rest-server -p hlfv1 -n my-network -i PeerAdmin -s PeerAdmin -N never
If you still face same issue, try with sudo

Related

Error in Composer Identity Request

When I make a request for identity in composer, always give this error:
composer identity request -c PeerAdmin#orgx-network-xxx -u admin -s adminpw -d alice
Error: failed to request identity. Error trying to enroll user and return certificates. Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]
What can cause this and how can I solve it?
it looks like the Fabric CA server container on port 7054 is not started or is not listening, or not bound to that address/port.

How do I resolve the following issue on hyperledger composer cli command for identity issue?

image 1 image 2
From the following link
https://hyperledger.github.io/composer/reference/composer.identity.issue.html
composer identity issue -c admin#mron-business-network -fsupplier -u suppid -a "resource:org.mron.Supplier#S001" -x false
Issue identity and create Network Card for: suppid
✖ Issuing identity. This may take a few seconds...
Error: fabric-ca request register failed with errors [[{"code":400,"message":"Authorization failure"}]]
Command failed
same message posted on Rocketchat earlier. It would appear that the admin id in your card is not the one currently known to the CA server. After import using (for example) composer card import -f <filename>, you need to connect to the business network (or use composer network ping -c admin#mron-business-network to connect) - for the credentials (key/certificate) to be downloaded to the wallet from the CA server. You can then verify this with a composer card list --name admin#mron-business-network and see the 'Credentials set' message for the card in question.

Composer 0.14 - Error: The current identity has not been registered: admin

After the update to 0.14, I am no more able to connect to the chain from the cli
composer network ping -p hlfv1 -n basic-sample-network -i admin -s adminpw
or
composer-rest-server -p hlfv1 -n basic-sample-network -i admin -s adminpw -N never
I have the following error
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: admin)
All composer component were updated to 0.14, and the test was made with basic-sample-network. For information, npm test on this exemple was perfectly.
OS: Ubuntu
Please confirm that you have read the 0.14.0 release notes, particularly the "How to deal with this change" section:
https://github.com/hyperledger/composer/releases/tag/v0.14.0
You need to update your ACLs and redeploy your network, binding a network admin participant.
There are two ways for specifying the business network administrators
on the command line: Note: This option is the one most users will
want! When running composer network deploy and composer network start,
in addition to the normal parameters you would use, you should also
include -A admin -S to bind the admin identity as a network admin
participant. If you don't do this, the identity you use to deploy the
business network, usually PeerAdmin, will be bound into the business
network as a business network administrator, and this is probably not
what you want.

How to start the Composer REST Server with the identity created through REST API?

I have configured my local REST server to use GitHub auth and Mongo DB. I have followed the deployment steps and can authenticate my GiHub ID putting the default Wallet into the Mongo DB. I then create a participant and issue an identity for that participant. I add the identity to the wallet and set that identity as the default. I was able to do a system/ping to return the current participant and also was able to call REST APIs.
Now I would like to start REST server with single user mode with identity which I created in the deployment steps as follow.
composer-rest-server -i nomura -s twidKDZiYFGw -m false -a false
I assume Blockchain identity specified on the command line at startup is created when issuing an identity for the participant.
But it shows the following error.
Discovering types from business network definition ...
Connection fails: Error: Error trying to ping. Error: Error trying to query chaincode. Error: chaincode error (status: 500, message: Error: The current identity has not been registered:nomura)
It will be retried for the next request.
Exception: Error: Error trying to ping. Error: Error trying to query chaincode. Error: chaincode error (status: 500, message: Error: The current identity has not been registered:nomura)
Error: Error trying to ping. Error: Error trying to query chaincode. Error: chaincode error (status: 500, message: Error: The current identity has not been registered:nomura)
What else do I have to do to create valid blockchain id for starting REST server?
your identity is fine. The problem appears to be how you're trying to start the REST server. You need to specify the connection profile (to connect to the business network).
Example syntax (where 'hlfv1' below is my HL Fabric v1 connection profile name) is:
composer-rest-server -p hlfv1 -n my-network -i nomura -s twidKDZiYFGw -m false -a false

Trying to deploy a business network onto hyperledger fabric 1.0 beta fails to install chaincode

I have v0.8.0 of hyperledger composer installed and when I try to deploy the business network using the following command I get an install chaincode error
composer network deploy -a test.bna -p hlfv1 -i admin -s adminpw
And the response is
Error: error trying to deploy. Error: error trying install chaincode. Error
What is the problem ?
The security model changed after hyperledger v1.0.0-alpha1. Now peers have the concept of Admin users. The userid 'admin' is a userid controlled and owned by the certificate authority server that is provided as part of the fabric composer development hyperledger fabric and has no authority on the Peer.
The Development fabric pre-loads the peer's Admin id into the KeyValStore defined by the profile 'hlfv1' and calls it PeerAdmin. This is the userid you must specify in order to deploy a business network onto the peer.
As this user has already preloaded it doesn't have a secret but hyperledger composer currently requires a secret to be specified. It doesn't matter what you specify for the secret so long as you specify something. So the deploy command looks like
composer network deploy -a test.bna -p hlfv1 -i PeerAdmin -s anything

Resources