# What is the difference between the "legitimately remaining gas" and the "total gas that remains"?

So, first we're told that g' is the "legitimately" remaining gas. But then we're told that g*, where g* >= g', is "the total gas that remains". If g' is the remaining gas, how do we add to it to arrive at the "total gas that remains"? What is the difference between the "legitimately remaining gas" and the "total gas remaining"? Is g* not greater than or equal to the amount of gas actually remaining? And who's meant to make up this potential difference, the miner?

Additionally, what is the significance of the (Tg-g')/2? Is this halving just arbitrary? Quite confused by this equation.

• g' is the unspent gas
• Tg is the gas specified in the transaction
• Tg - g' is the gas spent by the transaction
• Ar refundable gas from execution

Let's suppose we have a 1000 gas transaction, 600 gas are spent by the execution and there are 350 gas for refund.

• g' = 400
• Tg = 1000
• Tg - g' = 600
• Ar = 350

From the formula g* = g' + min((Tg - g') / 2, Ar) = 400 + min(300, 350) = 700.

Those 700 will be returned to the transaction's sender. They will be discounted from the original 1000 that they paid before executing the transaction. The net result is sender has paid 300 for the transaction.