IBM-Blockchain-Archive / car-lease-demo

A demonstration using IBM Blockchain to show how the lifecycle of vehicles can be recorded on a blockchain
Other
169 stars 304 forks source link

Deploying in Bluemix with HSBN plan - need any changes? #70

Closed likepunk closed 7 years ago

likepunk commented 7 years ago

Hello!

I tried to switch Bluemix's blockchain services from ibm-blockchain-5-prod to HSBN(ibm-blockchain-plan-z2-prod), but it seems it doesn't work with HSBN. Do I have to change hardcoded label in the code to 'ibm-blockchain-plan-z2-prod'?

Is there anything needs to be modified to work with HSBN?

Thanks in advance,

Alex

likepunk commented 7 years ago

I also tried to deploy with local version of node app - and got following errors. I guess there are additional credentials needs to be added to the hyperledger fabric server - how do I do it with HSBN or regular Bluemix blockchain service with local application?

[!] Running locally with bluemix fabric peer0: grpcs://a78024a4-b0b7-4b90-829f-a218300e6909_vp0-discovery.zone.blockchain.ibm.com:30303 peer1: grpcs://a78024a4-b0b7-4b90-829f-a218300e6909_vp1-discovery.zone.blockchain.ibm.com:30303 peer2: grpcs://a78024a4-b0b7-4b90-829f-a218300e6909_vp2-discovery.zone.blockchain.ibm.com:30303 peer3: grpcs://a78024a4-b0b7-4b90-829f-a218300e6909_vp3-discovery.zone.blockchain.ibm.com:30303 membersrvc: grpcs://a78024a4-b0b7-4b90-829f-a218300e6909_ca-discovery.zone.blockchain.ibm.com:30303 eventhub: grpcs://undefined:undefined Server Up INFO Startup complete on port 8080

INFO Startup Enrolled registrar

INFO Startup Set registrar

INFO Startup Failed to enroll DVLA using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

{ Error: Signature verification failed. at /root/ibm/nodev6/carlease/car-lease-demo/node_modules/grpc/src/node/src/client.js:417:17 code: 2, metadata: Metadata { _internal_repr: {} } } ERROR Startup OUTPUT: {"code":2,"metadata":{"_internal_repr":{}}} INFO Startup Failed to enroll ScrapIt_UK using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Aston_Scrap_Centre using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Cray_Bros_London_Ltd using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Regionwide_Vehicle_Contracts using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Every_Car_Leasing using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll LeaseCan using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Milescape using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Beechvale_Group using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Anthony_O_Dowd using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Jaguar_Land_Rover using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Andrew_Hurt using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Alfa_Romeo using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Joe_Payne using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Toyota using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

INFO Startup Failed to enroll Viewers_Alfa_Romeo using HFC. Error: {"code":2,"metadata":{"_internal_repr":{}}}

liam-grace commented 7 years ago

The error you are seeing when trying to deploy locally looks like a problem with the certificate you are using. You should save the HSBN certificate to Chaincode/src/vehicle_code and replace the current certificate.pem.

And regarding the hard coded service name, for now you will have to change the hard coded name to ibm-blockchain-plan-z2-prod

likepunk commented 7 years ago

Okay @14gracel thanks.. I tried to put cert.pem(what I got from registrar/ecert for WebAppAdmin) in that directory...didn't work. I also put it under /certs/peer/cert.pem as app.js pointed for the path in below. Should I change also certificate var?

// Connecting to TLS enabled peers requires a certificate var certificate = fs.readFileSync('us.blockchain.ibm.com.cert'); // TODO should download using service credentials

// Deploying chaincode requires us to know a path to a certificate on the peers :( var certificate_path = '/certs/peer/cert.pem'; // TODO this should be available in the service credentials

liam-grace commented 7 years ago

The cert that you should save to the .pem file is the one that you get directly from the HSBN bluemix service. in the VCAP_SERVICES object (which is part of the bluemix service), you will see a key called cert_path which contains a url to a certificate. Download that certificate, and replace the current certificate.pem with the downloaded certificate, and rename it. I hope that helps

likepunk commented 7 years ago

Thanks @14gracel ! just wanted to say it is working with local version of fabric. Thanks again! We can close this issue now.