-I recall from MIT cryptocurrency lectures they say the difference in value goes to miners as a fee.
-Then I read this paper counting a fee UTXO out of every transaction (they are building equations according to this)
How are these different from one another? they both lead to the same answer, let's assume a block with 2 transactions
input 1 = 10
input 2 = 15
output 1 =5
putout 2= 10
First method :
fees = (input 1 + input 2) - (output 1 + output 2 )
fees = (10 + 15) - (5 + 10 ) = 10
Second method
fees = (input 1 - output 1) + (input 2 - output 2)
fees = (10 - 5 ) + (15 - 10) = 10
As far as speed is concerned, getting the SUM of inputs and outputs and performing a single subtraction would most likely be a lot more effienct than performing n number of subtraction and then getting the SUM of all of them, but will the number differ? NO.
Now, on how the miner gets the block fees, they get it as an output that has no input, if the total difference between inputs and outputs was 1
BTC and the block reward was 6.25
BTC a new output will be created out of "nowhere" with a total value of 7.25
BTC, if the coinbase transaction contains only 1 address the whole 7.25 will go to that address and if it contains 500 addresses it will go to all of them according to how the miner actually wants.
So to sum up, the fees themselves are NOT outputs but when the block is mined the fees become a new output spendable by the miner.