You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/lessons/fundamentals/wolovim-part-1.mdx
+17-26Lines changed: 17 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,15 +15,6 @@ icons:
15
15
16
16
So, you’ve heard about this [Ethereum](https://ethereum.org/) thing and are ready to venture down the rabbit hole? This post will quickly cover some blockchain basics, then get you interacting with a simulated Ethereum node – reading block data, checking account balances, and sending transactions. Along the way, we’ll highlight the differences between traditional ways of building apps and this new decentralized paradigm.
This post aspires to be accessible to a wide range of developers. Python tools will be involved, but they are just a vehicle for the ideas – no problem if you are not a Python developer. I will, however, be making just a few assumptions about what you already know, so we can quickly move on the Ethereum-specific bits.
@@ -35,7 +26,7 @@ Assumptions:
35
26
- Python version 3.7 or greater is installed on your machine (use of a [virtual environment](https://realpython.com/effective-python-environment/#virtual-environments) is strongly encouraged), and
36
27
- you’ve used `pip`, Python’s package installer.
37
28
38
-
Again, if any of these are untrue, or you don’t plan to reproduce the code in this article, you can likely still follow along just fine.
29
+
Again, if any of these are untrue, or you don’t plan to reproduce the code in this article, just follow along conceptually.
39
30
40
31
### **Blockchains, briefly**
41
32
@@ -46,7 +37,6 @@ There are many ways to describe Ethereum, but at its heart is a blockchain. Bloc
46
37
"number": 1234567,
47
38
"hash": "0xabc123...",
48
39
"parentHash": "0xdef456...",
49
-
"miner": "0xa1b2c3...",
50
40
...,
51
41
"transactions": [...]
52
42
}
@@ -76,11 +66,11 @@ Python developers that want to interact with Ethereum are likely to reach for *
76
66
**Note:** “Ethereum node” and “Ethereum client” are often used interchangeably. In either case, it refers to the software that a participant in the Ethereum network runs. This software can read block data, receive updates when new blocks are added to the chain, broadcast new transactions, and more.
77
67
</Callout>
78
68
79
-
Ethereum clients can be configured to be reachable by [IPC](https://en.wikipedia.org/wiki/Inter-process_communication), HTTP, or Websockets. web3.py refers to these connection options as **providers**. You’ll want to choose one of the three providers to configure so that web3.py knows how to communicate with your node.
69
+
Ethereum clients can be configured to be reachable by IPC, HTTP, or Websockets. web3.py refers to these connection options as **providers**. You’ll want to choose one of the three providers to configure so that web3.py knows how to communicate with your node.
Configure the Ethereum node and web3.py to communicate via the same protocol, e.g., IPC in this diagram.
73
+
The Ethereum node and web3.py need to be configured to communicate via the same protocol, e.g., IPC in this diagram.
84
74
85
75
Once web3.py is properly configured, you can begin to interact with the blockchain. Here’s a couple of web3.py usage examples as a preview of what’s to come:
<SideDrawerbuttonText="Did you get all that?"title="Comprehension Check">
86
+
<Questionquestion="eth-intro-1/2-checkin/Q1" />
87
+
<Questionquestion="eth-intro-1/2-checkin/Q2" />
88
+
<Questionquestion="eth-intro-1/2-checkin/Q3" />
89
+
<Questionquestion="eth-intro-1/2-checkin/Q4" />
90
+
<Questionquestion="eth-intro-1/2-checkin/Q5" />
91
+
<Questionquestion="eth-intro-1/2-checkin/Q6" />
101
92
</SideDrawer>
102
93
<br/>
103
94
@@ -200,12 +191,12 @@ In [4]: w3 = Web3(Web3.EthereumTesterProvider())
200
191
201
192
Before we move on, does all that make sense? Test yourself:
202
193
203
-
<SideDrawerbuttonText="Check-in 2"title="TODO">
204
-
<Questionquestion="eth-intro-1/1-intro/Q1" />
205
-
<Questionquestion="eth-intro-1/1-intro/Q2" />
206
-
<Questionquestion="eth-intro-1/1-intro/Q3" />
207
-
<Questionquestion="eth-intro-1/1-intro/Q4" />
208
-
<Questionquestion="eth-intro-1/1-intro/Q5" />
194
+
<SideDrawerbuttonText="Keeping up? Test yourself."title="Comprehension Check">
195
+
<Questionquestion="eth-intro-1/3-checkin/Q1" />
196
+
<Questionquestion="eth-intro-1/3-checkin/Q2" />
197
+
<Questionquestion="eth-intro-1/3-checkin/Q3" />
198
+
<Questionquestion="eth-intro-1/3-checkin/Q4" />
199
+
<Questionquestion="eth-intro-1/3-checkin/Q5" />
209
200
</SideDrawer>
210
201
<br/>
211
202
@@ -268,7 +259,7 @@ Out[9]: AttributeDict({
268
259
269
260
A lot of information gets returned about a block, but just a couple things to point out here:
270
261
271
-
1. The block number is zero — no matter how long ago you configured the tester provider. Unlike the real Ethereum network, which mines a new block roughly every 15 seconds, this simulation will wait until you give it some work to do.
262
+
1. The block number is zero — no matter how long ago you configured the tester provider. Unlike the real Ethereum network, which includes a new block every 13 seconds, this simulation will wait until you give it some work to do.
272
263
2.`transactions` is an empty list, for the same reason: we haven’t done anything yet. This first block is an **empty block**, just to kick off the chain.
273
264
3. Notice that the `parentHash` is just a bunch of empty bytes. This signifies that it's the first block in the chain, also known as the **genesis****block**.
0 commit comments