title: web3 event_filter.get_new_entries: ValueError {'code': -32000, 'message': 'filter 0x?????????? not found'}
body: <p>pretty stuck here. I am following web3 <a href="https://web3py.readthedocs.io/en/stable/filters.html#asynchronous-filters" rel="nofollow noreferrer">examples</a> and try to subscribe to smart contract events by calling web3 event_filter.get_new_entries: <em><strong>ValueError {'code': -32000, 'message': 'filter 0x???????????????? not found'}</strong></em></p>
  <p>I specifically want to listen for SINGLE/USDC LP's <a href="https://cronos.org/explorer/address/0x0fBAB8A90CAC61b481530AAd3a64fE17B322C25d/contracts" rel="nofollow noreferrer">Swap event</a></p>
  <p>Code</p>
  <pre><code>import json
  import asyncio
  from web3 import Web3
  
  my_wallet_address = &quot;xxx&quot;
  my_wallet_address = Web3.toChecksumAddress(my_wallet_address)
  node_url = &quot;https://evm.cronos.org/&quot;
  single_usdc_contract_address = Web3.toChecksumAddress(&quot;0x0fbab8a90cac61b481530aad3a64fe17b322c25d&quot;)
  single_usdc_contract_abi = json.loads('... ABI json ...')
  
  web3 = Web3(Web3.HTTPProvider(node_url))
  contract = web3.eth.contract(address=single_usdc_contract_address, abi=single_usdc_contract_abi)
  
  def handle_event(event):
      print(Web3.toJSON(event))
  
  async def log_loop(event_filter, poll_interval):
      while True:
          for event in event_filter.get_new_entries():
              handle_event(event)
      await asyncio.sleep(poll_interval)
  
  filter = contract.events.Swap.createFilter(fromBlock='latest')
  # filter = web3.eth.filter('latest')
  loop = asyncio.get_event_loop()
  try:
      loop.run_until_complete(
          asyncio.gather(
          log_loop(filter, 2)))
  finally:
      loop.close()
  </code></pre>
  <p>Some poor guy <a href="https://ethereum.stackexchange.com/questions/112467/web3-py-filter-not-found">fixed by changing from HTTPProvider to RPC</a>. That's less than satisfactory. I worked around the problem by calling &quot;createFilter&quot; from each iteration of the While-loop! But I am  not sure if I understand the root of the problem. Some suggests <a href="https://github.com/ethereum/web3.py/issues/923" rel="nofollow noreferrer">Node keep dropping filters</a>, thus my fix to call &quot;createFilter&quot; every loop worked. But I really don't understand the root of the problem.</p>
  <p>Thanks in advance.</p>
  <p><em><strong>References</strong></em></p>
  <p><a href="https://web3py.readthedocs.io/en/stable/filters.html#asynchronous-filters" rel="nofollow noreferrer">web3 doc - events</a></p>
  <p><a href="https://stackoverflow.com/questions/49854190/how-to-get-event-data-from-web3py">SO reference</a></p>
  <p><a href="https://vvs.finance/info/farm/0x0fbab8a90cac61b481530aad3a64fe17b322c25d" rel="nofollow noreferrer">SINGLE/USDC</a></p>
  <p><a href="https://cronos.org/explorer/address/0x0fBAB8A90CAC61b481530AAd3a64fE17B322C25d/contracts" rel="nofollow noreferrer">SINGLE/USDC - CRONOS Explorer where you will find ABI</a></p>
  <p><a href="https://cronos.org/docs/resources/chain-integration.html" rel="nofollow noreferrer">CRONOS integration doc</a></p>
  <p><a href="https://cryptomarketpool.com/how-to-listen-for-ethereum-events-using-web3-in-python/" rel="nofollow noreferrer">Example from cryptomarketpool</a></p>