Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## v0.4.0-beta - May 25, 2025
* Added new endpoint method:
* `get_monero_mining_stats()`: Returns a dictionary containing various statistics related to Monero mining, such as pool and network hashrates, network difficulty, block height, and other relevant pool/miner data.
* Since the reward for each block of monero is `0.6 XMR`, we have added a small formula that allows us to calculate approximate rewards.
* Some internal libraries have been updated to fix known vulnerabilities.
* Since the : `/block-height` endpoint is going to be removed, a message has been added to the `get_block_height()` method to warn that it is recommended to use the `get_tick_info()` method instead to ensure maximum compatibility.
* Donation addresses have been added to help cover operational costs, spend more time on new features, bug fixes and full documentation, ensuring that QubiPy remains a robust tool for everyone. More information in our [README](https://github.com/QubiPy-Labs/QubiPy/blob/main/README.md) and our [online documentation](https://qubipy.readthedocs.io/en/latest/about/#community-and-support).

## v0.3.0-beta - May 7, 2025
* Added new endpoints methods :
* get_assets_issuances(): Returns a list of issued assets.
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Currently, QubiPy is in a very early development phase, so please take this into

Please visit the [Change log](https://github.com/QubiPy-Labs/QubiPy/blob/main/docs/changelog.md) to see all changes.

![release](https://img.shields.io/badge/release-v0.3.0--beta-blue)
![release](https://img.shields.io/badge/release-v0.4.0--beta-blue)
![python](https://img.shields.io/badge/python-3.10_%7C_3.11_%7C_3.12-blue)
![Python Package](https://github.com/QubiPy-Labs/QubiPy/actions/workflows/python-package.yml/badge.svg)
![Code Quality](https://github.com/QubiPy-Labs/QubiPy/actions/workflows/pylint.yml/badge.svg)
Expand Down Expand Up @@ -96,6 +96,24 @@ $ {

```

### Support Our Work (Donations)

#### Your Contribution Matters
QubiPy is developed and maintained by QubiPy Labs as a free, open-source project for the Qubic community.

Our dedication to providing high-quality tools is driven by passion, but maintaining and enhancing the library requires time, effort, and resources.

If you find QubiPy valuable and wish to support its continued development, any contribution is greatly appreciated.

Your donations help us cover operational costs, dedicate more time to new features, bug fixes, and comprehensive documentation, ensuring QubiPy remains a robust tool for everyone.

You can send your generous contributions to the following addresses:

* QUBIC : **`CNSLISZCRHAVHADBQCZWVYAVTYXCVNQREGVVTWKBLHSJXFHRFEGNLORCHRSE`**
* USDT (ETH, ARB, BSC or Polygon) : **`0x453471Cc01868895b833841Ce7DbaE11fd9D1933`**

A huge thank you for being a part of the QubiPy journey!

### Technical notes
This library is using `crypto.dll` which is a C extension of Qubic key utility functions and bind it to Python. To build this `crypto.dll`, this repository was used: [https://github.com/serendipity-seeker/key-utils-binding](https://github.com/serendipity-seeker/key-utils-binding).

18 changes: 18 additions & 0 deletions docs/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ Check our [Contributing Guidelines](contributing.md) for more details.
- Check our [Documentation](https://qubipy.readthedocs.io)
- Ask questions on [GitHub Issues](https://github.com/QubiPy-Labs/QubiPy/issues)

### Support Our Work (Donations)

!!! tip "Your Contribution Matters"
QubiPy is developed and maintained by QubiPy Labs as a free, open-source project for the Qubic community.

Our dedication to providing high-quality tools is driven by passion, but maintaining and enhancing the library requires time, effort, and resources.

If you find QubiPy valuable and wish to support its continued development, any contribution is greatly appreciated.

Your donations help us cover operational costs, dedicate more time to new features, bug fixes, and comprehensive documentation, ensuring QubiPy remains a robust tool for everyone.

You can send your generous contributions to the following addresses:

* QUBIC : **`CNSLISZCRHAVHADBQCZWVYAVTYXCVNQREGVVTWKBLHSJXFHRFEGNLORCHRSE`**
* USDT (ETH, ARB, BSC or Polygon) : **`0x453471Cc01868895b833841Ce7DbaE11fd9D1933`**

A huge thank you for being a part of the QubiPy journey!

## Technical notes
This library uses crypto.dll, which is a C extension of the Qubic key utility functions and binds them to Python. To build this crypto.dll, this [repository](https://github.com/serendipity-seeker/key-utils-binding) was used.

Expand Down
8 changes: 8 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## v0.4.0-beta - May 25, 2025
* Added new endpoint method:
* `get_monero_mining_stats()`: Returns a dictionary containing various statistics related to Monero mining, such as pool and network hashrates, network difficulty, block height, and other relevant pool/miner data.
* Since the reward for each block of monero is `0.6 XMR`, we have added a small formula that allows us to calculate approximate rewards.
* Some internal libraries have been updated to fix known vulnerabilities.
* Since the : `/block-height` endpoint is going to be removed, a message has been added to the `get_block_height()` method to warn that it is recommended to use the `get_tick_info()` method instead to ensure maximum compatibility.
* Donation addresses have been added to help cover operational costs, spend more time on new features, bug fixes and full documentation, ensuring that QubiPy remains a robust tool for everyone.

## v0.3.0-beta - May 7, 2025
* Added new endpoints methods :
* get_assets_issuances(): Returns a list of issued assets.
Expand Down
22 changes: 20 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Welcome to the **QubiPy** official documentation, a Python Library for the QUBIC RPC API

!!! note "Beta Version: 0.3.0"
!!! note "Beta Version: 0.4.0"
QubiPy is currently in beta. While functional, some features might change before the stable release.

**QubiPy** is a Python library that provides RPC and Core client functionality. You can interact quickly and easily with the Qubic RPC API using the different methods offered by this library.

![release](https://img.shields.io/badge/release-v0.3.0--beta-blue)
![release](https://img.shields.io/badge/release-v0.4.0--beta-blue)
![python](https://img.shields.io/badge/python-3.10_%7C_3.11_%7C_3.12-blue)
![Python Package](https://github.com/QubiPy-Labs/QubiPy/actions/workflows/python-package.yml/badge.svg)
![Code Quality](https://github.com/QubiPy-Labs/QubiPy/actions/workflows/pylint.yml/badge.svg)
Expand Down Expand Up @@ -74,6 +74,24 @@ We welcome all contributions to QubiPy! Whether you want to:

You can learn how to contribute [here](contributing.md)

## Support Our Work (Donations)

!!! tip "Your Contribution Matters"
QubiPy is developed and maintained by QubiPy Labs as a free, open-source project for the Qubic community.

Our dedication to providing high-quality tools is driven by passion, but maintaining and enhancing the library requires time, effort, and resources.

If you find QubiPy valuable and wish to support its continued development, any contribution is greatly appreciated.

Your donations help us cover operational costs, dedicate more time to new features, bug fixes, and comprehensive documentation, ensuring QubiPy remains a robust tool for everyone.

You can send your generous contributions to the following addresses:

* QUBIC : **`CNSLISZCRHAVHADBQCZWVYAVTYXCVNQREGVVTWKBLHSJXFHRFEGNLORCHRSE`**
* USDT (ETH, ARB, BSC or Polygon) : **`0x453471Cc01868895b833841Ce7DbaE11fd9D1933`**

A huge thank you for being a part of the QubiPy journey!

## Community


Expand Down
2 changes: 1 addition & 1 deletion docs/requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ GitPython==3.1.43
Pygments==2.18.0
PyYAML==6.0.2
Markdown==3.7
Jinja2==3.1.5
Jinja2==3.1.6
2 changes: 2 additions & 0 deletions qubipy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

CORE_URL = 'https://api.qubic.org/v1'

MONERO_URL = 'https://xmr-stats.qubic.org' # This URL is only used to obtain monero mining stats.

TIMEOUT = 5

HEADERS = {
Expand Down
31 changes: 31 additions & 0 deletions qubipy/core/core_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,4 +541,35 @@ def get_qx_fees(self) -> Dict[str, Any]:
return data
except requests.RequestException as E:
raise QubiPy_Exceptions(f"Error when getting QX fees: {str(E)}") from None

def get_monero_mining_stats(self) -> Dict[str, Any]:

"""
Retrieves current Monero mining statistics from the external Monero system.

This function makes an API call to fetch real-time or recent data related
to Monero network mining.

Returns:
Dict[str, Any]: A dictionary containing various statistics related to Monero mining,
such as pool and network hashrates, network difficulty, block height,
and other relevant pool/miner data. The exact structure and content
depend on the Monero API response.

Raises:
QubiPy_Exceptions: If there is an issue during the API request execution (e.g.,
a network connection error, a non-2xx HTTP status code from the
API server, a timeout during the request, or if the API
response cannot be parsed as valid JSON).
"""
try:
REWARD_PER_MONERO_BLOCK = 0.6
response = requests.get(f'{MONERO_URL}{MONERO_MINING_STATS}', headers=HEADERS, timeout=self.timeout)
response.raise_for_status() # Raise an exception for bad HTTP status codes
data = response.json()
raw_rewards = data.get('pool_blocks_found', 0) * REWARD_PER_MONERO_BLOCK
data['monero_amount_rewards'] = round(raw_rewards, 8)
return data
except requests.RequestException as E:
raise QubiPy_Exceptions(f"Error when getting the monero mining stats: {str(E)}") from None

6 changes: 5 additions & 1 deletion qubipy/endpoints_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@

QX_ENTITY_BID_ORDERS = '/qx/getEntityBidOrders'

QX_FEES = '/qx/getFees'
QX_FEES = '/qx/getFees'

# MONERO MINING STATS

MONERO_MINING_STATS = '/stats'
2 changes: 1 addition & 1 deletion qubipy/endpoints_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

RICH_LIST = '/rich-list'

# Testing
# ASSETS

ASSETS_ISSUANCE = '/assets/issuances'

Expand Down
12 changes: 11 additions & 1 deletion qubipy/rpc/rpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import requests
from typing import Dict, Any
import json
import warnings

from qubipy.exceptions import *
from qubipy.config import *
Expand Down Expand Up @@ -586,14 +587,23 @@ def get_block_height(self) -> Dict[str, Any]:
"""
Retrieves the current block height from the API.

..deprecated:: 0.4.0
The `get_block_height()` function is deprecated and will be removed in a future version of QubiPy.
Please use `get_tick_info()` instead for future compatibility.

Returns:
Dict[str, Any]: A dictionary containing the current block height.
If the block height is not found, an empty dictionary is returned.

Raises:
QubiPy_Exceptions: If there is an issue with the API request (e.g., network error, invalid response, or timeout).
"""

warnings.warn(
"The 'get_block_height()' function is deprecated and will be removed in a future version of QubiPy. "
"Please use 'get_tick_info()' instead for maximum compatibility.",
DeprecationWarning,
stacklevel=2
)
try:
response = requests.get(f'{self.rpc_url}{BLOCK_HEIGHT}', headers=HEADERS, timeout=self.timeout)
response.raise_for_status()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ pluggy==1.5.0

# Development & Formatting
black==24.10.0
setuptools==75.3.0
setuptools==78.1.1
watchdog==6.0.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

__version__ = '0.3.0'
__version__ = '0.4.0'


with open("README.md", "r", encoding="utf-8") as fh:
Expand Down