PaddyMc / decentralised-ecosystem-prototype

decentralised-ecosystem-prototype that leverages ipfs and hyperledger fabric
MIT License
1 stars 2 forks source link

init crypto missing error when trying to run ./start.sh #26

Open rybruscoe opened 5 years ago

rybruscoe commented 5 years ago

I am getting the following error:

2018-12-28 08:14:21.138 UTC [main] main -> ERRO 001 Cannot run peer because cannot init crypto, missing /etc/hyperledger/msp/users/Admin@org1.example.com/msp folder

I created the directory /etc/hyperledger/msp/users/Admin@org1.example.com/msp but I am still getting the above error when I try to run ./start.sh

rybruscoe commented 5 years ago

I ended up trying "docker-compose up" from the same basic-network folder and that seems to work to get past the above issue. However now I am running into another error with the JS stuff:

connect deprecated multipart: use parser (multiparty, busboy, formidable) npm module instead node_modules/connect/lib/middleware/bodyParser.js:56:20 connect deprecated limit: Restrict request size at location of read node_modules/connect/lib/middleware/multipart.js:86:15 Jammin' on port 3001... (node:12181) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead :query Store path:/home/nrydev/dev/blockchain/SOTERIA/javascript/hfc-key-store Successfully loaded user1 from persistence Query has completed, checking results error from query = { Error: 2 UNKNOWN: Failed to deserialize creator identity, err MSP Org1MSP is unknown at Object.exports.createStatusError (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/common.js:87:15) at Object.onReceiveStatus (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:1188:28) at InterceptingListener._callNext (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:564:42) at InterceptingListener.onReceiveStatus (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:614:8) at callback (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:841:24) code: 2, metadata: Metadata { _internal_repr: {} }, details: 'Failed to deserialize creator identity, err MSP Org1MSP is unknown' }

CaelRowley commented 5 years ago

Hi nrydevops,

To get this to run you will need to use the version 1.0.6 binaries which you can get here: curl -sSL https://goo.gl/kFFqh5 | bash -s 1.0.6 the bin folder should be placed here /decentralised-ecosystem-prototype/bin The start.sh script should work with those binaries in that directory.

I have also updated master with a quick fix to that bug so the javascript should also be working again. After the start.sh has finished you can quickly run: node enrollAdmin.js node registerUser.js node query.js

The query.js should return data from the ledger.

Let me know if there are still issues after this.

rybruscoe commented 5 years ago

Hello CaelRowley, Thank so much for the help! The start.sh script is now working. However I am running into another error regarding the certificates:

nrydev @ nrydev ~/dev/blockchain/SOTERIA/javascript (master) └─ $ ▶ node query.js Store path:/home/nrydev/dev/blockchain/SOTERIA/javascript/hfc-key-store (node:6126) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead Successfully loaded user1 from persistence Query has completed, checking results error from query = { Error: 2 UNKNOWN: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at Object.exports.createStatusError (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/common.js:87:15) at Object.onReceiveStatus (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:1188:28) at InterceptingListener._callNext (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:564:42) at InterceptingListener.onReceiveStatus (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:614:8) at callback (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:841:24) code: 2, metadata: Metadata { _internal_repr: {} }, details: 'Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com")' }

I am getting the following terminal output when I run server.js

nrydev @ nrydev ~/dev/blockchain/SOTERIA/javascript (master) └─ $ ▶ node server.js Jammin' on port 3001... (node:6142) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead :query Store path:/home/nrydev/dev/blockchain/SOTERIA/javascript/hfc-key-store Successfully loaded user1 from persistence Query has completed, checking results error from query = { Error: 2 UNKNOWN: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at Object.exports.createStatusError (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/common.js:87:15) at Object.onReceiveStatus (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:1188:28) at InterceptingListener._callNext (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:564:42) at InterceptingListener.onReceiveStatus (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:614:8) at callback (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:841:24) code: 2, metadata: Metadata { _internal_repr: {} }, details: 'Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com")' } :query Store path:/home/nrydev/dev/blockchain/SOTERIA/javascript/hfc-key-store Successfully loaded user1 from persistence Query has completed, checking results error from query = { Error: 2 UNKNOWN: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at Object.exports.createStatusError (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/common.js:87:15) at Object.onReceiveStatus (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:1188:28) at InterceptingListener._callNext (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:564:42) at InterceptingListener.onReceiveStatus (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:614:8) at callback (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/grpc/src/client_interceptors.js:841:24) code: 2, metadata: Metadata { _internal_repr: {} }, details: 'Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com")' }

rybruscoe commented 5 years ago

FYI: I simply changes the project directory name locally from "decentralised-ecosystem-prototype" to "SOTERIA" on my system. I don't think this would effect anything but figured I should mention it so there is no confusion with my above reply. Thanks again for the help! ;-)

rybruscoe commented 5 years ago

Also when I try any of the URL's in your readme; it gives me an error "Cannot GET...." for each URL such as "Cannot GET /people/addPerson" and when I try the URL http://localhost:3001/image/:query the web browser just keeps loading but does not render anything.

rybruscoe commented 5 years ago

I ran the teardown.sh script first and now it works! I think I just needed to clean up the old Docker containers I had from before. I am able to run node query.js as you suggested and I get back the expected results:

nrydev @ nrydev ~/dev/blockchain/SOTERIA/javascript (master) └─ $ ▶ node query.js Store path:/home/nrydev/dev/blockchain/SOTERIA/javascript/hfc-key-store (node:15311) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead Successfully loaded user1 from persistence Query has completed, checking results Response is {"name":"Patches","image":"pppppppppp","record":"Smallpox"}

One other question: Is the JS "node server.js" a web browser based GUI frontend? When I try to run the node server.js I am getting a JS error:

nrydev @ nrydev ~/dev/blockchain/SOTERIA/javascript (master) └─ $ ▶ node server.js Jammin' on port 3001... (node:15329) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead events.js:183 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE :::3001 at Object._errnoException (util.js:1022:11) at _exceptionWithHostPort (util.js:1044:20) at Server.setupListenHandle [as _listen2] (net.js:1351:14) at listenInCluster (net.js:1392:12) at Server.listen (net.js:1476:7) at Function.listen (/home/nrydev/dev/blockchain/SOTERIA/javascript/node_modules/express/lib/application.js:618:24) at Object. (/home/nrydev/dev/blockchain/SOTERIA/javascript/server.js:14:5) at Module._compile (module.js:643:30) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32)

CaelRowley commented 5 years ago

We weren't really expecting anyone else to be using this but glad you got it working! I'll look into the issues you faced and do some better documentation and clean some things up a bit that should help setup the project.

Out of curiosity sake what are you making?

rybruscoe commented 5 years ago

Hello, Actually I used sudo kill 13012 -9 with the proper process ID for the node server and then I was able to get the node server.js to work. However, none of the URL's are working still. I am going to try them through Postman next. I am just trying to make a very simple HLF file sharing demo and using IPFS to store the actual files and then store the cryptographic hashed links to the files in hyperledger.

rybruscoe commented 5 years ago

@CaelRowley is the query feature in this project currently working? I can run node enrollAdmin.js and node registerUser.js but when I try to run node query.js it does not seem to be returning the correct response from the ledger. I am trying to learn how all this works so any help would be very much appreciated! Thanks!

rybruscoe commented 5 years ago

AH! Please disregard that last message. Query does seem to be working just fine from the CLI but not via the URL:

nrydev @ nrydev ~/dev/blockchain/SOTERIA/javascript (master) └─ $ ▶ node query.js Store path:/home/nrydev/dev/blockchain/SOTERIA/javascript/hfc-key-store (node:30631) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead Successfully loaded user1 from persistence Query has completed, checking results Response is {"name":"Patches","image":"pppppppppp","record":"Smallpox"}