1

I am looking at the possibility of creating a custom token on the Ethereum network & wanted to know if there is a way if i can put an limit on the gasPrice in order to prevent the so called "gas wars" ?

1 Answer 1

2
require(tx.gasprice < 5 * 1000000000);

From Block and transaction properties. Solidity Docs

5
  • what happens to the state of the transaction if i do this ? Jan 31, 2018 at 15:05
  • 1
    "require(false) compiles to 0xfd which is the REVERT opcode, meaning it will refund the remaining gas." Source. Jan 31, 2018 at 15:08
  • The transaction will be reverted to the initial state. Jan 31, 2018 at 15:11
  • its safe to say that require(false) is equal to if(false) revert(); ? Jan 31, 2018 at 15:52
  • 1
    @SujalMandal yes. Solidity performs a revert operation (instruction 0xfd) in both scenarios. Jan 31, 2018 at 16:00

Your Answer

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

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