I have already created contract and deployed to ethereum mainnet. Now I wanna read logs. But I can't as calling print(contract_instance.address) and contract_instance.eventFilter('Transfers') show me error log. What am I doing wrong?

import web3

from web3 import Web3, KeepAliveRPCProvider, IPCProvider
from web3.contract import ConciseContract
from solc import compile_source

ADDRESS = "..."
START_BLOCK = 4551217
END_BLOCK = 4599662

contract_source_code = '''...

compiled_sol = compile_source(contract_source_code) # Compiled source code
contract_interface = compiled_sol['<stdin>:CustomToken']

web3 = Web3(KeepAliveRPCProvider(host='...', port='8545'))

contract_instance = web3.eth.contract(contract_interface['abi'], ADDRESS, ContractFactoryClass=ConciseContract)

transfer_filter = contract_instance.eventFilter('Transfers')

Error logs:

Traceback (most recent call last):
  File "analysis.py", line 488, in <module>
  File "/usr/local/lib/python3.6/site-packages/web3/contract.py", line 803, in __call__
    return self.__prepared_function(**kwargs)(*args)
  File "/usr/local/lib/python3.6/site-packages/web3/contract.py", line 832, in call_contract_function
  File "/usr/local/lib/python3.6/site-packages/web3/utils/decorators.py", line 13, in _wrapper
    return self.method(obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/web3/contract.py", line 692, in _prepare_transaction
  File "/usr/local/lib/python3.6/site-packages/eth_utils/string.py", line 85, in inner
    return force_obj_to_text(fn(*args, **kwargs))
  File "/usr/local/lib/python3.6/site-packages/web3/contract.py", line 731, in _encode_transaction_data
    fn_name, args, kwargs,
  File "/usr/local/lib/python3.6/site-packages/web3/contract.py", line 660, in _get_function_info
    fn_abi = cls._find_matching_fn_abi(fn_name, args, kwargs)
  File "/usr/local/lib/python3.6/site-packages/web3/contract.py", line 624, in _find_matching_fn_abi
    raise ValueError("No matching functions found")
ValueError: No matching functions found
  • could you help me, @carver? Commented Nov 23, 2017 at 9:01

3 Answers 3


v3 vs v4

Update: The question was written using web3.py v3, when v3 was the latest stable version. v4 is now stable, and preferred. Note that there are docs available for both versions: v3 (old) and v4 (current).

eventFilter in v3

eventFilter is only available in v4. The simplest solution is now to upgrade, with pip install --upgrade web3. If you can't, then use the v3 event methods

Classic vs ConciseContract

It looks like you want to use the classic contract interface, since ConciseContract is better suited for simple contract calls. So remove the ConciseContract variant in this line:

contract_instance = web3.eth.contract(contract_interface['abi'], ADDRESS, ContractFactoryClass=ConciseContract)

The changed line (below) would then provide access to the on and pastEvents methods.

contract_instance = web3.eth.contract(contract_interface['abi'], ADDRESS)

Contract Argument Order

Also, the positional ABI argument option is deprecated in v3, and removed in v4. So you should use this line instead, which works in both v3 and v4:

contract_instance = web3.eth.contract(ADDRESS, abi=contract_interface['abi'])
  • One more thing: when request a lot of blocks it returns empty array. I suppose to get an Exception. Commented Nov 27, 2017 at 19:59
  • If I know the address and ABI, can I also use it? inside python due to some string issues I was not able to assign abi value into an ABI string @carver
    – alper
    Commented Feb 27, 2018 at 11:10
  • @Alper I'm not sure what you're asking. It should probably be its own new question.
    – carver
    Commented Feb 27, 2018 at 20:12
  • @carver: I solved my Abi assignment problem as follows : I saved the ABI inside abi.json file. Than following line saved the day: with open('abi.json', 'r') as abi_definition: abi = json.load(abi_definition)
    – alper
    Commented Feb 28, 2018 at 12:36

I think it is a bug in the web3.py package, as I've got the same error and the example in the docs neither works.

From what I'm getting, the internal function _find_matching_fn_abi(fn_name, args, kwargs) is called.

This function filters the abi on type function instead of event. Somehow, this is mixed up with the function _find_matching_event_abi.

The workaround I found is to use the (deprecated from version 4) function on, you can call it by calling contract._classic_contract.on().


Your contract source code must define those functions and events.

  • yes, sure, it defined it. I just replace it by ... Commented Nov 23, 2017 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.