3 ms·
I have been trying to make the transition from being an AI engineer to being a web3 engineer recently so I've decided to make this. Turns out extracting the ga
by ttchu 5y ago
I have been trying to make the transition from being an AI engineer to being a web3 engineer recently so I've decided to make this. Turns out extracting the gas price was easy and I was able to create the whole thing in a couple of hours. Then I realized I really want an alert to tell me when the gas is cheap enough to buy my favourite NFT, so I added it... except that this feature took me almost 4 days to add.... I have been programming for over 30 years but I have always been doing microcomputing, server, data analysis and AI. I've never done any front end UI programming at all. Cross-browser and cross-platform compatibility for this notification feature was really nothing but a huge pain in the arse, and I still couldn't find a way to get that work in any apple products.
Anyway, I don't know how many more months the gas price will still be relevant, but here it is, a gas monitor with alert. Let me know what you think?
- mritchie712 5y agoNice work! If you're looking for a simpler way to set up complicated alerts, try Luabase (https://luabase.com/ https://luabase.com/). I wrote some SQL to get the median and average gas price for the past 24 hours, but you could tweak it to do whatever you want. All the queries instantly have an API endpoint and you can send the result to destinations like over email or webhook. with mgp as ( select median(gas_price) as mgp, avg(gas_price) as agp from ethereum.transactions as t where 1=1 and t.block_timestamp > toUInt32(now() - INTERVAL 24 HOUR) ) select m.mgp, ((m.mgp \* 21000) / 1e18) as mgp_in_eth, ((m.agp \* 21000) / 1e18) as agp_in_eth from mgp as m https://luabase.com/run/d06b57e2c4624299895e5690191c7624 https://luabase.com/run/d06b57e2c4624299895e5690191c7624