How does a miner verify a transaction which is spending an output of another transaction in the same block?
While a miner is building a block template, they are maintaining a &quot;virtual&quot; UTXO set to keep track of the consumed UTXOs and the newly created UTXOs. A transaction can only be included in a block once all of its inputs are available for spending, so this approach is also sufficient to achieve the required topological order of transactions.