Web2 is also known as the “social web” or the “participatory web” and refers to websites focused on user generated content. The term is used to describe the change from a past with static websites and the “old web” to a newer more interactive version of the internet that we are used to today. Web3 refers to the contemporary (future) change from Web2 to dApps and an infrastructure run on the blockchain that are open source, trustless and permissionless. This implies that Web3 applications are free from censorship, downtime and the requirement of personal data. Some current disadvantages with dApps are scalability and transaction speed, user interface and cost.

However, is also a Python library for interacting with the Ethereum blockchain. The package is used in dApp development to, e.g., read block data and send transactions. use “providers” to connect to a node to get and send information to the Ethereum network. From the docs there are three ways to connect to a node,

Further, if you want to run a local node, e.g.,

It is common to use a Node-as-a-Service provider that you can connect to, popular alternatives are alchemy and infura.

However, if you want a development environment also include the EthereumTesterProvider, linking to a simulated node. The simulated node has some initial accounts with some initial balance, but no transactions has yet taken place and only an initial genesis block 0 is present.


Install the necessary Python libraries,

pipenv install web3
pipenv install 'web3[tester]'

Test out together with the simulated node,

# import packages
from web3 import Web3

# connect to simulated node
w3 = Web3(Web3.EthereumTesterProvider())

# preloaded list of accounts
a0 = w3.eth.accounts[0]
a1 = w3.eth.accounts[1]
b0 = w3.eth.get_balance(a0)
print(w3.fromWei(b1, 'ether'))

# genesis block data
block_0 = w3.eth.get_block('latest')

# send a transactions that will be immidiately mined in the simulation
tx_hash = w3.eth.send_transaction({
   'from': a0,
   'to': a1,
   'value': w3.toWei(3, 'ether')

# view transaction
t0 = w3.eth.get_transaction(tx_hash)

# view transaction receipt
r0 = w3.eth.get_transaction_receipt(tx_hash)