I know that a coinbase transaction must have one input, but can it have more than one?
-
See Does a coinbase transaction's input field have a VOUT field? which has answers that describes some of the rules relating to number of inputs and contents for coinbase transactions. – RedGrittyBrick Sep 02 '22 at 13:17
2 Answers
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)

- 75,206
- 34
- 186
- 622
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.

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