A tool to fetch and record ShadowDrive node statistics from an API and save them to a CSV file.
Project description
shdw-node-stats
This Python package, shdw-node-stats, is designed to fetch and record information about blockchain nodes. It has two features:
-
Retrieve data such as the node's rank, total rewards, and status from a specified API endpoint, then records this information in a CSV file for chart purpose if you need.
-
Send notification to your Telegram when the node status is
not_eligible.
Installation
To install shdw-node-stats as a package, simply use pip:
pip install shdw-node-stats
This command installs shdw-node-stats along with all required dependencies. Ensure you have Python installed on your system (version 3.8 or later is recommended).
Usage
As a Standalone Script
If you prefer to use NodeStats.py as a standalone script:
-
Ensure you have Python installed on your system (version 3.8 or later is recommended) and clone the repository or download the script.
-
Install the required dependencies:
pip install -r requirements.txt
-
Prepare a file named
nodes.txtornodes.jsonwith the node addresses. -
Run the script from the terminal or command prompt:
python3 NodeStats.py
As a Python Package
To install shdw-node-stats as a package, simply use pip:
pip install shdw-node-stats
This command installs shdw-node-stats along with all required dependencies. Ensure you have Python installed on your system (version 3.8 or later is recommended). After installing shdw-node-stats via pip, you can use it in your Python scripts as follows:
-
Prepare a file named
nodes.txtornodes.jsoncontaining the addresses of the nodes you wish to query. -
Use the package in your script:
from shdw_node_stats import NodeStats
# Assuming you have a 'nodes.txt' or 'nodes.json' file in your current directory
node_stats = NodeStats('nodes.txt') # or NodeStats('nodes.json')
node_stats.run()
This will fetch the node information and output it to a CSV file named node_rankings.csv.
File Formats Supported
- JSON (.json): Should contain an array of node addresses.
- Text (.txt): Should contain node addresses, one per line.
Output
Both usage methods generate a CSV file named node_rankings.csv, which includes the following columns: Timestamp, Node Address, Rank, Rewards, and Status. The console output will display the node information and the total rewards accumulated by the nodes listed in the input file.
Community Contribution
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Note
This package/script is intended for educational and demonstration purposes. It showcases how to interact with web APIs, process data in Python, and write output to a CSV file. Ensure you have the necessary permissions to use the API and data.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shdw-node-stats-0.4.1.tar.gz.
File metadata
- Download URL: shdw-node-stats-0.4.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b02e64b5ad91f2d7bb3177d4cde8cf0c4310a7dfdaf00f0d73bc433c98a32c36
|
|
| MD5 |
6c7745ab783e3ca4e89f1c1a30211f52
|
|
| BLAKE2b-256 |
693de8cded2d19175aaab53ee4a753c7d124aaa10689d7ffceafa522ca335e66
|
File details
Details for the file shdw_node_stats-0.4.1-py3-none-any.whl.
File metadata
- Download URL: shdw_node_stats-0.4.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7e95a8ccd0bfa4404c743cc082e3950579574077df5cfa8a1c05fb04ea8a2b6
|
|
| MD5 |
31e62a824fbce4e66f01f2dbaed7cae6
|
|
| BLAKE2b-256 |
bb13005f164601a80636f713d4fcb822cfe32445eed04aeab72d3c054ba21687
|