0

I am developing an application in Python to deal around with some Ether. I have geth installed and web3.py and do have an issue with different bahaviour of isConnected().

Geth: geth-alltools-darwin-amd64-1.8.15-89451f7c (latest)

web3.py: 4.6.0 (latest)

Python: 3.7

Mac OS X

I start geth like this:

./geth --syncmode=light --cache=1024 --maxpeers=12
./geth --testnet console

Example Code:

from web3.auto import w3
if (w3.isConnected()):
    print("I am connected")
else:
    print("I am not connected")

The behaviour of isConnected() is as expected as long as I am using mainnet. In case of testnet isConnected() is always False, even the chain is fully synched!

Any idea what I am doing wrong?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Simon
  • 1
  • 2

1 Answers1

0

you need to change the url of mainnet to any testnet

AnkushRasgon
  • 782
  • 1
  • 6
  • 14