0

I am trying to filter Transfer events from my local Ethereum node using web3 py. I am accessing my local ethereum node remotely using teamviewer and it was running and fully synced as well. My code is as follows:

def decodeLogswithfilter(t1, t2, abi1, addr):
    mycontract = geth.eth.contract(address=addr, abi=abi1)
    filter = mycontract.events.Transfer.createFilter(fromBlock=t1, toBlock=t2 )
    eventlist = filter.get_all_entries()   
    print(eventlist)

decodeLogswithfilter(start, ending_block, abi['result'], geth.toChecksumAddress(current_addr))

Everytime I ran my code after making changes in the code according to the link given above the terminal showed the following error in ubuntu when I checked eth.syncing status.

Error: write unix @->/mnt/ssd/.ethereum/geth.ipc: use of closed network connection
        at web3.js:3143:20
        at web3.js:6347:15
        at get (web3.js:6247:38)
        at <unknown>

After 4 5 times, the node didn't crash but vscode gave the same error as shown below:

Traceback (most recent call last):
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/providers/ipc.py", line 239, in make_request
    raw_response += sock.recv(4096)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/ssd/erc721/queryBlockchain.py", line 150, in <module>
    abi['result'], geth.toChecksumAddress(current_addr))
  File "/mnt/ssd/erc721/queryBlockchain.py", line 71, in decodeLogswithfilter
    filter = mycontract.events.Transfer.createFilter(fromBlock=t1, toBlock=t2)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/eth_utils/decorators.py", line 20, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/contract.py", line 1170, in createFilter
    log_filter = filter_builder.deploy(self.web3)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/_utils/events.py", line 404, in deploy
    log_filter = cast("LogFilter", w3.eth.filter(self.filter_params))
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/eth.py", line 475, in filter
    [filter_params],
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/manager.py", line 149, in request_blocking
    response = self._make_request(method, params)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/manager.py", line 128, in _make_request
    return request_func(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/middleware/formatting.py", line 73, in apply_formatters
    response = make_request(method, formatted_params)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/middleware/gas_price_strategy.py", line 34, in middleware
    return make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/middleware/formatting.py", line 73, in apply_formatters
    response = make_request(method, formatted_params)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/middleware/attrdict.py", line 33, in middleware
    response = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/middleware/formatting.py", line 73, in apply_formatters
    response = make_request(method, formatted_params)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/middleware/normalize_errors.py", line 25, in middleware
    result = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/middleware/formatting.py", line 75, in apply_formatters
    response = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/middleware/formatting.py", line 73, in apply_formatters
    response = make_request(method, formatted_params)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/providers/ipc.py", line 241, in make_request
    timeout.sleep(0)
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/_utils/threads.py", line 88, in sleep
    self.check()
  File "/home/ethereumpc1/.local/lib/python3.6/site-packages/web3/_utils/threads.py", line 81, in check
    raise self
web3._utils.threads.Timeout: 10 seconds

Any idea what's causing the node to shutdown and how to make the filter run successfully?

Also, If the filter does successfully run then the logs returned by it of lets suppose an address A for Transfer events will be all logs of Transfer event to and from this address or just from?

  • Is geth still running? From the error message it appears it isn't responding to connections to geth.ipc. – Ismael Apr 15 at 19:24
  • When I check geth status before running the code, it is running. But as soon as the code runs and I check geth sync status it returns me that error. And vscode gives me socket timeout error. everything was working perfectly fine before i added filter to my code. – mahamzaidi Apr 15 at 19:59
  • Can you check if geth is still running after the filters are created? It might be that geth crashes while trying to answer the query. Try launching geth with verbosity increase and watch the logs for clues. – Ismael Apr 15 at 22:22
  • I have updated my error log and question. Can you read it again? – mahamzaidi Apr 16 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.