Skip to content

Instantly share code, notes, and snippets.

@staccDOTsol
Created July 14, 2021 02:48
Show Gist options
  • Save staccDOTsol/5c52dd57a05865ecae1ec3c55f667049 to your computer and use it in GitHub Desktop.
Save staccDOTsol/5c52dd57a05865ecae1ec3c55f667049 to your computer and use it in GitHub Desktop.
from web3 import Web3
w3= Web3(Web3.HTTPProvider("https://mainnet.infura.io/v3/yourkey", request_kwargs={'timeout': 60}))
from web3.gas_strategies.time_based import construct_time_based_gas_price_strategy
time_based_gas_price_strategy = construct_time_based_gas_price_strategy(
 9, 120, 98
 )
w3.eth.set_gas_price_strategy(time_based_gas_price_strategy)
actual = w3.eth.generate_gas_price()
print(actual)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment