0

I am new to this. So, how do I connect web3.py with Ganache. I've got Ganache up and running, smart contract deployed. I would like to interact with it from, lets say, a python shell. So, this is what I get:

>>> from web3 import Web3
>>> w3 = Web3(Web3.IPCProvider('http://127.0.0.1:7545'))
>>> w3.isConnected()
False

I can connect with Ganache using truffle. Is it possible to do it with web3.py?

1

try

w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:7545'))

Also, make sure that the port is correct (usually ganache-cli listen on 8545)

Source: web3.py quickstart

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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