1

I am following this git repository to setup node SDK for hyperledger network: https://github.com/hyperledger/fabric-sdk-node. I was able to invoke/query a transaction through CLI. But, when I tried the same using Node SDK, I could not add a peer to the channel instance and it is throwing this particular error: E1219 19:56:36.154387360 20765 ssl_transport_security.cc:1237] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed.

I could add an orderer to the same channel on the previous step and so I could not understand the logic behind it. Any help would be hugely appreciated.

const ordererCertPath = ORGS.orderer0.tls_cacerts;
const ordererCertData = fs.readFileSync(path.join(__dirname, ordererCertPath));
const ordererCert = Buffer.from(data).toString();

const peer0CertPath = ORGS.belrium.peers.peer1.tls_cacerts;
const peer0CertData = fs.readFileSync(path.join(__dirname, peer0CertPath));
const peer0Cert = Buffer.from(peer0CertData).toString();

let tlsInfo = null;

orgName = ORGS[userOrg].name;

let promise;
promise = Client.newDefaultKeyValueStore({
    path: testUtil.storePathForOrg(orgName)});

return e2eUtils.tlsEnroll(userOrg)
    .then((enrollment) => {
        console.log('Successfully retrieved TLS certificate');
        tlsInfo = enrollment;
        client.setTlsClientCertAndKey(tlsInfo.certificate, tlsInfo.key);
        return promise;
    }).then((store) => {
        if (store) {
            client.setStateStore(store);
        }
        return testUtil.getSubmitter(client, userOrg);
    }).then((admin) => {

        console.log('Successfully enrolled user \'admin\' (e2eUtil 3)');
        the_user = admin;

        channel.addOrderer(
            client.newOrderer(
                ORGS.orderer0.url,
                {
                    'pem': caroots,
                    'ssl-target-name-override': ORGS.orderer0['server-hostname']
                }
            )
        );


  //Error part starts here.....



            const peer = client.newPeer(
                ORGS.belrium.peers.peer1.requests,
                {
                    pem: peer0caroots,
                    'ssl-target-name-override': ORGS.#{userorg}.peers.peer1['server-hostname']
                }
            );
            channel.addPeer(peer);
            return channel.initialize();
sabhari karthik
  • 1,361
  • 6
  • 17

1 Answers1

1

Verify organisation definition and their certificates, you can compare the peer organisatio n peer certificate with the certificate used in CLI.