Skip to content

Commit 29262c9

Browse files
authored
docs: cleanup overview (#2938)
1 parent 9f628c3 commit 29262c9

File tree

3 files changed

+39
-51
lines changed

3 files changed

+39
-51
lines changed

docs/overview.rst

Lines changed: 28 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@ greater detail.
1313
Configuration
1414
~~~~~~~~~~~~~
1515

16-
After installing web3.py (via ``pip install web3``), you'll need to specify
17-
async or sync web3, the provider, and any middleware you want to use
18-
beyond the defaults.
16+
After installing web3.py (via ``pip install web3``), you'll need to configure
17+
a provider endpoint and any middleware you want to use beyond the defaults.
1918

2019

2120
Providers
2221
---------
2322

24-
Providers are how web3.py connects to the blockchain. The library comes with the
23+
:doc:`providers` are how web3.py connects to a blockchain. The library comes with the
2524
following built-in providers:
2625

27-
- ``Web3.IPCProvider`` for connecting to ipc socket based JSON-RPC servers.
28-
- ``Web3.HTTPProvider`` for connecting to http and https based JSON-RPC servers.
29-
- ``Web3.WebsocketProvider`` for connecting to ws and wss websocket based JSON-RPC servers.
30-
- ``AsyncWeb3.AsyncHTTPProvider`` for connecting to http and https based JSON-RPC servers.
26+
- :class:`~web3.providers.ipc.IPCProvider` for connecting to ipc socket based JSON-RPC servers.
27+
- :class:`~web3.providers.rpc.HTTPProvider` for connecting to http and https based JSON-RPC servers.
28+
- :class:`~web3.providers.websocket.WebsocketProvider` for connecting to ws and wss websocket based JSON-RPC servers.
29+
- :class:`~web3.providers.async_rpc.AsyncHTTPProvider` for connecting to http and https based JSON-RPC servers.
3130

3231

33-
Synchronous Provider Examples:
34-
------------------------------
32+
Examples
33+
^^^^^^^^
34+
3535
.. code-block:: python
3636
37-
>>> from web3 import Web3
37+
>>> from web3 import Web3, AsyncWeb3
3838
3939
# IPCProvider:
4040
>>> w3 = Web3(Web3.IPCProvider('./path/to/geth.ipc'))
@@ -48,33 +48,19 @@ Synchronous Provider Examples:
4848
>>> w3.is_connected()
4949
True
5050
51-
52-
Asynchronous Provider Example:
53-
------------------------------
54-
55-
.. note::
56-
57-
The AsyncHTTPProvider is still under active development. Not all JSON-RPC
58-
methods and middleware are available yet. The list of available methods and
59-
middleware can be seen on the :class:`~web3.providers.async_rpc.AsyncHTTPProvider` docs
60-
61-
.. code-block:: python
62-
63-
>>> from web3 import AsyncWeb3
64-
51+
# AsyncHTTPProvider:
6552
>>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('http://127.0.0.1:8545'))
6653
6754
>>> await w3.is_connected()
6855
True
6956
70-
For more information, (e.g., connecting to remote nodes, provider auto-detection,
71-
using a test provider) see the :ref:`Providers <providers>` documentation.
57+
For more context, see the :doc:`providers` documentation.
7258

7359

7460
Middleware
7561
----------
7662

77-
Your web3.py instance may be further configured via middleware.
63+
Your web3.py instance may be further configured via :doc:`middleware`.
7864

7965
web3.py middleware is described using an onion metaphor, where each layer of
8066
middleware may affect both the incoming request and outgoing response from your
@@ -88,8 +74,8 @@ Several middleware are :ref:`included by default <default_middleware>`. You may
8874
:meth:`clear <Web3.middleware_onion.clear>`) any of these middleware.
8975

9076

91-
Your Keys
92-
~~~~~~~~~
77+
Accounts and Private Keys
78+
~~~~~~~~~~~~~~~~~~~~~~~~~
9379

9480
Private keys are required to approve any transaction made on your behalf. The manner in
9581
which your key is secured will determine how you create and send transactions in web3.py.
@@ -103,6 +89,7 @@ In this case, you'll need to have your private key available locally for signing
10389
transactions.
10490

10591
Full documentation on the distinction between keys can be found :ref:`here <eth-account>`.
92+
The separate guide to :doc:`transactions` may also help clarify how to manage keys.
10693

10794

10895
Base API
@@ -148,8 +135,8 @@ web3.eth API
148135
~~~~~~~~~~~~
149136

150137
The most commonly used APIs for interacting with Ethereum can be found under the
151-
``web3.eth`` namespace. As a reminder, the :ref:`Examples <examples>` page will
152-
demonstrate how to use several of these methods.
138+
``web3.eth`` namespace. As a reminder, the :doc:`examples` page will demonstrate
139+
how to use several of these methods.
153140

154141

155142
Fetching Data
@@ -177,13 +164,14 @@ API
177164
- :meth:`web3.eth.get_uncle_count() <web3.eth.Eth.get_uncle_count>`
178165

179166

180-
Making Transactions
181-
-------------------
167+
Sending Transactions
168+
--------------------
182169

183170
The most common use cases will be satisfied with
184171
:meth:`send_transaction <web3.eth.Eth.send_transaction>` or the combination of
185172
:meth:`sign_transaction <web3.eth.Eth.sign_transaction>` and
186-
:meth:`send_raw_transaction <web3.eth.Eth.send_raw_transaction>`.
173+
:meth:`send_raw_transaction <web3.eth.Eth.send_raw_transaction>`. For more context,
174+
see the full guide to :doc:`transactions`.
187175

188176
.. note::
189177

@@ -213,13 +201,12 @@ API
213201
Contracts
214202
---------
215203

216-
The two most common use cases involving smart contracts are deploying and executing
217-
functions on a deployed contract.
204+
web3.py can help you deploy, read from, or execute functions on a deployed contract.
218205

219206
Deployment requires that the contract already be compiled, with its bytecode and ABI
220207
available. This compilation step can be done within
221208
`Remix <http://remix.ethereum.org/>`_ or one of the many contract development
222-
frameworks, such as `Brownie <https://eth-brownie.readthedocs.io/>`_.
209+
frameworks, such as `Ape <https://docs.apeworx.io/ape/stable/index.html/>`_.
223210

224211
Once the contract object is instantiated, calling ``transact`` on the
225212
:meth:`constructor <web3.contract.Contract.constructor>` method will deploy an
@@ -233,8 +220,8 @@ instance of the contract:
233220
>>> tx_receipt.contractAddress
234221
'0x8a22225eD7eD460D7ee3842bce2402B9deaD23D3'
235222
236-
Once loaded into a Contract object, the functions of a deployed contract are available
237-
on the ``functions`` namespace:
223+
Once a deployed contract is loaded into a Contract object, the functions of that
224+
contract are available on the ``functions`` namespace:
238225

239226
.. code-block:: python
240227
@@ -295,7 +282,7 @@ a contract, you can leverage web3.py filters.
295282
>>> new_filter.get_new_entries()
296283
297284
More complex patterns for creating filters and polling for logs can be found in the
298-
:ref:`Filtering <filtering>` documentation.
285+
:doc:`filters` documentation.
299286

300287

301288
API

docs/web3.eth.account.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.. _eth-account:
22

33
Working with Local Private Keys
4-
==========================================
4+
===============================
55

66
.. _local_vs_hosted:
77

88
Local vs Hosted Nodes
9-
---------------------------------
9+
---------------------
1010

1111
Local Node
1212
A local node is started and controlled by you. It is as safe as you keep it.
@@ -17,7 +17,7 @@ Hosted Node
1717
connected to a hosted node.
1818

1919
Local vs Hosted Keys
20-
---------------------------------
20+
--------------------
2121

2222
Local Private Key
2323
A key is 32 :class:`bytes` of data that you can use to sign transactions and messages,
@@ -165,7 +165,7 @@ This will print::
165165
.. _extract_geth_pk:
166166

167167
Extract private key from geth keyfile
168-
---------------------------------------------
168+
-------------------------------------
169169

170170
.. NOTE::
171171
The amount of available ram should be greater than 1GB.
@@ -178,7 +178,7 @@ Extract private key from geth keyfile
178178
# tip: do not save the key or password anywhere, especially into a shared source file
179179
180180
Sign a Message
181-
---------------
181+
--------------
182182

183183
.. WARNING:: There is no single message format that is broadly adopted
184184
with community consensus. Keep an eye on several options,
@@ -208,7 +208,7 @@ is provided by :meth:`w3.eth.sign() <web3.eth.Eth.sign>`.
208208
signature=HexBytes('0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb33e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce1c'))
209209

210210
Verify a Message
211-
------------------------------------------------
211+
----------------
212212

213213
With the original message text and a signature:
214214

@@ -219,7 +219,7 @@ With the original message text and a signature:
219219
'0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E'
220220

221221
Prepare message for ecrecover in Solidity
222-
--------------------------------------------
222+
-----------------------------------------
223223

224224
Let's say you want a contract to validate a signed message,
225225
like if you're making payment channels, and you want to
@@ -288,7 +288,7 @@ this will prepare it for Solidity:
288288

289289

290290
Verify a message with ecrecover in Solidity
291-
---------------------------------------------
291+
-------------------------------------------
292292

293293
Create a simple ecrecover contract in `Remix <https://remix.ethereum.org/>`_:
294294

@@ -312,7 +312,7 @@ the message back in response: ``0x5ce9454909639d2d17a3f753ce7d93fa0b9ab12e``.
312312
.. _local-sign-transaction:
313313

314314
Sign a Transaction
315-
------------------------
315+
------------------
316316

317317
Create a transaction, sign it locally, and then send it to your node for broadcasting,
318318
with :meth:`~web3.eth.Eth.send_raw_transaction`.
@@ -360,7 +360,7 @@ with :meth:`~web3.eth.Eth.send_raw_transaction`.
360360
'0xe85ce7efa52c16cb5c469c7bde54fbd4911639fdfde08003f65525a85076d915'
361361

362362
Sign a Contract Transaction
363-
-----------------------------------
363+
---------------------------
364364

365365
To sign a transaction locally that will invoke a smart contract:
366366

newsfragments/2938.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Cleanup Overview page links and context

0 commit comments

Comments
 (0)