Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions miners/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# RustChain miners package
4 changes: 2 additions & 2 deletions miners/checksums.sha256
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
63aacaffe93a3631f6cf5fbb3156d8458b11d7f79a72f4b30375f1520cda5e2e linux/rustchain_linux_miner.py
4e4784f25ef975e2f3f4e05e846774949638fc8ec6c2189a1968fcb531a4284d linux/rustchain_linux_miner.py
bdd982c7bbb53d5d37c0accb2bbc9e7e3b22e12fa9031c8fba11c4ee9c9f7819 linux/fingerprint_checks.py
fac32a5c3b9d9ef5348d115ae19e5cdf8a46aa9e2af55f12951f5dea018d7ad8 macos/rustchain_mac_miner_v2.5.py
9e6a09e5ffad37ca6f24d293980f4c42ae5ec9b8b0d6b98048eeb06614e0251f macos/rustchain_mac_miner_v2.4.py
edd6fa034be308ac4c9d759b8da5c200129b57c5617b8432a89b2f142a5e9a8e macos/rustchain_mac_miner_v2.5.py
bdd982c7bbb53d5d37c0accb2bbc9e7e3b22e12fa9031c8fba11c4ee9c9f7819 macos/fingerprint_checks.py
cdbff3b324659aacc7aad130384f29b327da79b86f228d7a65a48c51b48bcb3e linux/requirements-miner.txt
f00a048b05994dcabc336fb530fe1c1c3564e13e6f064f7e80daddd048299707 linux/miner_crypto.py
Expand Down
73 changes: 73 additions & 0 deletions miners/fingerprint_checks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env python3
"""
RIP-PoA Hardware Fingerprint Validation — Platform Auto-Detect Wrapper
======================================================================

Auto-detects the current OS and delegates to the correct platform-specific
implementation (linux/, windows/, macos/). This allows running

python3 miners/fingerprint_checks.py

from the repository root on any supported platform.

The platform-specific files are byte-for-byte identical; the subdirectory
layout exists for discoverability and to keep each platform miner
self-contained (each miner lives in its own directory with its own
fingerprint_checks.py, requirements, etc.).
"""

import importlib.util
import os
import platform
import sys

# ── Determine the platform-specific module path ────────────────────────────

_platform = platform.system().lower()
_script_dir = os.path.dirname(os.path.abspath(__file__))

if _platform == "linux":
_subdir = "linux"
elif _platform == "windows":
_subdir = "windows"
elif _platform == "darwin":
_subdir = "macos"
else:
# Fallback: try linux first (most generic), then windows
for _candidate in ("linux", "windows"):
_path = os.path.join(_script_dir, _candidate, "fingerprint_checks.py")
if os.path.exists(_path):
_subdir = _candidate
break
else:
raise ImportError(
f"Unsupported platform {_platform!r} and no platform-specific "
f"fingerprint_checks module found under miners/"
)

_fp_path = os.path.join(_script_dir, _subdir, "fingerprint_checks.py")

# ── Load the platform-specific module ──────────────────────────────────────

_spec = importlib.util.spec_from_file_location(
f"fingerprint_checks_{_subdir}", _fp_path
)
_mod = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_mod)

# ── Re-export every public name ────────────────────────────────────────────
# This makes "from fingerprint_checks import validate_all_checks" work
# regardless of whether the import resolved through the wrapper or directly.

for _attr in dir(_mod):
if not _attr.startswith("_"):
globals()[_attr] = getattr(_mod, _attr)

# ── Allow running directly ─────────────────────────────────────────────────

if __name__ == "__main__":
passed, results = validate_all_checks()
print("\n\nDetailed Results:")
import json
print(json.dumps(results, indent=2, default=str))
sys.exit(0 if passed else 1)
12 changes: 9 additions & 3 deletions miners/linux/rustchain_linux_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@

# Import fingerprint checks
try:
from fingerprint_checks import validate_all_checks
# Try platform-prefixed path first (works from any working directory)
from miners.linux.fingerprint_checks import validate_all_checks
FINGERPRINT_AVAILABLE = True
except ImportError:
FINGERPRINT_AVAILABLE = False
print("[WARN] fingerprint_checks.py not found - fingerprint attestation disabled")
try:
# Fall back to direct import (works when running from miners/linux/)
from fingerprint_checks import validate_all_checks
FINGERPRINT_AVAILABLE = True
except ImportError:
FINGERPRINT_AVAILABLE = False
print("[WARN] fingerprint_checks.py not found - fingerprint attestation disabled")

# Import Warthog dual-mining sidecar
try:
Expand Down
12 changes: 9 additions & 3 deletions miners/macos/rustchain_mac_miner_v2.5.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,17 @@ def error(msg): return msg

# Import fingerprint checks
try:
from fingerprint_checks import validate_all_checks
# Try platform-prefixed path first (works from any working directory)
from miners.macos.fingerprint_checks import validate_all_checks
FINGERPRINT_AVAILABLE = True
except ImportError:
FINGERPRINT_AVAILABLE = False
print(warning("[WARN] fingerprint_checks.py not found - fingerprint attestation disabled"))
try:
# Fall back to direct import (works when running from miners/macos/)
from fingerprint_checks import validate_all_checks
FINGERPRINT_AVAILABLE = True
except ImportError:
FINGERPRINT_AVAILABLE = False
print(warning("[WARN] fingerprint_checks.py not found - fingerprint attestation disabled"))

# Import CPU architecture detection
try:
Expand Down
2 changes: 1 addition & 1 deletion miners/windows/rustchain_miner_setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set "PYTHON_URL=https://www.python.org/ftp/python/3.11.5/python-3.11.5-amd64.exe
set "PYTHON_INSTALLER=%SCRIPT_DIR%python-3.11.5-amd64.exe"
set "MINER_URL=https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/windows/rustchain_windows_miner.py"
set "MINER_SCRIPT=%SCRIPT_DIR%rustchain_windows_miner.py"
set "MINER_SHA256=99ac84a489ebc8c1987eddc02dfbaf8672a9d440cc2cc9e1166c6ba25f4e8184"
set "MINER_SHA256=86bd4f9704d89864055df8f572f594535c22f8cc98f20d5d11bdd081b27da3b6"
set "CRYPTO_URL=https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/windows/miner_crypto.py"
set "CRYPTO_SCRIPT=%SCRIPT_DIR%miner_crypto.py"
set "CRYPTO_SHA256=f00a048b05994dcabc336fb530fe1c1c3564e13e6f064f7e80daddd048299707"
Expand Down
17 changes: 12 additions & 5 deletions miners/windows/rustchain_windows_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,20 @@
# previously dropped in a refactor and produced silent earning regressions
# for every v3.1.0/v3.1.1-bundled install. Restored 2026-05-28 for v3.1.2.
try:
from fingerprint_checks import validate_all_checks
# Try platform-prefixed path first (works from any working directory)
from miners.windows.fingerprint_checks import validate_all_checks
FINGERPRINT_AVAILABLE = True
_FP_IMPORT_ERROR = ""
except Exception as e:
FINGERPRINT_AVAILABLE = False
_FP_IMPORT_ERROR = str(e)
validate_all_checks = None
except Exception:
try:
# Fall back to direct import (works when running from miners/windows/)
from fingerprint_checks import validate_all_checks
FINGERPRINT_AVAILABLE = True
_FP_IMPORT_ERROR = ""
except Exception as e:
FINGERPRINT_AVAILABLE = False
_FP_IMPORT_ERROR = str(e)
validate_all_checks = None

# ── Ed25519 signing (GPT-5.4 audit finding #2) ──
# Optional: if miner_crypto.py + PyNaCl are available, sign attestations
Expand Down
6 changes: 3 additions & 3 deletions setup_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
MINER_ARTIFACTS = {
"Linux": {
"url": "https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/linux/rustchain_linux_miner.py",
"sha256": "63aacaffe93a3631f6cf5fbb3156d8458b11d7f79a72f4b30375f1520cda5e2e",
"sha256": "4e4784f25ef975e2f3f4e05e846774949638fc8ec6c2189a1968fcb531a4284d",
},
"Darwin": {
"url": "https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/macos/rustchain_mac_miner_v2.5.py",
"sha256": "edd6fa034be308ac4c9d759b8da5c200129b57c5617b8432a89b2f142a5e9a8e",
"sha256": "fac32a5c3b9d9ef5348d115ae19e5cdf8a46aa9e2af55f12951f5dea018d7ad8",
},
"Windows": {
"url": "https://raw.githubusercontent.com/Scottcjn/Rustchain/main/miners/windows/rustchain_windows_miner.py",
"sha256": "99ac84a489ebc8c1987eddc02dfbaf8672a9d440cc2cc9e1166c6ba25f4e8184",
"sha256": "86bd4f9704d89864055df8f572f594535c22f8cc98f20d5d11bdd081b27da3b6",
},
}

Expand Down