1

I'm not sure if the first function is getting the hash for the block number given or something else. But the second function doesn't want to accept the parameter.

last_block_hash = web3.eth.get_block(1000)["hash"].hex()
eventFilter = web3.eth.filter(
        "fromBlock" => last_block_hash,
        "topics" => [event_signature_hash]
    )

invalid argument 0: hex number with leading zero digits

1 Answer 1

1

The fromBlock should be a block number, not a block hash, so it have to be like that:

eventFilter = web3.eth.filter(
        {"fromBlock": 1000,
        "topics": [event_signature_hash]}
    )

And you have a syntax error by mixing Python and JavaScript, Python use : not => to separate value

last_block_number = 1000
eventFilter = web3.eth.filter(
        {"fromBlock": last_block_number,
        "topics": [event_signature_hash]}
    )
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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