Skip to content

Commit 8c4c45f

Browse files
committed
troubleshooting docs for config
1 parent d8996bd commit 8c4c45f

File tree

3 files changed

+37
-11
lines changed

3 files changed

+37
-11
lines changed

docs/node.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Your Ethereum Node
44
.. _why_need_connection:
55

66
Why do I need to connect to a node?
7-
--------------------------------------
7+
-----------------------------------
88

99
The Ethereum protocol defines a way for people to interact with
1010
smart contracts and each other over a network.
@@ -19,7 +19,7 @@ not run its own node internally.
1919
.. _choosing_node:
2020

2121
How do I choose which node to use?
22-
--------------------------------------
22+
----------------------------------
2323

2424
Due to the nature of Ethereum, this is largely a question of personal preference, but
2525
it has significant ramifications on security and usability. Further, node software is
@@ -71,7 +71,7 @@ Typically, you are choosing between the main network and one of the available te
7171
See :ref:`choosing_network`
7272

7373
Can I use MetaMask as a node?
74-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7575

7676
MetaMask is not a node. It is an interface for interacting with a node.
7777
Roughly, it's what you get if you turn Web3.py into a browser extension.
@@ -85,7 +85,7 @@ If you are trying to use accounts that were already created in MetaMask, see
8585
.. _choosing_network:
8686

8787
Which network should I connect to?
88-
------------------------------------
88+
----------------------------------
8989

9090
Once you have answered :ref:`choosing_node` you have to pick which network
9191
to connect to. This is easy for some scenarios: if you have ether and you want

docs/providers.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ can skip the rest of the Providers section.
1919
.. _choosing_provider:
2020

2121
Choosing How to Connect to Your Node
22-
--------------------------------------
22+
------------------------------------
2323

2424
Most nodes have a variety of ways to connect to them. If you have not
2525
decided what kind of node to use, head on over to :ref:`choosing_node`
@@ -190,7 +190,7 @@ an optional secret key, set the environment variable ``WEB3_INFURA_API_SECRET``:
190190
True
191191
192192
Geth dev Proof of Authority
193-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
194194

195195
To connect to a ``geth --dev`` Proof of Authority instance with defaults:
196196

docs/troubleshooting.rst

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Troubleshooting
2-
=============================
2+
===============
33

44
.. _setup_environment:
55

66
Set up a clean environment
7-
----------------------------------------------
7+
--------------------------
88

99
Many things can cause a broken environment. You might be on an unsupported version of Python.
1010
Another package might be installed that has a name or version conflict.
@@ -36,10 +36,36 @@ Often, the best way to guarantee a correct environment is with ``virtualenv``, l
3636
.. NOTE:: Remember that each new terminal session requires you to reactivate your virtualenv, like:
3737
``$ source ~/.venv-py3/bin/activate``
3838

39+
40+
.. _instance_troubleshooting:
41+
42+
Why can't I use a particular function?
43+
--------------------------------------
44+
45+
Note that a Web3.py instance must be configured before you can use most of its capabilities.
46+
One symptom of not configuring the instance first is an error that looks something like this:
47+
``AttributeError: type object 'Web3' has no attribute 'eth'``.
48+
49+
To properly configure your Web3.py instance, specify which provider you're using to connect to the
50+
Ethereum network. An example configuration, if you're connecting to a locally run node, might be:
51+
52+
.. code-block:: python
53+
54+
>>> from web3 import Web3
55+
>>> w3 = Web3(Web3.HTTPProvider('http://localhost:8545'))
56+
57+
# now `w3` is available to use:
58+
>>> w3.isConnected()
59+
True
60+
>>> w3.eth.send_transaction(...)
61+
62+
Refer to the :ref:`providers` documentation for further help with configuration.
63+
64+
3965
.. _use_metamask_accounts:
4066

4167
Why isn't my web3 instance connecting to the network?
42-
--------------------------------------------------------
68+
-----------------------------------------------------
4369
You can check that your instance is connected via the ``isConnected`` method:
4470

4571
.. code-block:: python
@@ -57,7 +83,7 @@ Provider configuration issue. There are several options for configuring
5783
a Provider, detailed :ref:`here<providers>`.
5884

5985
How do I use my MetaMask accounts from Web3.py?
60-
--------------------------------------------------------
86+
-----------------------------------------------
6187
Often you don't need to do this, just make a new account in Web3.py,
6288
and transfer funds from your MetaMask account into it. But if you must...
6389

@@ -71,7 +97,7 @@ and :ref:`eth-account`.
7197
.. _faucets:
7298

7399
How do I get ether for my test network?
74-
--------------------------------------------------------
100+
---------------------------------------
75101

76102
Test networks usually have something called a "faucet" to
77103
help get test ether to people who want to use it. The faucet

0 commit comments

Comments
 (0)