Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larsyngvelundin/web3_balancer
A connection balancer for web3
https://github.com/larsyngvelundin/web3_balancer
Last synced: 11 days ago
JSON representation
A connection balancer for web3
- Host: GitHub
- URL: https://github.com/larsyngvelundin/web3_balancer
- Owner: larsyngvelundin
- License: gpl-3.0
- Created: 2023-10-28T20:58:09.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-28T17:09:16.000Z (11 months ago)
- Last Synced: 2024-10-04T15:39:52.211Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 167 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# web3.py balancer
A class that handles web3 connections and rotates between them to balance out the requests.
## Requirements
- web3
- tor service running (if you wish to use tor)
- loguru (only for logging)
- List of RPC servers in a dict, see in \examples\rpc_list_formatting.py
## Installation
```
pip install web3_balancer
```
## Usage
```python
>>> from web3_balancer import Web3_balancer
>>> w3 = Web3_balancer(rpc_list)
>>> w3.net = "eth"
```
After setting this up, you can use it as you would normally use web3.(Except that `block_number` is now `block_number()`)
```python
>>> w3.is_connected()
True
>>> w3.eth.block_number()
18462992
>>> w3.eth.gas_price()
23739122094
```