I am using web3 5.14.0 and Infura

I am trying to get all transfer event for link chain token like the following:

from web3 import Web3

ABI_REQUEST_ENDPOINT = 'https://api.etherscan.io/api?module=contract&action=getabi&address='
def etherscan_fetch_abi(addr):
    response = requests.get('%s%s'%(ABI_REQUEST_ENDPOINT, addr))
    response_json = response.json()
    abi = json.loads(response_json['result'])
    return abi

web3 = Web3(Web3.HTTPProvider(url))
address = web3.toChecksumAddress('0x514910771AF9Ca656af840dff83E8264EcF986CA')
abi = etherscan_fetch_abi(address)
contract = web3.eth.contract(address=address, abi=abi)
latest = web3.eth.blockNumber
transferEvents = contract.events.Transfer.createFilter(fromBlock=latest-100, toBlock=latest)

This always return an empty list. Any idea how I could get all events please? I am trying to get biggest holders of some coins.


Your Answer

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

Browse other questions tagged or ask your own question.