0

I use Infura as a provider of HTTP.

But Infura does not allow you to make a filter.

requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: https://ropsten.infura.io/

Cannot create filter on Infura via web3.py

But it's very, very long to sort through the transactions of the whole network with this code:

from web3 import Web3, HTTPProvider

w3 = Web3(HTTPProvider('https://ropsten.infura.io/',
                       request_kwargs={'timeout': 60}))

def get_transaction_details(transaction):
    return w3.eth.getTransaction(transaction)

def get_address_transactions(address):
    i = 0
    while i < w3.eth.blockNumber:
        block = w3.eth.getBlock(i)
        for transaction in block.transactions:
            detail = get_transaction_details(transaction)
            print(detail)
        i += 1

How do I get all address transactions?

1

This solution seem very ineficient. You should use instead websocketprovider (ws), which will give filtering functionality using infura.

var ws_provider = 'wss://mainnet.infura.io/ws' 
var web3 = new Web3(new Web3.providers.WebsocketProvider(ws_provider))

hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.