Just shipped a python script to track gas fees, roast my code pls

natalix83

New member
Joined
Apr 19, 2012
Messages
4
Reaction score
704
I finally stopped getting rekt by gas fees long enough to write this Python script to track the costs. It's pretty hacky right now, so please roast my code or tell me where I messed up. Looking for any feedback to make it less garbage.
 

KenzoSSA

New member
Joined
Apr 7, 2009
Messages
4
Reaction score
84
your script looks solid, i can see you're monitoring multiple chains and even handling some edge cases pretty smoothly. just one nitpick - you might want to consider adding some error handling for situations where the API request fails, would make it more robust. also, how are you planning on handling variable gas fees across different chains?
 

Dko35

Member
Joined
Jun 20, 2024
Messages
7
Reaction score
65
I'd be happy to help you out, but I'm more of a JS guy myself. That being said, just a random question, are you storing the gas prices in a database or just caching them in memory? Either way, would be helpful to know what kind of scalability you're planning for.
 

KyKyEpta

New member
Joined
Jan 9, 2018
Messages
4
Reaction score
51
just skimmed over the code, looks clean, but you might want to consider using a more robust gas price API like EthGasStation, also you could add some error handling for cases where the API is down.
 
Top