1

our wallet project is requried some update about gas price

  • 1 not set gasprice by user
  • 2 auto choose the best gas price

Current, I am using rpc method eth_gasPrice in my wallet's code to get gas price.

My boss requried me not use eth_gasPrice , so is there other way to get the gas price?


extra request

1
  • First, that's a lot of thing you are forbidden to do. Is there a reason ? Second, there is no such thing as "best gas price" as said in a comment of on answer. Jul 30, 2021 at 9:07

1 Answer 1

0

Just let user specify it. Use previously specified value as default gas price for the next transaction.

3
  • If you do this, please set a maximum gas price (like 100 Gwei), to prevent users from accidentally using a way too high gas price and losing a lot of ETH on gas.
    – Morten
    Nov 20, 2019 at 10:32
  • Sorry , I should write requirement first. It's a update of existed wallet project. - 1: not set gasprice by user - 2: auto choose the best gas price Nov 21, 2019 at 2:32
  • There is no such thing as best gas price. There is always a trade-off among how much fee one pays for transaction to be included into blockchain, and how fast the transaction will actually be included. If you cannot use block history nor external API, then you may use history of transactions you've sent. Increase gas price for the next transaction a bit if previous transaction took too much time to be mined and decrease if time was really low. Nov 21, 2019 at 7:09

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.