Summary
The node (geth) is deleting the filter, maybe due to inactivity, so returns filter not found
for that ID.
Why?
Informally, filters work over json-rpc work like so:
- Send to node: "Create a filter with parameters X, Y, Z"
- Node replies: "Filter installed, with ID 456"
- Send to node: "Any new information on filter ID 456?"
- Node replies: "Yes, these changes: [...]"
- Time passes...
- Node decides to uninstall filter 456
- Send to node: "Any new information on filter ID 456?"
- Node replies: "I have no record of filter 456"
Unfortunately, the spec doesn't have much to say about when the node is allowed to uninstall the filter. The node can do it at will, and without notice. So in the end, the only thing you can do is check for the error, and recreate the filter if it is gone... (ugh, I know)
Web3.py plans
There is an open issue to stop using that json-rpc filter mechanism altogether, and keep all the filter state on the web3.py side. It was inspired by exactly the issue that you brought up.
Infura doesn't support filters.
Per https://api.infura.io/v1/jsonrpc/ropsten/methods (from the documentation, these are the supported methods:
{
"get": [
"web3_clientVersion",
"net_version",
"net_listening",
"net_peerCount",
"eth_protocolVersion",
"eth_syncing",
"eth_mining",
"eth_hashrate",
"eth_gasPrice",
"eth_accounts",
"eth_blockNumber",
"eth_getBalance",
"eth_getStorageAt",
"eth_getTransactionCount",
"eth_getBlockTransactionCountByHash",
"eth_getBlockTransactionCountByNumber",
"eth_getUncleCountByBlockHash",
"eth_getUncleCountByBlockNumber",
"eth_getCode",
"eth_call",
"eth_estimateGas",
"eth_getBlockByHash",
"eth_getBlockByNumber",
"eth_getTransactionByHash",
"eth_getTransactionByBlockHashAndIndex",
"eth_getTransactionByBlockNumberAndIndex",
"eth_getTransactionReceipt",
"eth_getUncleByBlockHashAndIndex",
"eth_getUncleByBlockNumberAndIndex",
"eth_getCompilers",
"eth_getLogs",
"eth_getWork"
],
"post": [
"eth_sendRawTransaction",
"eth_call",
"eth_estimateGas",
"eth_submitWork",
"eth_submitHashrate"
]
}
Best Answer
You can use the following method in web3py to get events:
eventlist
will be a list of dictionaries containing the parameters of each event that had happened.Hope this helps.