4

I am currently trying to build a script to automatically interact with a smart contract once a certain transaction has been sent. I have the interaction part down but am having difficulties actually monitoring transactions on either the contract itself or the deployer. I am currently trying to use a filter in order to get_new_entries() on the address but it does not seem to pick up new transactions for the address. Here is the code I have so far when trying to get information on transactions for a certain contract address:

from web3 import Web3
import time

url = testneturl #testnet (Omitted)
web3 = Web3(Web3.HTTPProvider(url))
contract_address = '0x1F01D231fe5368B5C54c75F7977C5484EF801684'

f = web3.eth.filter({'address': contract_address})

while True:
    print(f.get_new_entries())
    time.sleep(0.1)

I am simply trying to monitor the contract for new entries but when sending transactions to the address, all that is ever printed is [].

Any help is appreciated and any suggestions on better methods to do the same tasks would also be great.

1

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.