Is it possible to spend a coinbase output?
Opened this issue · 0 comments
CharikovAI commented
I'm trying to spend a generated UTXO in this way:
final keyPair = ECPair.fromWIF(wif, network: regtest);
var p2pk = new P2PK(
data: new PaymentData(pubkey: keyPair.publicKey),
network: regtest)
.data;
final txb = new TransactionBuilder(network: regtest);
txb.setVersion(1);
txb.addInput(
input.id,
input.outputIndex,
null,
p2pk.output
);
// ..... addOutput and sign
After broadcasting I'm getting an error mandatory-script-verify-flag-failed (Signature is found in scriptCode) (code 16)
If it is possible can you provide an example how to do this ?