txpool_inspect方法不存在/不可用

问题描述 投票:1回答:1

我无法使python函数web3.geth.txpool.inspect()正常工作。

我已经尝试从命令行,ethereum/client-go容器和trufflesuite/ganache-cli:v6.7.0容器中使用geth服务器。

在每种情况下,我都会收到一个txpool_inspect方法丢失的错误。我正在运行的代码非常简单,使用Python 3.7.5或3.8:

from web3 import Web3
thing = Web3("http://localhost:42424")
thing.geth.txpool.inspect()

我正在使用web3py == 5.2.2。

[对于Geth,我尝试过:--dev --mine --rpc --rpcaddr 0.0.0.0 --rpcport 42424 --verbosity 4我也尝试了多种其他启动选项,似乎没有什么让我越过主题标识的错误,即txpool_inspect不存在或丢失。

我想先在测试/开发环境中使用它,然后再在真正的区块链上尝试。

建议?

ethereum web3 go-ethereum geth ganache
1个回答
0
投票
  1. 使用HTTPProvider初始化Web3:
from web3 import Web3, HTTPProvider
thing = Web3(HTTPProvider("http://localhost:42424"))
thing.geth.txpool.inspect()
  1. 例如,使用rpcapi标志运行您的节点:
--rpcapi "eth,net,web3,txpool"
© www.soinside.com 2019 - 2024. All rights reserved.