1

A typical transaction has one or more inputs and one or more outputs. Since there is no amount specified for inputs, the rule is that ALL of the inputs is always transferred. Any discrepancy between the value contained in the inputs and the total value of the outputs is lost forever.

When a transaction is first submitted there may be a discrepancy between the values of the inputs and outputs. The miner assembling the block may redirect that unaccounted for difference to themselves or any address they wish, called a "transaction fee", however my question is how do they do this?

It would seem the only way to do this would be to add new output to the transaction and new script to send the value to the output. So in other words the miner would change the transaction from the form submitted by the original poster, to a new form including the fee transmittal.

However, isn't the transaction hashed to prevent someone from altering it? If a miner can alter it, why not alter it to just direct all the input to themselves?

2

A typical transaction has one or more inputs and one or more outputs. Since there is no amount specified for inputs, the rule is that ALL of the inputs is always transferred. Any discrepancy between the value contained in the inputs and the total value of the outputs is lost forever.

This is not correct. The difference between the input amount and the output amount is exactly what we call fee. It is not lost.

It would seem the only way to do this would be to add new output to the transaction and new script to send the value to the output. So in other words the miner would change the transaction from the form submitted by the original poster, to a new form including the fee transmittal.

That is not possible. Miners cannot modify transactions.

Instead, there is simply a rule that the coinbase transaction (the first transaction in each block, created by the miner) is allowed to have outputs whose summed amount is up to the subsidy value (currently 25 BTC, soon 12.5 BTC) plus the sum of all the fees of the other transactions in the block.

1

Any discrepancy between the value contained in the inputs and the total value of the outputs is lost forever.

No, not true. The discrepancy between the consumed inputs' value and the assigned outputs' value is the transaction fee.

Miners cannot change transactions or add outputs as that would invalidate the signature. Instead, they collect the transaction fees in the Coinbase transaction.

The three relevant rules hereby are:

  1. For a regular transaction: Σ(inputs) ≥ Σ(outputs)
    The difference may be collected as the transaction fee.
  2. For the coinbase transaction: output ≤ block subsidy + transaction fees
    The output is equal to block subsidy and fees when the miner collects it in full.
  3. For a block: Σ(inputs) + block subsidy ≥ Σ(outputs)
    Again, this is equal when the miner collects the maximum allowed reward.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.