4.5 KiB
4.5 KiB
RinHash GPU Stratum Integration Plan
Current Situation Analysis
✅ What's Working
- CPU Mining with Stratum:
cpuminer -a rinhash
connects perfectly to stratum server - GPU RinHash Algorithm:
./rinhash-gpu-miner
loads GPU library and mines (standalone) - Stratum Server: Receiving CPU connections and jobs (job_187, etc.)
❌ The Problem
GPU miner is standalone - no stratum connection, no real jobs from server.
// Current GPU miner uses dummy data:
std::vector<uint8_t> test_header(80, 0); // ❌ Fake block header
miner.setBlockHeader(test_header); // ❌ Not from stratum server
Integration Solutions
Solution 1: Quick Fix - Copy GPU Library Integration
Use the working cpuminer
binary and integrate our GPU library.
Status: Our rinhashgpu.c
implementation already does this:
// Tries to load GPU library, falls back to CPU
void* gpu_lib_handle = dlopen("./rocm-direct-output/gpu-libs/librinhash_hip.so", RTLD_LAZY);
Issue: The working cpuminer binary doesn't include our rinhashgpu
algorithm.
Solution 2: Add Stratum Protocol to GPU Miner
Extend our standalone GPU miner with stratum support.
Required Components:
- TCP Socket Connection to stratum server
- JSON-RPC Parsing for stratum messages
- Job Management (receive new jobs, submit shares)
- Mining Loop using real block headers from server
Implementation Plan
Phase 1: Minimal Stratum Support
Add basic stratum to GPU miner:
class StratumClient {
void connect(string url, int port);
bool subscribe();
bool authorize(string user, string pass);
Job getJob();
bool submitShare(uint32_t nonce, string job_id);
};
Phase 2: Full Integration
Combine stratum with GPU mining:
while (true) {
Job job = stratum.getJob(); // Real job from server
if (gpu_mine_job(job, found_nonce)) { // Mine with GPU
stratum.submitShare(found_nonce, job.id); // Submit to server
}
}
Immediate Action: Test Current Setup
Test CPU Mining with Stratum
# This works and shows on stratum server:
/home/db/Downloads/rinhash/cpuminer-opt-rin/cpuminer -a rinhash \
-o stratum+tcp://192.168.0.188:3333 -u db.test -p x -t 1
Expected stratum server output:
[('192.168.0.188', XXXXX)] Connected
[('192.168.0.188', XXXXX)] mining.subscribe: ['cpuminer-opt-25.3-x64L']
[('192.168.0.188', XXXXX)] mining.authorize: ['db.test', 'x']
[('192.168.0.188', XXXXX)] Authorized
New job created: job_XXX
Broadcasting new job: job_XXX
Test GPU Library Loading
# This works but no stratum:
./rinhash-gpu-miner
# Output: GPU library loaded successfully! (but no network connection)
Quick Solution: Hybrid Approach
Since we have:
- ✅ Working stratum client in cpuminer
- ✅ Working GPU library (
librinhash_hip.so
) - ✅ Working GPU integration code (
rinhashgpu.c
)
The fastest path is to rebuild cpuminer with our GPU integration.
Required Steps:
- Copy our modifications to the working cpuminer source
- Rebuild with GPU support
- Test
-a rinhashgpu
with stratum server
Files to Integrate:
From Our Implementation:
✅ algo/rinhash/rinhashgpu.c - GPU library integration
✅ ALGO_RINHASHGPU - Algorithm enum
✅ "rinhashgpu" - Algorithm name
✅ register_rinhashgpu_algo() - Registration function
✅ librinhash_hip.so - Working GPU library
Into Working cpuminer:
/home/db/Downloads/rinhash/cpuminer-opt-rin/
✅ ACTUAL RESULT: SUCCESSFUL!
# WORKING COMMAND:
cd /home/db/Downloads/rinhash/cpuminer-opt-rin
./cpuminer -a rinhashgpu -o stratum+tcp://192.168.0.188:3333 -u db.test -p x -t 1
# ACTUAL OUTPUT:
[2025-09-06 13:19:07] Stratum connection established
[2025-09-06 13:19:07] New Stratum Diff 1, Block 16384, Tx 0, Job job_228
[2025-09-06 13:19:08] RinHashGPU: GPU library loaded successfully
[2025-09-06 13:19:08] Thread 0: RinHashGPU using GPU acceleration
✅ ALL PRIORITY ACTIONS COMPLETED:
- ✅ GPU files integrated into working cpuminer source
- ✅ cpuminer rebuilt with GPU support (3.5MB binary)
- ✅ Stratum connection tested with
-a rinhashgpu
- ✅ GPU mining verified on stratum server
🎯 FINAL RESULT:
GPU acceleration + stratum protocol = Real GPU mining with job connections!
The GPU miner now successfully:
- ✅ Connects to stratum server
- ✅ Receives real jobs (job_228)
- ✅ Uses GPU acceleration
- ✅ Integrates seamlessly with cpuminer