3

I'm trying to send ether to a contract that has a fixed gas price, so I want to know if I can incentive miners to accept my transaction before someone else's by setting a high gas limit. Do miners work this way (ie. if there are two transactions to choose from, both doing the same thing for the same gas price, can they choose the higher gas limit one and make more eth by mining it?), or is the amount of gas used fixed based on the transaction data, opcode, etc.?

2
  • For a short answer: yes Check out here for more info :ethereum.stackexchange.com/questions/8962/…
    – thefett
    Sep 11, 2017 at 2:29
  • This link does not answer my question, it just says that setting a high gas price will incentivize miners. My question is how to incentivize when the gas price is capped.
    – troyth
    Sep 12, 2017 at 16:47

2 Answers 2

1

Yes, you can prioritise your transaction over others by offering a higher transaction fee (transaction fee = gas value * gas price).

Miners tend to prefer transactions that carry a higher transaction fee and will therefore prioritise such a transaction over others regardless of the type of transaction and what the transaction entails.

Some smart contracts have maximum gas limits set on a method level and would reject txns that exceed this limit.

3
  • Doesn't look right. Firstly, transaction fee = gas consumed * gas price. Miners can't know the gas consumed until they've executed the tx. Secondly, a transaction offering a low gas price but is lengthy could cost more than a quick value transfer with a high gas price. You can fit more low-gas transactions into a particular gas limit than you can high-gas limit transactions (obviously). Thirdly, the gas price can be so low as to cause an expected loss for a miner (due to uncle-ing and stales). Thus, you're shooting yourself in the foot twice by prioritizing on high transaction fees.
    – lungj
    Sep 11, 2017 at 5:35
  • Agreed that the transaction fee is only 'potential' and not guaranteed but generally miners tend to prefer txns with a higher potential fee. Similar question - ethereum.stackexchange.com/a/13055/15853 and ethereum.stackexchange.com/a/6111/15853 sheds light on the default impl for Geth and Parity
    – navpal
    Sep 12, 2017 at 4:11
  • Both of those links run counter to what you wrote in your answer: they both state that price is prioritized first, not fee, by default (and, in fact, the second answer states that low gas limit is considered an alternative strategy in Parity -- but not what you suggest, which is high gas limit). The low gas limit makes sense to me for some cases such as when you want to maximize number of transactions to clear a backlog. The other strategies for Parity seem dominant to a "higher transaction fees-first" (which can't cheaply be evaluated) strategy for any of the metrics I can think of.
    – lungj
    Sep 12, 2017 at 4:15
0

I had never heard of the term "fixed gas price" and was about to answer that there is no such thing. Then I started thinking that a contract may check the gas price with tx.gasprice and revert transactions which don't fit some desired gas price value and it might even make some sense.

The more I think about it the more it might make sense for example for ICOs which want equal treatment for all participants.

If you can't use gas price as incentive for the miners there isn't basically anything you can do as gas price is supposed to be the incentive. Setting a different gas limit will not give the miners any more income - it's just the upper bound for gas usage in your transactions and it doesn't change anything for the miners unless the transaction runs out of gas. I assume you want your transaction to go through so it doesn't make sense to set too low gas limit but setting it too high won't help you incentivize the miners.

The only thing I can think of on how to improve your chances is to send multiple transactions (with different nonces) and preferably even from different nodes. In this case you have to be prepared that all of the txs go through at some point. This is typically not a very viable option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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