i generated raw unsigned dogecoin transaction using third party api and now i got this:
0100000001eeb5498b1adbf77d39f1f55b3cd943b9da9f192e444504a968e3b4eb02bb4a850100000000ffffffff010052230b390000001976a914c09113adb3c0dffce410382e0ef2e04d3617047d88ac00000000
i am doing like this but it is not working:
var bitcoin = require('bitcoinjs-lib')
var bitcoin_message = require('bitcoinjs-message')
var DOGECOIN = {
messagePrefix: '\x19Dogecoin Signed Message:\n',
bip32: {
public: 0x02facafd,
private: 0x02fac398
},
pubKeyHash: 0x1e,
scriptHash: 0x16,
wif: 0x9e
}
var keyPair = bitcoin.ECPair.fromWIF(Buffer.from('__myWIF__'), DOGECOIN);
var privateKey = keyPair.__d;
var message = '0100000001eeb5498b1adbf77d39f1f55b3cd943b9da9f192e444504a968e3b4eb02bb4a850100000000ffffffff010052230b390000001976a914c09113adb3c0dffce410382e0ef2e04d3617047d88ac00000000';
var signature = bitcoin_message.sign(message, privateKey, keyPair.compressed);
console.log(signature.toString('base64'));
const bitcoin = require('bitcoinjs-lib')
const DOGECOIN = {
messagePrefix: '\x19Dogecoin Signed Message:\n',
bip32: {
public: 0x02facafd,
private: 0x02fac398
},
pubKeyHash: 0x1e,
scriptHash: 0x16,
wif: 0x9e
}
// myWif is a string, fromWIF takes a string not a Buffer
const keyPair = bitcoin.ECPair.fromWIF('__myWIF__', DOGECOIN);
const txHex = '0100000001eeb5498b1adbf77d39f1f55b3cd943b9da9f192e444504a968e3b4eb02bb4a850100000000ffffffff010052230b390000001976a914c09113adb3c0dffce410382e0ef2e04d3617047d88ac00000000';
const tx = bitcoin.Transaction.fromHex(txHex);
const txb = bitcoin.TransactionBuilder.fromTransaction(tx, DOGECOIN);
// This assumes all inputs are spending utxos sent to the same Dogecoin P2PKH address (starts with D)
for (let i = 0; i < tx.ins.length; i++) {
txb.sign(i, keyPair);
}
const signedTxHex = txb.build().toHex();
// Broadcast this signed raw transaction
console.log(signedTxHex)
Most helpful comment