I've following code to obtain new event entries. The idea is to get latest Transfer events from a specific contract.
from web3 import Web3, HTTPProvider
import json
abi = json.load(open('abi.json'))
address = '0x.....................'
w3 = Web3(HTTPProvider('http://localhost:8545'))
contract = w3.eth.contract(abi=abi,address=address)
event_filter = contract.eventFilter('Transfer',{'fromBlock':0,'toBlock':'latest'})
logs = event_filter.get_new_entries()
print(logs);
There is a local ethereum node running under port 8545 with --rpc.
When I run above script after initiating a transaction, it always prints an empty array.
If I change it to event_filter.get_all_entries()
I can see all the transactions. But get_new_entries()
doesn't work.
Any idea what would be the issue?