Skip to content

Is it possible to spend a coinbase output? #58

@CharikovAI

Description

@CharikovAI

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions