Unable to connect with bitcore testnet getting following error 525 Origin SSL Handshake Error

407 views Asked by At

I'm trying to create a transcation on the the bitcoin test network. When I run insight.getUnspentUtxos() it return an error.

var bitcore = require('bitcore-lib');

var explorers = require('bitcore-explorers');
var insight = new explorers.Insight('testnet');

var value = Buffer.from('I am trying to create new private key');
var hash = bitcore.crypto.Hash.sha256(value);
var BN = bitcore.crypto.BN.fromBuffer(hash);
var privateKeyNew = bitcore.PrivateKey(BN, 'testnet')
var myAddress = privateKeyNew.toAddress()
console.log(myAddress);

var newValue = Buffer.from('I am trying to create new private key but that can be risky');
var newhash = bitcore.crypto.Hash.sha256(newValue);
var newBN = bitcore.crypto.BN.fromBuffer(newhash);
var privateKey = bitcore.PrivateKey(newBN, 'testnet')
var address = privateKey.toAddress();
console.log(address);

insight.getUnspentUtxos(myAddress, ( err, utxo ) => {
    if(err) {
        console.log(err);
        return err;
    } else {
        let tx = bitcore.Transaction()
        tx.from(utxo);
        tx.to(address,10000);
        tx.fee(50000);
        tx.change(myAddress);
        tx.sign(privateKeyNew);
        tx.serialize();

        insight.broadcast(tx.toString(), (error, txid) => {
            if(error) {
                return error;
            } else { 
                console.log(txid);
        }
    })
}

})

As the UnspentUtxos() execute it give some long massive error. Which describe error 525 Origin SSL Hanshake Error

1

There are 1 answers

0
Surf3r On

bitcore is using bitpay as the default provider server, and for some reason, it is not working. They also recommend changing the default server in the docs. Try changing the provider to zelcore like this:

const explorers = require("bitcore-explorers");
const insight = new explorers.Insight("https://explorer.btc.zelcore.io");

More explanation here