Closed vbaranov closed 6 years ago
Safe price is 50 Gwei now.. https://ethgasstation.info/
Can we get safe price by API and show an alert if safe price is > selected price?
Etherscan doesn't seem to have a public API to get that information. The endpoint they use does not support CORS, so I don't think we can use it.
I looked around for an alternative, but didn't find anything. If someone finds a public API for this, it should be an easy addition.
@fernandomg found this https://etherscan.io/apis#proxy
The second to last method, eth_gasPrice
, gives a result like this:
{
"jsonrpc": "2.0",
"result": "0xdf8475800",
"id": 73
}
(That's 60000000000 in hex)
Maybe we can use that as the basis of the "slow, normal, fast" options for gas price. Say, 1.0x, 1.25x and 1.5x times the result of the current gas price?
Btw, it has a limit of 5 requests per second for each token. If we make sure that only one request is done in the whole wizard, we should be good. But if a lot of users connect at the same time, or if a malicious user copies the token from the devtools and does a lot of requests, the token will be blocked and the app will stop working.
Franco, they released onchain oracle
Do you feel that you can integrate it with Wizard on main net? https://twitter.com/ethgasstation/status/938951134399647744
ethgasstation/ethgasstation-adaptive-oracle
I tried to get that working but couldn't do it. I opened an issue in the repo about my problem, so I'll try later when they answer me.
I'm not sure how this would work, though. Would we be responsible to run the script and point it to some contract that holds the last gas price?
For the reference https://github.com/ethgasstation/ethgasstation-adaptive-oracle/issues/4
We will host the oracle, will get information from it (onchain) to estimate a safe price.
@fvictorio what is our plan with deploying gas price oracle.. I think we need it for mainnet
@igorbarinov, sorry, I just saw your message, I must have missed it in my inbox.
I'll give another chance to run it locally. I don't understand the 'onchain' part of this, though. Can we just use it as a sort of backend service, so that the ICO Wizard uses it to ask the gas price?
I'm not sure I understand how it would work onchain. Some sort of smart contract that just holds the gas price, and a setter function for the oracle to update it periodically?
The plan I thought about:
It would be awesome if there already is a contract we can query. I'm going to ask them.
@fvictorio they have a simpler oracle. Roman added a simple API and monitoring to it. please try it in your local dev environment https://github.com/poanetwork/ethgasstation-gasPrice-estimate
results of API call will be parameters for gas estimates in the dapp. if API is not available we'll use only custom field and show an alert to the user
Cool, I'll check it out.
@fvictorio please abandon the last link the service was rewritten here https://github.com/banteg/gasprice
I checked it but I wasn't able to make it work (see https://github.com/banteg/gasprice/issues/1). I'll give it another try, using an Infura node.
I deployed it here https://gasprice.poa.network/ please use it for integration
Awesome, thanks.
Just for the record, that endpoint doesn't support CORS. That means that (I think) it will work on https://wizard.poa.network, but probably won't in https://wizard.oracles.org.
thank you for mentioning, added cors *
the chain is not fully synced but we can the oracle
If you are reporting a problem with ICO Wizard, please include the following information:
Which network did you use? (Mainnet, Kovan, Rinkeby, etc.)
Mainnet
If you were able to create it, what is the URL of your crowdsale?
There is no crowdsale. Issue happens on the first transaction.
Do you have screenshots showing the problem?
Do you see errors in the dev console? If yes, please include a screenshot
(To open the dev console in Google Chrome, press F12, or go to
View -> Developer -> Developer Tools
, and open the Console tab)No