2

This question already has an answer here:

Is this proportional to time required to process? Is a high gas transaction more expensive for the miner to include in a block and does it add more to blockchain size than a low gas transaction?

marked as duplicate by Waqar Lim Apr 7 '16 at 14:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Gas is directly proportional to the cost of computation of the transaction. More operations or interactions with stored data means higher gas cost for the sender. Also, more expensive operations mean more gas. So yes, the op code matters a great deal (e.g. SHA3 is naturally going to be more expensive than EQ). The gas is calculated by the client of the sender.

The gas is paid to the miner because yes, a high gas transaction is naturally more expensive to process (because it is more computationally expensive).

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