https://github.com/danhper/ethereum-tools
https://github.com/danhper/ethereum-tools
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/danhper/ethereum-tools
- Owner: danhper
- Created: 2020-08-06T21:13:13.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-07T22:54:00.000Z (over 2 years ago)
- Last Synced: 2025-04-13T02:29:49.558Z (3 months ago)
- Language: Python
- Homepage:
- Size: 94.7 KB
- Stars: 4
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# eth-tools
Small library/CLI tool wrapping web3py.
## Installation
```
pip install ethereum-tools
```## CLI Usage
Web3 provider needs to be set either through the `WEB3_PROVIDER_URI` environment
variable or through the `--web3-uri` CLI flag.### Fetching blocks
```
eth-tools fetch-blocks -s 10000000 -e 10000999 -o blocks.csv.gz
```### Fetching events
```
eth-tools fetch-events 0x6b175474e89094c44da98b954eedeac495271d0f --abi /path/to/abi.json -s 10000000 -e 10000999 -o events.jsonl.gz
```## Library usage
```python
from web3 import Web3
from web3.providers.auto import load_provider_from_environmentfrom eth_tools.block_iterator import BlockIterator
provider = load_provider_from_environment()
web3 = Web3(provider)
block_iterator = BlockIterator(web3, start_block=10_000_000, end_block=10_000_999)for block in block_iterator:
print(block.number)
```