I am using Infura with the mainnet and web3py to interact with smart contracts and send transactions. Last week this same code worked fine, but today, trying to send the transaction for the deployment of the contract, I get this error message, on the waitForTransactionReceipt method:

File "pruebaPagos.py", line 303, in <module>
tempsensorContract, w3, nonce = construirContrato()
File "pruebaPagos.py", line 139, in construirContrato
tx_receipt = w3.eth.waitForTransactionReceipt(tx)
File "/root/Proyectos/bchain/rafa-py3/local/lib/python3.5/site-packages/web3/eth.py", line 223, in waitForTransactionReceipt
return wait_for_transaction_receipt(self.web3, transaction_hash, timeout)
File "/root/Proyectos/bchain/rafa-py3/local/lib/python3.5/site-packages/web3/utils/transactions.py", line 70, in wait_for_transaction_receipt
File "/root/Proyectos/bchain/rafa-py3/local/lib/python3.5/site-packages/web3/utils/threads.py", line 68, in sleep
File "/root/Proyectos/bchain/rafa-py3/local/lib/python3.5/site-packages/web3/utils/threads.py", line 61, in check
raise self
web3.utils.threads.Timeout: 120 seconds

Below is my Python code that uses web3 for the deployment of the contract. I've tried to put different gas prices, but it doesn't work either. Anyone knows what is going on here? Is this an Infura problem?

contract_source_code = '''
   #my solidity source code

compiled_sol = compile_source(contract_source_code)
contract_interface = compiled_sol['<stdin>:tempSensor']

#connection to infura
w3 = Web3(HTTPProvider('https://mainnet.infura.io/MY-API-KEY'))

from web3.middleware import geth_poa_middleware

w3.middleware_stack.inject(geth_poa_middleware, layer=0)

count =  w3.eth.getTransactionCount(account,"pending") 

gasPrice = w3.toWei('3.5','gwei')

#creating the contract and its transaction for the deployment
TempSensor = w3.eth.contract(abi=contract_interface['abi'], bytecode=contract_interface['bin'])
transaction = TempSensor.constructor().buildTransaction({
        'gas': w3.toHex(850000),
        'gasPrice': w3.toHex(gasPrice),
        'nonce': w3.toHex(count),

#sign the transaction and send
signed = w3.eth.account.signTransaction(transaction, key)
tx = w3.eth.sendRawTransaction(Web3.toHex(signed.rawTransaction))
print('Transaction for the deployment:')

tx_receipt = w3.eth.waitForTransactionReceipt(tx)

tempsensorContract = w3.eth.contract(
    address = tx_receipt.contractAddress,
    abi = contract_interface['abi'],

In etherscan.io it can't even find my transaction hash. It says:

  • Sorry, we are unable to locate this Transaction Hash

1 Answer 1


The current network gasprice is ~60 gwei. Your transaction is likely being broadcast, but your script times out while waiting for it to be mined, since it is not mined in the next 120 seconds due to a low gasprice.

Similarly, etherscan often does not index transactions that are far below the network gas price at the moment.

  • But I don't know why last week, every transaction that I made with less than 10 gwei in gasprice was broadcast in less than a minute. And know it isn't.
    – RJ-mac
    Aug 9, 2018 at 10:17
  • The gas price was lower last week. Aug 9, 2018 at 10:18
  • Thanks, is there any site where I can see the current gasprice, and the gasprice of the last few weeks?
    – RJ-mac
    Aug 9, 2018 at 10:19
  • You can see the current one at ethgasstation.info, not sure about historical sources Aug 9, 2018 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.