【问题标题】:the method txpool_inspect does not exist/is not available方法 txpool_inspect 不存在/不可用
【发布时间】:2020-02-26 03:56:18
【问题描述】:

我无法让 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 不存在或丢失。

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

建议?

【问题讨论】:

  • web3 服务器正在抛出错误 - 如果我没有说清楚的话。

标签: ethereum web3 go-ethereum geth ganache


【解决方案1】:
  1. 使用 HTTPProvider 启动 Web3:
from web3 import Web3, HTTPProvider
thing = Web3(HTTPProvider("http://localhost:42424"))
thing.geth.txpool.inspect()
  1. 使用 rpcapi 标志运行您的节点,例如:
--http.api "eth,net,web3,txpool"

【讨论】:

  • 谢谢!我今天就试试看!
【解决方案2】:

更新,

@StillFantasy 的回答是正确的。我只是更新到当前geth 的版本

因为 --rpcapi 已弃用,请使用 --http.api 标志。

喜欢:

--http.api "eth,net,web3,txpool"

【讨论】:

    猜你喜欢
    • 2022-01-14
    • 2019-08-04
    • 2020-09-30
    • 2022-06-16
    • 2021-08-28
    • 2010-12-29
    • 1970-01-01
    • 2018-06-16
    • 2018-05-16
    相关资源
    最近更新 更多