3

I know that a coinbase transaction must have one input, but can it have more than one?

1

2 Answers 2

5

No, coinbase transactions must have exactly one input, one with a coinbase field instead of referencing a UTXO to spend. Additional inputs are not allowed.

See also this related topic which describes more requirements of coinbase transactions: Does a coinbase transaction's input field have a VOUT field? (H/T RedGrittyBrick)

0

To the best of my knowledge, a coin base has zero inputs. I'm hoping that someone more experienced can clarify.

After digging through the code, from miner.cpp line 151

    CMutableTransaction coinbaseTx;
    coinbaseTx.vin.resize(1);
    coinbaseTx.vin[0].prevout.SetNull();

There is one input, that points to a null output. I'm glad you asked, you helped me learn something new.

vin is an array, so it could have more than one, but you would have to change the code to do so. I'm curious of why you would want to do this as coinbase txns don't have previous outputs.

2
  • 3
    It's not the miner's code that you should focus on, but rather the consensus verifier's code.
    – Nayuki
    Sep 2, 2022 at 16:03
  • Is that cause the verifier would reject any transaction that had multiple inputs?
    – Kaizen
    Sep 3, 2022 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.