How to include my base64 signature to spend a UTXO

+2 votes
I'm trying to use the bitcoinjs-lib to spend an UTXO. I have a signature from the prior transaction that is in base64 format. I have the following standard transaction builder as a starting base:

var bitcoin = require(‘bitcoinjs-lib’);
var key = bitcoin.ECKey.fromWIF("put data here");
var tx = new bitcoin.TransactionBuilder();
tx.addInput("txid here", 1);
tx.addOutput("receiver addr here", 345000);
tx.sign(0, key);
console.log(tx.build().toHex());

var key = Bitcoin.ECKey.fromWIF(‘private key’);
var tx=Bitcoin.Transaction.fromHex(‘HEX-data from step 1’);
tx.sign(0, key);
tx.toHex(); // HEX-data of signed transaction

All of these standard transaction builders like the above no matter what the programming language insist on using a WIF key format. But I need to use a base64 signature that I have already to build the transaction. I'm participating in a challenge and apparently that is the challenge  --- to figure out how to spend the UTXO using a base64 signature that was provided participants. Can someone help me with this?
asked Oct 5, 2019 by Writer007
Is this question related to MultiChain?
Greetings,

Well, I presume it is somewhat related as base64 signatures are apparently apart of the bitcoin structural system. Messages are indeed signed and encoded in base64, correct? Anyway, I've figured out that all I need to do is use the base64 signature and create a transaction with it. I've decoded the base64 and have the 'r' and 's' values minus the one byte prefix. I guess encoding that into a DER may suffice. But I want to know how to construct a transaction using the base64 signature. I've converted it into a bytearray as well. But since I'm not a programmer by trade, I don't know how to build a code to utilize the info. So, again the question is how to utilize a base64 signature to construct a new transaction, preferably a python code.

1 Answer

0 votes
While this question does not appear to be related to MultiChain, I think the short answer is that you cannot use the signature from one transaction in order to sign another. That would make signatures fairly useless.
answered Oct 29, 2019 by MultiChain
...