Skip to content

A python interface for interacting with the Ethereum blockchain and ecosystem.

License

Notifications You must be signed in to change notification settings

Rock-n-Block/web3.py

 
 

Repository files navigation

Web3.py

Documentation Status Discord Build Status

A Python library for interacting with Ethereum, inspired by web3.js.

  • Python 3.6+ support

Rock'N'Block Fork

Added support of multiple rpc nodes for HTTPProvider. Usage: choose custom source for downloading library, i.e (for installing via requirements.txt):

web3 @ git+https://github.com/Rock-n-Block/web3.py.git

initialize web3 instance in code:

from web3 import Web3

web3 = Web3(
    Web3.HTTPProvider(
        [endpoint1, endpoint2, ...]
    )
)

For a backwards compatibility you can still pass a single string rpc provider as usual, i.e.

Web3.HTTPProvider('endpoint')

For any blockchain call using web3 (simple requests like "gas_price", or contract interactions and filters,), web3 instance will try to make a call using one provider at once in cycle, and will change provider if any RequestException is thrown. If all endpoints are invalid, built-in "CannotHandleRequest" Exception is thrown.

Additionally, you can use some kind of node balancing, passing "randomize=True" in HTTPProvider initialization. In this case, every time you make a call, nodes are shuffled randomly, meaning that requests will be shared between them (instead of logic "call first infura unless it passes out, after that go to the second one").

Quickstart

Get started in 5 minutes or take a tour of the library.

Documentation

For additional guides, examples, and APIs, see the documentation.

Want to help?

Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing, then check out issues that are labeled Good First Issue.


Questions on implementation or usage? Join the conversation on discord.

About

A python interface for interacting with the Ethereum blockchain and ecosystem.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 96.4%
  • Solidity 3.5%
  • Other 0.1%