Knowledge Base Home

Web3py Example Application

An example application on Kaleido using the web3 python library. This demonstrates how to connect to a Kaleido node using basic auth via HTTP and retrieve the latest block number on the chain.

Requirements:

  1. Python 2.7+

Steps:

  1. Clone the Kaleido Examples project.
  2. In the python/web3py/http subdirectory open example.py and:
    • Replace the RPC_ENDPOINT placeholder with the RPC endpoint for your node.
    • Replace the USER placeholder with the basic auth credentials username.
    • Replace the PASS placeholder with the basic auth credentials password.
  3. Save the file and from the python/web3py/http subdirectory run pipenv install --skip-lock to install the project dependencies.
  4. Run pipenv shell to activate the virtual environment
  5. Run python example.py to drive the program.

Prev Ethers.js – HTTP Provider Example Next WebJ Example Application