I have opened an instance of ganache at localhost port 9545 where I can connect with web3.py. However when I am trying to perform a transact using the below code:

w3 = Web3(Web3.HTTPProvider(''))

ExampleContract = w3.eth.contract(abi=abi, bytecode=bytecode)

tx_hash = ExampleContract.constructor().transact()

I am getting the following error:

ValueError: {'message': 'from not found; is required', 'code': -32000, 'data'

This is straight from the documentation here

Any ideas?

  • 1
    Try ExampleContract.deploy({'from': web3.eth.accounts[0], 'gasPrice': web3.eth.gasPrice, 'gas': web3.eth.getBlock('latest').gasLimit}) Nov 9, 2020 at 20:48
  • Or simply use transact({'from': web3.eth.accounts[0], 'gasPrice': web3.eth.gasPrice, 'gas': web3.eth.getBlock('latest').gasLimit}) in your own code. Nov 9, 2020 at 20:50

1 Answer 1


Like the comments say, you need to have the 'from' address defined in your transaction parameters. Geth changed that requirement a few releases ago. So:

tx_hash = ExampleContract.constructor().transact({'from': <address>})


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.