Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'ethtx.semantics' #135

Closed
yuripaoloni opened this issue Apr 4, 2022 · 10 comments
Closed

No module named 'ethtx.semantics' #135

yuripaoloni opened this issue Apr 4, 2022 · 10 comments

Comments

@yuripaoloni
Copy link

Windows 10. Python version 3.10.4. Latest version for ethtx is installed with pip install ethtx.

I created a file test.py with the following content:

from ethtx import EthTx, EthTxConfig
from ethtx.models.decoded_model import DecodedTransaction

ethtx_config = EthTxConfig(
    etherscan_api_key="my etherscan API key",  ##Etherscan API key,
    web3nodes={
        "mainnet": {
            "hook": "my Infura url",  # multiple nodes supported, separate them with comma
            "poa": False  # represented by bool value
        }
    },
    default_chain="mainnet",
    etherscan_urls={"mainnet": "https://api.etherscan.io/api" }
)

ethtx = EthTx.initialize(ethtx_config)
transaction: DecodedTransaction = ethtx.decoders.decode_transaction(
    '0x50051e0a6f216ab9484c2080001c7e12d5138250acee1f4b7c725b8fb6bb922d')

Once I try to execute the file with py test.py, I get the following error:

Traceback (most recent call last):
  File "C:\Users\Utente\Desktop\ethtx\test.py", line 1, in <module>
    from ethtx import EthTx, EthTxConfig
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\__init__.py", line 13, in <module>
    from .ethtx import EthTx, EthTxConfig
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\ethtx.py", line 18, in <module>
    from .decoders.abi.decoder import ABIDecoder
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\decoders\abi\decoder.py", line 32, in <module>
    from .abc import IABIDecoder
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\decoders\abi\abc.py", line 25, in <module>
    from ethtx.providers.semantic_providers import SemanticsRepository
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\providers\semantic_providers\__init__.py", line 15, in <module>
    from .repository import SemanticsRepository
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\providers\semantic_providers\repository.py", line 30, in <module>
    from ethtx.semantics.protocols_router import amend_contract_semantics
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\semantics\protocols_router.py", line 21, in <module>
    def amend_contract_semantics(semantics: ContractSemantics, router_=Router()):
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\semantics\router.py", line 30, in __new__
    return cls._get_semantics()
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\site-packages\ethtx\semantics\router.py", line 52, in _get_semantics
    imported_module = importlib.import_module(
  File "C:\Users\Utente\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'ethtx.semanticsC:\\Users\\Utente\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\ethtx\\semantics\\base'

What's the issue? Thanks for the help.

@kchojn
Copy link
Collaborator

kchojn commented Apr 4, 2022

Hey @yuripaoloni.
We do not support windows os. It is not tested there. But... you can try it:

  • did you create venv?
  • is the ethtx installed in this environment? Maybe you are running it in the wrong scope (the problem looks like this)?

@yuripaoloni
Copy link
Author

Yeah, I tried with venv and already checked for ethtx installed in it.

I didn't notice the package it wasn't supported on Windows, sorry for that. I will use an Ubuntu VM.

Thank you for the fast response.

@kchojn
Copy link
Collaborator

kchojn commented Apr 4, 2022

Np! Let us know if there is anything else we can help with!

@yuripaoloni
Copy link
Author

Any update on #18? Is archivenode.io the only option to get a full node with debugging on for free?

I need to get the internal execution trace of a set of transactions to run some analytics on top of them.

@kchojn
Copy link
Collaborator

kchojn commented Apr 6, 2022

Hey @yuripaoloni,
Sorry for the late reply.
To be honest, at this moment I don't see any free other archive nodes for Ethereum.
There are some paid alternatives, but I don't know what the cost is: getblock.io or quicknode.com

Regards!

@enmohsinali
Copy link

Hey @yuripaoloni,
getblock.io provides full node which kept historical state of last 64 blocks.
So if you wanna decode latest transaction then getblocks might be helpful .

@yuripaoloni
Copy link
Author

yuripaoloni commented Apr 6, 2022

Thanks @enmohsinali.

I tried with the following code:

from ethtx import EthTx, EthTxConfig
from ethtx.models.decoded_model import DecodedTransaction

ethtx_config = EthTxConfig(
    mongo_connection_string="mongomock://localhost/ethtx",  ##MongoDB connection string,
    etherscan_api_key="<apikey>",  ##Etherscan API key,
    web3nodes={
        "mainnet": {
            "hook": "https://eth.getblock.io/mainnet/?api_key=<apykey>",  # multiple nodes supported, separate them with comma
            "poa": False  # represented by bool value
        }
    },
    default_chain="mainnet",
    etherscan_urls={"mainnet": "https://api.etherscan.io/api", },
)

ethtx = EthTx.initialize(ethtx_config)
transaction: DecodedTransaction = ethtx.decoders.decode_transaction(
    '0x2c2c40743117d5e6fa3ca2931fcfff40dc998c33109fc132a8ca4d640f39b996')

And I'm getting back: ethtx.exceptions.NodeConnectionException: Couldn't connect to node(s). It's strange because the getblock.io dashboard shows that the requests are actually sent.

0x2c2c40743117d5e6fa3ca2931fcfff40dc998c33109fc132a8ca4d640f39b996 is the hash of one of the last executed transaction at the time I executed the code.

@kchojn
Copy link
Collaborator

kchojn commented Apr 6, 2022

@yuripaoloni ,
I have tested https://eth.getblock.io/mainnet/?api_key=<my_api_key> endpoint and looks like it works.
As @enmohsinali said, you can decode only transactions from the last 64 blocks with this endpoint. And it works perfectly!

Screen from decoding (getblock.io):
image

And tx:
image

@yuripaoloni
Copy link
Author

I tried again and now it suddenly started to work 🤣. Maybe the node needed time to get live.

Anyway, thanks @kchojn for the support 🤝

@kchojn
Copy link
Collaborator

kchojn commented Apr 6, 2022

Np! Glad to help! If you need any help with ethtx, you can always write to us on discord 🤠
Best regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants