I would like to see the real-time pending transactions in the Ethereum txpool via Web3.py. I do not run a local node but use Infura instead.
According to the documentation of Web3.py, apparently one has three different options:
Option 1 is not viable as the API does not seem to support Infura node. Thus I tried option 2 & 3 and they give me two different sets of pending transactions. Does anyone know why it is the case? Do the two methods retrieve different pending transactions?
Option 2:
pending_block= w3.eth.getBlock(block_identifier='pending', full_transactions=True)
pending_transactions= pending_block.['transactions']
Option 3:
pending_transactions_filter= w3.eth.filter('pending')
pending_transactions= pending_transactions_filter.get_new_entries()