Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secure Hand shake failed with error 1 #3

Open
MHamza81 opened this issue Nov 1, 2016 · 14 comments
Open

Secure Hand shake failed with error 1 #3

MHamza81 opened this issue Nov 1, 2016 · 14 comments

Comments

@MHamza81
Copy link

MHamza81 commented Nov 1, 2016

Hi,
I am following the steps provided in the readme file but I am getting this error when i try to run helloblockchain.js program.

E1101 11:59:03.105000000 12468 handshake.c:215] Read failed.
E1101 11:59:03.105000000 12468 secure_channel_create.c:102] Secure handshake failed with error 1.
E1101 11:59:04.488000000 12468 handshake.c:215] Read failed.
E1101 11:59:04.488000000 12468 secure_channel_create.c:102] Secure handshake failed with error 1.

Before this error the program downloads a certificate and there is peer and caserver information on the terminal.
Can you please help me with this issue, I am stuck here.

@MHamza81 MHamza81 changed the title Secure Hand shake failed Secure Hand shake failed with error 1 Nov 1, 2016
@jonathan-yk-tan
Copy link

@MHamza81 I am having the same issue... been troubleshooting for days on this, tried using hfc 0.5.4 which includes grpc 1.0 however I get the same error:

jonathans-mbp:hfc-test Jonathan$ GRPC_TRACE=all DEBUG=hfc node helloblockchain.js -c chaincode_example02

Deleting existing certificate  certificate.pem

Downloading certificate.pem from https://blockchain-certs.mybluemix.net/zone.blockchain.ibm.com.cert


------------- peers and caserver information: -------------
[ Peer {
    sendTransaction: [Function],
    url: 'grpcs://126fe2df-bee6-4e0a-95c2-1c36462101eb_vp0-discovery.zone.blockchain.ibm.com:30303',
    chain:
     Chain {
       peers: [Circular],
       securityEnabled: true,
       members: {},
       tcertBatchSize: 200,
       devMode: false,
       preFetchMode: true,
       deployWaitTime: 20,
       invokeWaitTime: 5,
       name: 'targetChain',
       keyValStore: [Object],
       memberServices: [Object],
       cryptoPrimitives: [Object] },
    ep:
     Endpoint {
       addr: '126fe2df-bee6-4e0a-95c2-1c36462101eb_vp0-discovery.zone.blockchain.ibm.com:30303',
       creds: ChannelCredentials {} },
    peerClient: Client { '$channel': Channel {} } },
  Peer {
    sendTransaction: [Function],
    url: 'grpcs://126fe2df-bee6-4e0a-95c2-1c36462101eb_vp1-discovery.zone.blockchain.ibm.com:30303',
    chain:
     Chain {
       peers: [Circular],
       securityEnabled: true,
       members: {},
       tcertBatchSize: 200,
       devMode: false,
       preFetchMode: true,
       deployWaitTime: 20,
       invokeWaitTime: 5,
       name: 'targetChain',
       keyValStore: [Object],
       memberServices: [Object],
       cryptoPrimitives: [Object] },
    ep:
     Endpoint {
       addr: '126fe2df-bee6-4e0a-95c2-1c36462101eb_vp1-discovery.zone.blockchain.ibm.com:30303',
       creds: ChannelCredentials {} },
    peerClient: Client { '$channel': Channel {} } },
  Peer {
    sendTransaction: [Function],
    url: 'grpcs://126fe2df-bee6-4e0a-95c2-1c36462101eb_vp2-discovery.zone.blockchain.ibm.com:30303',
    chain:
     Chain {
       peers: [Circular],
       securityEnabled: true,
       members: {},
       tcertBatchSize: 200,
       devMode: false,
       preFetchMode: true,
       deployWaitTime: 20,
       invokeWaitTime: 5,
       name: 'targetChain',
       keyValStore: [Object],
       memberServices: [Object],
       cryptoPrimitives: [Object] },
    ep:
     Endpoint {
       addr: '126fe2df-bee6-4e0a-95c2-1c36462101eb_vp2-discovery.zone.blockchain.ibm.com:30303',
       creds: ChannelCredentials {} },
    peerClient: Client { '$channel': Channel {} } },
  Peer {
    sendTransaction: [Function],
    url: 'grpcs://126fe2df-bee6-4e0a-95c2-1c36462101eb_vp3-discovery.zone.blockchain.ibm.com:30303',
    chain:
     Chain {
       peers: [Circular],
       securityEnabled: true,
       members: {},
       tcertBatchSize: 200,
       devMode: false,
       preFetchMode: true,
       deployWaitTime: 20,
       invokeWaitTime: 5,
       name: 'targetChain',
       keyValStore: [Object],
       memberServices: [Object],
       cryptoPrimitives: [Object] },
    ep:
     Endpoint {
       addr: '126fe2df-bee6-4e0a-95c2-1c36462101eb_vp3-discovery.zone.blockchain.ibm.com:30303',
       creds: ChannelCredentials {} },
    peerClient: Client { '$channel': Channel {} } } ]
MemberServicesImpl {
  ecaaClient: Client { '$channel': Channel {} },
  ecapClient: Client { '$channel': Channel {} },
  tcapClient: Client { '$channel': Channel {} },
  tlscapClient: Client { '$channel': Channel {} },
  cryptoPrimitives:
   Crypto {
     hashAlgorithm: 'SHA3',
     securityLevel: 256,
     suite: 'sha3-256',
     curveName: 'secp256r1',
     hashFunction:
      { [Function]
        create: [Function],
        update: [Function],
        hex: [Function],
        buffer: [Function],
        arrayBuffer: [Function],
        array: [Function] },
     hashFunctionKeyDerivation: { [Function] hash: [Function] },
     hashOutputSize: 32,
     ecdsaCurve:
      PresetCurve {
        curve: [Object],
        g: <EC Point x: 6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296 y: 4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5>,
        n: <BN: ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551>,
        hash: [Object] } } }
-----------------------------------------------------------


  hfc Enrolling [req={"enrollmentID":"admin","enrollmentSecret":"100948db58"}] +0ms
  hfc [MemberServicesImpl.enroll] [{"enrollmentID":"admin","enrollmentSecret":"100948db58"}] +1ms
  hfc [MemberServicesImpl.enroll] Generating keys... +1ms
  hfc [MemberServicesImpl.enroll] Generating keys...done! +79ms
  hfc [MemberServicesImpl.enroll] Generating request! "3059301306072a8648ce3d020106082a8648ce3d030107034200047e0354268608beb0803dd7745ac3d819419bce5d8fc2f91683657c0af140769ed158a171ac19ec679dfa9771001090a6d081da306bcd6b36a06e92b36ddf00b9" +4ms
  hfc [MemberServicesImpl.enroll] Adding signing key! +0ms
  hfc [MemberServicesImpl.enroll] Assding encryption key! +1ms
  hfc [MemberServicesImpl.enroll] [Contact ECA] {"ts":{"seconds":{"low":1477984016,"high":0,"unsigned":false},"nanos":0},"id":{"id":"admin"},"tok":{"tok":{"buffer":{"type":"Buffer","data":[49,48,48,57,52,56,100,98,53,56]},"offset":0,"markedOffset":-1,"limit":10,"littleEndian":false,"noAssert":false}},"sign":{"type":0,"key":{"buffer":{"type":"Buffer","data":[48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0,4,126,3,84,38,134,8,190,176,128,61,215,116,90,195,216,25,65,155,206,93,143,194,249,22,131,101,124,10,241,64,118,158,209,88,161,113,172,25,236,103,157,250,151,113,0,16,144,166,208,129,218,48,107,205,107,54,160,110,146,179,109,223,0,185]},"offset":0,"markedOffset":-1,"limit":91,"littleEndian":false,"noAssert":false}},"enc":{"type":0,"key":{"buffer":{"type":"Buffer","data":[48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0,4,251,236,207,18,175,204,249,219,105,79,54,13,22,98,108,161,191,145,106,4,75,187,212,229,27,218,23,90,239,206,43,94,96,22,191,225,82,28,162,90,43,5,209,82,45,75,25,192,216,185,69,148,208,122,96,72,204,64,68,127,38,192,239,125]},"offset":0,"markedOffset":-1,"limit":91,"littleEndian":false,"noAssert":false}},"sig":null}  +0ms
E1101 15:06:57.975026000 123145454858240 handshake.c:128] Security handshake failed: {"created":"@1477984017.975008000","description":"Handshake read failed","file":"../src/core/lib/security/transport/handshake.c","file_line":237,"referenced_errors":[{"created":"@1477984017.974994000","description":"FD shutdown","file":"../src/core/lib/iomgr/ev_poll_posix.c","file_line":427}]}
  hfc [MemberServicesImpl.enroll] failed to create cert pair: err={"code":14,"metadata":{"_internal_repr":{}}} +1s
  hfc [memberServices.enroll] err=Error, enrollment=undefined +1ms
/Users/Jonathan/projects/hfc-test/helloblockchain.js:152
        if (err) throw Error("\nERROR: failed to enroll admin : " + err);
                 ^

Error:
ERROR: failed to enroll admin : Error
    at Error (native)
    at /Users/Jonathan/projects/hfc-test/helloblockchain.js:152:24
    at /Users/Jonathan/projects/hfc-test/node_modules/hfc/lib/hfc.js:468:28
    at /Users/Jonathan/projects/hfc-test/node_modules/hfc/lib/hfc.js:718:24
    at Object.callback (/Users/Jonathan/projects/hfc-test/node_modules/hfc/lib/hfc.js:1898:24)
    at /Users/Jonathan/projects/hfc-test/node_modules/hfc/node_modules/grpc/src/node/src/client.js:420:14```

@MHamza81
Copy link
Author

MHamza81 commented Nov 1, 2016

@jonathan-yk-tan I tried with 0.5.4 and got the exact same error.

@czar0
Copy link

czar0 commented Nov 2, 2016

@MHamza81 I see you are using the zone certificate, that is meant to be used only on High Security Business Network (HSBN). Is that the case?
To be sure which cert to use, you can have a look at the bottom of your service credentials.

@MHamza81
Copy link
Author

MHamza81 commented Nov 2, 2016

@czar0 I have just copied the service credentials from blockchain service credentials. They also seem a bit longer, in the tutorial it was mentioned that there are 202 lines but mine were more than 400 lines. Is there any problem with that? If so, i'll be very grateful to you if you help me solving this issue.

@nickgaski
Copy link
Collaborator

@ratnakar-asara - can we investigate this. Looks like the documentation may need to change.

@d-chau
Copy link

d-chau commented Nov 3, 2016

I also have this issue with hfc0.5.3 and with switching my grpc as said the readme. Upgrading to hfc0.5.4 yields a different issue. txt.pb.setNonce(self.nonce); cannot read property of undefined. This is in hfc lib.

@goupadhy
Copy link

------------- ca-server, peers and event URL:PORT information: -------------

CA server Url : grpcs://2aace0d55476405d9229d730a26ff8df-ca.us.blockchain.ibm.com:30003

Validating Peer0 : grpcs://2aace0d55476405d9229d730a26ff8df-vp3.us.blockchain.ibm.com:30003
Validating Peer1 : grpcs://2aace0d55476405d9229d730a26ff8df-vp1.us.blockchain.ibm.com:30003
Validating Peer2 : grpcs://2aace0d55476405d9229d730a26ff8df-vp0.us.blockchain.ibm.com:30003
Validating Peer3 : grpcs://2aace0d55476405d9229d730a26ff8df-vp2.us.blockchain.ibm.com:30003

Event Url on Peer0 : grpcs://2aace0d55476405d9229d730a26ff8df-vp3.us.blockchain.ibm.com:31003
Event Url on Peer1 : grpcs://2aace0d55476405d9229d730a26ff8df-vp1.us.blockchain.ibm.com:31003
Event Url on Peer2 : grpcs://2aace0d55476405d9229d730a26ff8df-vp0.us.blockchain.ibm.com:31003
Event Url on Peer3 : grpcs://2aace0d55476405d9229d730a26ff8df-vp2.us.blockchain.ibm.com:31003


Enrolled admin sucecssfully

Enrolled and registered JohnDoe successfully

Deploying chaincode ...
E1228 20:56:14.289642000 123145312870400 handshake.c:128] Security handshake failed: {"created":"@1482938774.289593000","description":"Handshake read failed","file":"../src/core/lib/security/transport/handshake.c","file_line":237,"referenced_errors":[{"created":"@1482938774.289586000","description":"FD shutdown","file":"../src/core/lib/iomgr/ev_poll_posix.c","file_line":427}]}

Failed to deploy chaincode: request={"fcn":"init","args":["a","100","b","200"],"chaincodePath":"chaincode","certificatePath":"/certs/peer/cert.pem"}, error={"error":{"code":14,"metadata":{"_internal_repr":{}}},"msg":"Error"}

@ratnakar-asara
Copy link
Collaborator

ratnakar-asara commented Dec 28, 2016

@goupadhy
Are the peers up and running ?

Can you try to access api_url with "https" along with the rest end point /chain

ex :
Open the below link in browser

https://2aace0d55476405d9229d730a26ff8df-vp3.us.blockchain.ibm.com:5003/chain
or use curl command
curl -ks https://2aace0d55476405d9229d730a26ff8df-vp3.us.blockchain.ibm.com:5003/chain

(NOTE: Use the right port number here from your ServiceCredentials.json)

@goupadhy
Copy link

goupadhy commented Dec 29, 2016

@ratnakar-asara
Yes the peers are up and running.
I tried accessing the api url and it is also working i'm getting the response back with the chain code details. {"height":1,"currentBlockHash":"RrndKwuojRMjOz/rdD7rJD/NUupiuBuCtQwnZG7Vdi/XXcTd2MDyAMsFAZ1ntZL2/IIcSUeatIZAKS6ss7fEvg=="}

@goupadhy
Copy link

------------- ca-server, peers and event URL:PORT information: -------------

CA server Url : grpcs://26778ce3cc7d4b4ea29b5400a856b431-ca.us.blockchain.ibm.com:30002

Validating Peer0 : grpcs://26778ce3cc7d4b4ea29b5400a856b431-vp0.us.blockchain.ibm.com:30002
Validating Peer1 : grpcs://26778ce3cc7d4b4ea29b5400a856b431-vp1.us.blockchain.ibm.com:30002
Validating Peer2 : grpcs://26778ce3cc7d4b4ea29b5400a856b431-vp2.us.blockchain.ibm.com:30002
Validating Peer3 : grpcs://26778ce3cc7d4b4ea29b5400a856b431-vp3.us.blockchain.ibm.com:30002

Event Url on Peer0 : grpcs://26778ce3cc7d4b4ea29b5400a856b431-vp0.us.blockchain.ibm.com:31002
Event Url on Peer1 : grpcs://26778ce3cc7d4b4ea29b5400a856b431-vp1.us.blockchain.ibm.com:31002
Event Url on Peer2 : grpcs://26778ce3cc7d4b4ea29b5400a856b431-vp2.us.blockchain.ibm.com:31002
Event Url on Peer3 : grpcs://26778ce3cc7d4b4ea29b5400a856b431-vp3.us.blockchain.ibm.com:31002


hfc Enrolling [req={"enrollmentID":"admin","enrollmentSecret":"7b0d7bf547"}] +0ms
hfc [MemberServicesImpl.enroll] [{"enrollmentID":"admin","enrollmentSecret":"7b0d7bf547"}] +1ms
hfc [MemberServicesImpl.enroll] Generating keys... +1ms
hfc [MemberServicesImpl.enroll] Generating keys...done! +102ms
hfc [MemberServicesImpl.enroll] Generating request! "3059301306072a8648ce3d020106082a8648ce3d03010703420004273a958ac522190f6200244fd60a3758b3be446fe7dfccc93e0251f2f18a30e9b732c24816d2a0d113c9d143476c4068857eb3c4b665f486bb850d4046f74af8" +2ms
hfc [MemberServicesImpl.enroll] Adding signing key! +0ms
hfc [MemberServicesImpl.enroll] Assding encryption key! +1ms
hfc [MemberServicesImpl.enroll] [Contact ECA] {"ts":{"seconds":{"low":1482991894,"high":0,"unsigned":false},"nanos":0},"id":{"id":"admin"},"tok":{"tok":{"buffer":{"type":"Buffer","data":[55,98,48,100,55,98,102,53,52,55]},"offset":0,"markedOffset":-1,"limit":10,"littleEndian":false,"noAssert":false}},"sign":{"type":0,"key":{"buffer":{"type":"Buffer","data":[48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0,4,39,58,149,138,197,34,25,15,98,0,36,79,214,10,55,88,179,190,68,111,231,223,204,201,62,2,81,242,241,138,48,233,183,50,194,72,22,210,160,209,19,201,209,67,71,108,64,104,133,126,179,196,182,101,244,134,187,133,13,64,70,247,74,248]},"offset":0,"markedOffset":-1,"limit":91,"littleEndian":false,"noAssert":false}},"enc":{"type":0,"key":{"buffer":{"type":"Buffer","data":[48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0,4,171,63,53,201,101,254,147,251,38,81,37,62,121,135,10,98,40,235,167,227,254,10,183,132,194,114,20,252,209,198,6,7,80,246,227,138,85,93,214,14,175,252,161,175,157,87,205,55,174,30,74,61,161,88,109,71,237,130,188,47,148,203,236,156]},"offset":0,"markedOffset":-1,"limit":91,"littleEndian":false,"noAssert":false}},"sig":null} +0ms
hfc [MemberServicesImpl.enroll] failed to create cert pair: err={"code":2,"metadata":{"_internal_repr":{}}} +1s
hfc [memberServices.enroll] err=Error: Identity or token does not match., enrollment=undefined +1ms
/Users/goupadhy/blockchainhfc/SDK-Demo/helloblockchain.js:135
if (err) throw Error("\nERROR: failed to enroll admin : " + err);
^

Error:
ERROR: failed to enroll admin : Error: Identity or token does not match.
at Error (native)
at /Users/goupadhy/blockchainhfc/SDK-Demo/helloblockchain.js:135:24
at /Users/goupadhy/blockchainhfc/SDK-Demo/node_modules/hfc/lib/hfc.js:523:28
at /Users/goupadhy/blockchainhfc/SDK-Demo/node_modules/hfc/lib/hfc.js:756:24
at Object.callback (/Users/goupadhy/blockchainhfc/SDK-Demo/node_modules/hfc/lib/hfc.js:2038:24)
at /Users/goupadhy/blockchainhfc/SDK-Demo/node_modules/grpc/src/node/src/client.js:420:14

@ashish9308
Copy link

I'm also facing the same issue.

E0110 01:42:09.766000000 14180 handshake.c:128] Security handshake failed: {"cre
ated":"@1483992729.766000000","description":"Handshake read failed","file":"..\s
rc\core\lib\security\transport\handshake.c","file_line":237,"referenced_errors":
[{"created":"@1483992729.766000000","description":"End of TCP stream","file":"..
\src\core\lib\iomgr\tcp_windows.c","file_line":180}]}
E0110 01:42:09.773000000 14180 handshake.c:128] Security handshake failed: {"cre
ated":"@1483992729.773000000","description":"Handshake read failed","file":"..\s
rc\core\lib\security\transport\handshake.c","file_line":237,"referenced_errors":
[{"created":"@1483992729.773000000","description":"End of TCP stream","file":"..
\src\core\lib\iomgr\tcp_windows.c","file_line":180}]}
events.js:141
throw er; // Unhandled 'error' event
^

Error
at ClientDuplexStream._emitStatusIfDone (C:\Users\Ashish_Kumar93\Desktop\SDK
-Demo-master\node_modules\grpc\src\node\src\client.js:189:19)
at ClientDuplexStream._readsDone (C:\Users\Ashish_Kumar93\Desktop\SDK-Demo-m
aster\node_modules\grpc\src\node\src\client.js:158:8)
at readCallback (C:\Users\Ashish_Kumar93\Desktop\SDK-Demo-master\node_module
s\grpc\src\node\src\client.js:217:12)

@JoseMiguelHerrera
Copy link

Hello, a team and I are working with HFC as well, and lately we keep getting the same kinds of errors as the ones here. I hope a solution can be found soon.

------------- ca-server, peers and event URL:PORT information: -------------

CA server Url : grpcs://7df3327d8138449c8346897d5ba10392-ca.us.blockchain.ibm.com:30004

Validating Peer0 : grpcs://7df3327d8138449c8346897d5ba10392-vp1.us.blockchain.ibm.com:30004
Validating Peer1 : grpcs://7df3327d8138449c8346897d5ba10392-vp0.us.blockchain.ibm.com:30004
Validating Peer2 : grpcs://7df3327d8138449c8346897d5ba10392-vp2.us.blockchain.ibm.com:30004
Validating Peer3 : grpcs://7df3327d8138449c8346897d5ba10392-vp3.us.blockchain.ibm.com:30004

Event Url on Peer0 : grpcs://7df3327d8138449c8346897d5ba10392-vp1.us.blockchain.ibm.com:31004
Event Url on Peer1 : grpcs://7df3327d8138449c8346897d5ba10392-vp0.us.blockchain.ibm.com:31004
Event Url on Peer2 : grpcs://7df3327d8138449c8346897d5ba10392-vp2.us.blockchain.ibm.com:31004
Event Url on Peer3 : grpcs://7df3327d8138449c8346897d5ba10392-vp3.us.blockchain.ibm.com:31004


Enrolled admin sucecssfully

Enrolled and registered tommy successfully

Deploying chaincode ...
E0112 23:49:13.499530000 4445990912 handshake.c:128] Security handshake failed: {"created":"@1484290153.499493000","description":"Handshake read failed","file":"../src/core/lib/security/transport/handshake.c","file_line":237,"referenced_errors":[{"created":"@1484290153.499482000","description":"FD shutdown","file":"../src/core/lib/iomgr/ev_poll_posix.c","file_line":427}]}

Failed to deploy chaincode: request={"fcn":"init","args":["Scottish Independence","4","edinburgh","glasgow","aberdeen","dundee"],"chaincodePath":"chaincode","certificatePath":"/certs/peer/cert.pem"}, error={"error":{"message":"","stack":"Error\n at /Users/JoseHerrera/BlockVoteNode2-1484110642242/node_modules/grpc/src/node/src/client.js:417:17","code":14,"metadata":{"_internal_repr":{}}},"msg":"Error"}
^C

@ashish9308
Copy link

I'm Still Getting the same error Please help me to resolve..

@samchimp
Copy link

I'm also getting the same error here:
hfc peer.sendTransaction: error={"code":14,"metadata":{"_internal_repr":{}}}
Which manifests itself in my application as:

    Uncaught Error: {"created":"@1484913808.296744000","description":"EOF","file":"../src/core/lib/iomgr/tcp_posix.c","file_line":235,"grpc_status":14}
      at ClientDuplexStream._emitStatusIfDone (node_modules/grpc/src/node/src/client.js:189:19)
      at ClientDuplexStream._receiveStatus (node_modules/grpc/src/node/src/client.js:169:8)
      at node_modules/grpc/src/node/src/client.js:634:14

If anyone has any helpful clues then they'd be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants