Javascript 无法连接bitcore testnet,出现以下错误525原始SSL握手错误
我正试图在比特币测试网络上创建一个转码。当我运行insight.getUnpentutXOS()时,它返回一个错误Javascript 无法连接bitcore testnet,出现以下错误525原始SSL握手错误,javascript,blockchain,bitcore,Javascript,Blockchain,Bitcore,我正试图在比特币测试网络上创建一个转码。当我运行insight.getUnpentutXOS()时,它返回一个错误 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
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);
}
})
}
})
当UnspentUtxos()执行时,会出现一些长而大的错误。描述错误525来源SSL的Hanshake错误
bitcore
正在使用bitpay
作为默认提供程序服务器,并且由于某些原因,它无法工作。他们还建议更改中的默认服务器。
尝试将提供程序更改为zelcore
,如下所示:
const explorers = require("bitcore-explorers");
const insight = new explorers.Insight("https://explorer.btc.zelcore.io");
更多解释