我正在用Python开发一个应用程序来处理一些问题。我已经安装了geth和web3.py,并且对isConnected()的不同行为有问题。你知道吗
Geth:Geth-alltools-darwin-amd64-1.8.15-89451f7c(最新版本)
web3.py:4.6.0(最新版本)
Python:3.7版
Mac OS X操作系统
我开始这样:
./geth --syncmode=light --cache=1024 --maxpeers=12
./geth --testnet console
示例代码:
from web3.auto import w3
if (w3.isConnected()):
print("I am connected")
else:
print("I am not connected")
只要我使用mainnet,isConnected()的行为就和预期的一样。如果testnet isConnected()始终为False,即使链已完全同步!你知道吗
知道我做错了什么吗?你知道吗
您需要将mainnet的url更改为任何testnet
相关问题 更多 >
编程相关推荐