The coinbase transaction is always the first transaction in a block. It is how new bitcoin enters circulation.
What is special about it
- It has exactly one input, which does not spend a real coin. Its outpoint is all zeros, and the miner can put arbitrary data in its scriptSig field.
- Its outputs may pay at most the block reward: the current subsidy plus all fees in the block. A miner may claim less, but never more.
- Since SegWit, it also carries an OP_RETURN output with the commitment to the block's witness data.
Maturity
Coinbase outputs cannot be spent until 100 more blocks have been built on top. If the block is later replaced in a reorganisation, the reward disappears, and the rule stops that from rippling into other people's transactions.