bitcore-lib
bitcore-lib copied to clipboard
Fail To complete transaction
Am getting this error and i don't understand why.
TypeError: r.gt is not a function
ECDSA../node_modules/bitcore-lib/lib/crypto/ecdsa.js.ECDSA.sigError
here is my code for performing a transaction
export function sendBTC(paperWallet, toAddress, amount, network) {
const insight = new explorer.Insight(network)
insight.getUnspentUtxos(paperWallet.address, (err, utxos) => {
if(err) {
console.log(err)
}
console.log(utxos)
console.log(paperWallet.privateKey)
const tx = new bitcore.Transaction()
tx.from(utxos)
tx.to(toAddress, amount) // amount in satoki
tx.fee((amount* 0.2))
tx.sign(paperWallet.privateKey)
tx.serialize()
insight.broadcast(tx, (err, txid) => {
if(err) {
console.log(err)
}
console.log('transaction sent :' + txid)
})
})
}
try not use yarn https://github.com/bitpay/bitcore-lib/issues/109