February 2019
Intermediate to advanced
450 pages
9h 59m
English
Without further ado, let's install the web3 library. Create a virtual environment with Python 3.6 as follows:
$ virtualenv -p python3.6 web3-venv
Activate the virtual environment and install Vyper as follows:
$ source web3-venv/bin/activate(web3-venv) $ pip install vyper
Then, install the web3.py library using pip:
(vyper-venv) $ pip install web3
Now, verify whether it works as follows:
(vyper-venv) $ python>>> import web3>>> web3.__version__'4.8.2'
If you don't encounter any errors, it works. Let's connect to the Ganache blockchain with web3. To do this, first fire up Ganache, and then go back to your Python Command Prompt:
>>> from web3 import Web3, HTTPProvider>>> w3 = Web3(HTTPProvider('http://localhost:7545'))>>> ...