使用python的Binance智能链上出现Web3 ExtraDataLength错误

2024-06-07 07:58:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图提取在特定区块发生的交易,但我被困在这里:

from web3 import Web3

bsc = "https://bsc-dataseed.binance.org/"
web3 = Web3(Web3.HTTPProvider(bsc))

block = web3.eth.get_block('latest')

web3.exceptions.ExtraDataLengthError: The field extraData is 97 bytes, but should be 32. It is quite likely that you are connected to a POA chain. Refer to http://web3py.readthedocs.io/en/stable/middleware.html#geth-style-proof-of-authority for more details.

我想获得某个钱包地址所涉及的交易,我不知道为什么web3不允许我从bsc节点获取这些交易

多谢各位


Tags: tofromhttpsorgimportisbinance交易
1条回答
网友
1楼 · 发布于 2024-06-07 07:58:28

看起来这应该有帮助:

from web3.middleware import geth_poa_middleware

web3.middleware_onion.inject(geth_poa_middleware, layer=0)

相关问题 更多 >

    热门问题