Reputation: 61
I'm trying to pull the transactions that took place on a specific block, and I get stuck here:
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.
I want to get the transactions that a certain wallet address was involved in, and I have no idea why web3 isn't letting me pull that from the bsc node.
Upvotes: 4
Views: 3607
Reputation: 386
from web3 import Web3
from web3.middleware import geth_poa_middleware
web3 = Web3(Web3.HTTPProvider('127.0.0.1:100500'))
web3.middleware_onion.inject(geth_poa_middleware, layer=0)
Upvotes: 9
Reputation: 11082
Looks like this should help:
from web3.middleware import geth_poa_middleware
web3.middleware_onion.inject(geth_poa_middleware, layer=0)
Upvotes: 0