Closed LinuxIsCool closed 1 year ago
I was able to reproduce and am investigating.
To add more info, the part where it's like assert "error" not in response
(for some reason doesnt show us the error), but the error it is giving is: {'jsonrpc': '2.0', 'id': 0, 'error': {'code': -32601, 'message': 'the method web3_clientVersion does not exist/is not available'}}
Odd indeed!
Also thanks for reporting.
For some reason, I am also getting the same issue when I try:
In [1]: from web3 import Web3
In [2]: w = Web3()
In [3]: w.is_connected()
-> assert "error" not in response
Edit: maybe was a fluke or no longer is happening, but when it does work, I notice it is using IPC instead of HTTP, which is interesting:
>>> w.provider
<web3.providers.auto.AutoProvider object at 0x10bce5c40>
>>> w.provider._active_provider
<web3.providers.ipc.IPCProvider object at 0x10bce5a90>
OK @LinuxIsCool - to use HTTP, you also need the web3
API, so you can start your geth process like this:
geth --syncmode light --http --http.api "eth,debug,web3"
with the additional web3
API specified.
I found that out by looking at this PR: https://github.com/eth-educators/eth-docker/pull/226/files
I can look to see if we can use IPC when certain APIs are missing however.
In [4]: w.client_version Out[4]: 'Geth/v1.11.5-stable-a38f4108/linux-amd64/go1.20.2'
Are you actually connected to mainnet here? what is your web3.eth.chain_id
?
It will help to know what your main goal. Are you trying to use IPC? Are you trying to use eth mainnet or a local chain? I think you need to change how you are running geth to get the best support from ape. However, we can add support for certain things but it would helpful to know the full use-case.
Hi @unparalleled-js thanks for your responses!
I am trying to connect to local mainnet.
Either IPC or HTTP should be fine, although I was kind of leaning towards IPC as I read somewhere that it should be the fastest.
I'll try running geth with the web3 argument. And I'll also report back the web3 chain_id.
So, running everything as I originally did, web3.eth.chain_id
is 1
.
geth --syncmode light --http --http.api "eth,debug,web3"
This worked thank you :pray:
... although I was kind of leaning towards IPC as I read somewhere that it should be the fastest.
Thanks to your issue, we are now adding support for IPC! It will use it by default if it can, otherwise it will resort back to the normal HTTP.
Environment information
ape
and plugin versions:ape-config.yaml
(NOTE: do not post anything private like RPC urls or secrets!):What went wrong?
I'm trying to connect to geth.
I initialize geth with the following command:
Then I try to connect to geth with ape:
Resulting in the following:
But web3 connects no problem:
How can it be fixed?
Fill this in if you have ideas on how the bug could be fixed.