4

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.

TylerH
  • 20,799
  • 66
  • 75
  • 101
swaggy pete
  • 61
  • 1
  • 3

2 Answers2

7
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)
0

Looks like this should help:

from web3.middleware import geth_poa_middleware

web3.middleware_onion.inject(geth_poa_middleware, layer=0)
StasM
  • 10,593
  • 6
  • 56
  • 103