我有这个代码:
var bitcoin = require('bitcoinjs-lib')
var testnet=bitcoin.networks.testnet;
var bitcoin = require('bitcoinjs-lib')
var privateKey = 'cV1hT8dqY6T3UnFjKk883N3nr895JeBVFjMMqi6VbPgDZyfVfzAF'
var keyPair = bitcoin.ECPair.fromWIF(privateKey, testnet);
const RawTransaction = new bitcoin.Psbt(testnet)
RawTransaction.addInput({hash:'9412f5e46f63a65ae140d36cbe6fe137e7f6b047759a8487a73abd5f25727bff', index:0})
RawTransaction.addOutput({address:'tb1q8selj8yz0yh79esajd77x3r6ea5q0vf8svjev4', value:0.00001})
RawTransaction.sign(0, keyPair)
var Transaction = RawTransaction.build().toHex();
console.log(Transaction)
我有这个错误:
Error: tb1q8selj8yz0yh79esajd77x3r6ea5q0vf8svjev4 has an invalid prefix
我不明白发生了什么。目标地址是由电子钱包生成的,似乎是正确的。我正在使用测试网。