我在试着在比特币测试网络上创建一个交易。当我运行insight.getUnspentUtxos()时,它返回一个错误。
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错误
https://stackoverflow.com/questions/66856035
复制相似问题