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

Better document how to set up a web3 instance #1609

Closed
kclowes opened this issue Mar 21, 2020 · 4 comments · Fixed by #1619
Closed

Better document how to set up a web3 instance #1609

kclowes opened this issue Mar 21, 2020 · 4 comments · Fixed by #1619

Comments

@kclowes
Copy link
Collaborator

kclowes commented Mar 21, 2020

What was wrong?

There are many different ways to set up a web3 instance. For example:

from web3.auto import w3

from web3 import IPCProvider, Web3
w3 = Web3(IPCProvider('path/to/ipc/file.ipc'))

from web3 import WebsocketProvider, Web3
w3 = Web3(WebsocketProvider('ws://localhost:8546'))

from web3 import HTTPProvider, Web3
w3 = Web3(HTTPProvider('http://localhost:8545'))

from web3.auto.infura import w3

from web3.auto.infura.rinkeby import w3

...

But with each of these options comes certain configuration that needs to happen.

For example, web3.auto requires either an environment variable set, a local node running on mainnet, or an http provider running on localhost:8545. But you have to go to a different page in the docs to see that.

Similarly, if you are trying to connect to a local geth node over HTTP or Websockets, you need to start geth with the --rpc or --ws flag, respectively, in order to connect.

It would be nice if the docs mentioned these nuances.

@wolovim
Copy link
Member

wolovim commented Mar 30, 2020

Double-checking that its on your radar: I found the Providers docs surprisingly robust. I do think it could stand to be higher up in the table of contents, though, as its the first thing you'll need to configure before being able to use the lib.

I wouldn't expect newcomers to guess that there's important setup information in the Providers link in the middle of a long list of other links, but I think the Quickstart and Overview sections do a reasonably good job of highlighting the concept.

@kclowes
Copy link
Collaborator Author

kclowes commented Mar 31, 2020

Yes, I agree, the Providers docs are really good! And could stand to be higher up the list. Maybe this stuff really belongs in the troubleshooting docs. If w3.isConnected() == False, try these things depending on how you're trying to connect

@wolovim
Copy link
Member

wolovim commented Mar 31, 2020

👍 I'll make some tweaks and ping you for feedback.

wolovim added a commit to wolovim/web3.py that referenced this issue Mar 31, 2020
wolovim added a commit to wolovim/web3.py that referenced this issue Mar 31, 2020
@wolovim
Copy link
Member

wolovim commented Mar 31, 2020

@kclowes up for debate: #1619

Re: If w3.isConnected() == False, try these things depending on how you're trying to connect,
I only had a couple thoughts that I dropped into a new Troubleshooting section. Let me know if you had additional ideas in mind.

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

Successfully merging a pull request may close this issue.

2 participants