I use web3 to connect Speedy node and do a web3.eth.filter() function, but it return an error:
ValueError: {‘code’: -32000, ‘message’: ‘filter not found’}
What is the parameter that you use for filter function?
I used this parameter: web3.eth.filter(‘latest’)
do you also have a minimal code example that replicates this problem?
I got this minimal example:
from web3 import Web3, HTTPProvider
x = 'https://speedy-nodes-nyc.moralis.io/ID_HERE/eth/mainnet'
web3 = Web3(HTTPProvider(x))
print(web3.eth.filter('latest').get_new_entries())
I tried your example. The below is result:
>>> web3.isConnected()
True
>>> web3 = Web3(HTTPProvider(speedy))
>>> print(web3.eth.filter('latest').get_new_entries())
Traceback (most recent call last):
File "<pyshell#30>", line 1, in <module>
print(web3.eth.filter('latest').get_new_entries())
File "C:\Users\CHIEN\AppData\Local\Programs\Python\Python38\lib\site-packages\web3\_utils\filters.py", line 160, in get_new_entries
log_entries = self._filter_valid_entries(self.eth_module.get_filter_changes(self.filter_id))
File "C:\Users\CHIEN\AppData\Local\Programs\Python\Python38\lib\site-packages\web3\module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "C:\Users\CHIEN\AppData\Local\Programs\Python\Python38\lib\site-packages\web3\manager.py", line 187, in request_blocking
return self.formatted_response(response,
File "C:\Users\CHIEN\AppData\Local\Programs\Python\Python38\lib\site-packages\web3\manager.py", line 168, in formatted_response
raise ValueError(response["error"])
ValueError: {'code': -32000, 'message': 'filter not found'}
>>>
Yes, it is an example that replicates that error, not an example that works.
I did the same as your code.
Do you have any idea about this error? I think the Speed node doesn’t support filter function.
I don’t know exactly now if it doesn’t support filtering in general, or if it is that parameter that isn’t supported. With websockets I could subscribe to events from javascript without problems.
I also tried to use websockets instead of HTTP, but the same error: filter not found. But when I change to use BSC node (‘https://bsc-dataseed.binance.org/’), it work well.
this line sends these commands to WebSocket:
eth_newBlockFilter
eth_getFilterChanges
it could be that eth_newBlockFilter
is not supported by our speedy nodes
you can use web3api to get the transactions from a block:
GET /block/{block_number_or_hash} Gets block contents by block hash