Python [ web3 ] Install and HTTPProvider Connect (Simple)

Post Reply
User avatar
CoDeR
Editor
Editor
Posts: 52
Joined: Wed Dec 13, 2023 7:25 pm
Location: Cyberspace

Python [ web3 ] Install and HTTPProvider Connect (Simple)

Post by CoDeR »

First of all, we are switching to the virtual environment. So:

Code: Select all

 . venv/bin/activate
Then we go to "ethereumnodes com" and choose a nice Ethereum node for ourselves.
We run Python and import the web3 module by writing the following code in the Python shell.

Code: Select all

from web3 import Web3
We took the llama RPC node for instantiation. We passed the provider's connection to the w3 variable using the HTTPProvider method.

Code: Select all

w3 = Web3(Web3.HTTPProvider('https://eth.llamarpc.com/'))
Then we verified our provider.

Code: Select all

>>>w3.is_connected()
True

If you did not receive a True response, you are experiencing connection and provider issues.


Digital Music
Blues
Classic music
Blu-Ray and DVD
Music Tools
Post Reply