From f87f7812ebe3c83695831491ae374eff2704f44d Mon Sep 17 00:00:00 2001 From: Marc Garreau Date: Tue, 31 Mar 2020 11:16:54 -0600 Subject: [PATCH] improve Providers context docs; closes #1609 --- docs/index.rst | 6 +++--- docs/quickstart.rst | 11 ++++++++--- docs/troubleshooting.rst | 18 ++++++++++++++++++ newsfragments/1609.doc.rst | 1 + 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 newsfragments/1609.doc.rst diff --git a/docs/index.rst b/docs/index.rst index 70fb31cd7e..750d7ac3f3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,15 +15,15 @@ Contents quickstart overview node + providers + examples + troubleshooting v5_migration v4_migration filters contracts - providers ens_overview middleware - examples - troubleshooting web3.main web3.eth web3.eth.account diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 56cc9b3b32..8860f6f244 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -35,9 +35,14 @@ Using Web3 To use the web3 library you will need to initialize the :class:`~web3.Web3` class and connect to an Ethereum node. -The quickest way to do so for free is by setting up an account on -`Infura `_. On Infura, create a project and copy -the Project ID. Then set the environment variable ``WEB3_INFURA_PROJECT_ID``. +There are several ways to configure this connection; the +full details can be found in the :ref:`Providers` +documentation. + +The quickest way to connect to a mainnet node for free is by setting up an +account on `Infura `_. On the Infura dashboard, create +a project, copy the Project ID, then set the environment variable +``WEB3_INFURA_PROJECT_ID`` before running your script or application. .. code-block:: shell diff --git a/docs/troubleshooting.rst b/docs/troubleshooting.rst index 1ce94f829e..fbd51b9c0a 100644 --- a/docs/troubleshooting.rst +++ b/docs/troubleshooting.rst @@ -38,6 +38,24 @@ Often, the best way to guarantee a correct environment is with ``virtualenv``, l .. _use_metamask_accounts: +Why isn't my web3 instance connecting to the network? +-------------------------------------------------------- +You can check that your instance is connected via the ``isConnected`` method: + +.. code-block:: python + + >>> w3.isConnected() + False + +There's a variety of explanations for why you may see ``False`` here. If you're +running a local node, such as Geth, double-check that you've indeed started the +binary and that you've started it from the intended directory - particularly if +you've specified a relative path to its ipc file. + +If that does not address your issue, it's probable that you still have a +Provider configuration issue. There are several options for configuring +a Provider, detailed :ref:`here`. + How do I use my MetaMask accounts from Web3.py? -------------------------------------------------------- Often you don't need to do this, just make a new account in Web3.py, diff --git a/newsfragments/1609.doc.rst b/newsfragments/1609.doc.rst new file mode 100644 index 0000000000..4db220a853 --- /dev/null +++ b/newsfragments/1609.doc.rst @@ -0,0 +1 @@ +Improve documentation that introduces and troubleshoots Providers.