rplant8 / cpuminer-opt-rplant

105 stars 75 forks source link

cpuminer cannot connect to several BTC pools #55

Closed PSLLSP closed 4 months ago

PSLLSP commented 8 months ago

cpuminer-rplant 5.0.36L

The first issue, miner version is not reported in --version:

$ ./cpuminer-sse2 -V

 built on Oct 16 2023 with GCC 13.2.0
 features: x86_64 SSE2 AVX AVX2 XOP

libcurl/7.84.0 OpenSSL/1.1.1q zlib/1.2.11 c-ares/1.17.0
jansson/2.6 

The main issue, cpuminer cannot connect to many BTC pools.

The test script:

$ cat test-btc.sh 
#!/bin/sh

WORKER="TEST"
WALLET="1Bkg23fU9EnazGw2yyYVwQKHmjq1MRsEx4"

POOL="stratum+tcp://solo.ckpool.org:3333"       # OK
POOL="stratum+tcp://btc.luckymonster.pro:7112"  # FAIL
#POOL="stratum+tcp://pool.vkbit.com:3333"        # FAIL
#POOL="stratum+tcp://public-pool.io:21496"       # FAIL
#POOL="stratum+tcp://sha256.auto.nicehash.com:9200" # OK

USER="$WALLET.$WORKER"
PASS="x"

ALGO="sha256d"

OPTS="-t1"

MINER="./cpuminer-sse2"
#MINER="./minerd"  # pooler cpuminer

$MINER -V
$MINER -a "$ALGO" -o "$POOL" -u "$USER" -p "$PASS" $OPTS "$@"

The test scipt has configuration for 4 different mining pools and cpuminer can connect only to the fist one, solo.clpool.org but it is rejected from the rest.

Example of failure:

$ sh test-btc.sh
...
         **********  cpuminer-rplant 5.0.36L-sse2 *********** 
CPU: 11th Gen Intel(R) Core(TM) i3-1115G4 @ 3.00GHz 
SW built on Oct 16 2023 with GCC 13.2.0
CPU features:  AVX512 VAES SHA
SW features:   SSE2  
Algo features: AVX2  

Starting miner with SSE2...

[2023-12-07 06:08:52] CPU affinity [.!..]
[2023-12-07 06:08:52] Stratum connect btc.luckymonster.pro:7112
[2023-12-07 06:08:52] 1 of 4 miner threads started using 'sha256d' algorithm
[2023-12-07 06:08:52] Miner thread priority 0 (nice 19)
[2023-12-07 06:08:52] stratum_recv_line failed
[2023-12-07 06:08:52] ...retry after 10 seconds
[2023-12-07 06:08:55] SIGINT received, exiting

pooler cpuminer can connect to all pools in the test script:

$ sh test-btc.sh 
cpuminer 2.5.1
 built on Jun 25 2020
 features: x86_64 PHE SSE2 AVX AVX2 XOP
libcurl/7.71.0 mbedTLS/2.16.6 zlib/1.2.11
[2023-12-07 06:13:18] 1 miner threads started, using 'sha256d' algorithm.
[2023-12-07 06:13:18] Starting Stratum on stratum+tcp://btc.luckymonster.pro:7112
[2023-12-07 06:13:19] thread 0: 2097152 hashes, 9430 khash/s

Detail, miner started with parameter -P to troubleshoot stratum protocol. cpuminer-opt, failure:

...
* Connected to btc.luckymonster.pro (107.174.63.212) port 7112 (#0)
* Connection #0 to host btc.luckymonster.pro left intact
[2023-12-07 06:18:21] > {"id": 1, "method": "mining.subscribe", "params": ["cpuminer-rplant/5.0.36L-sse2"]}
[2023-12-07 06:18:21] < {"result":[[["mining.set_difficulty","0HMUOM4KE2QAU"],["mining.notify","0HMUOM4KE2QAU"]],"40065135",4],"error":null,"id":1}
[2023-12-07 06:18:21] > {"id": 2, "method": "mining.authorize", "params": ["1Bkg23fU9EnazGw2yyYVwQKHmjq1MRsEx4.TEST", "x", ["s2", "b"]]}
[2023-12-07 06:18:21] < {"jsonrpc":"2.0","method":"mining.set_difficulty","params":[25000.0],"id":null}
[2023-12-07 06:18:21] < {"jsonrpc":"2.0","method":"mining.notify","params":["00051ca1","01c1ca67440b6dc54cfe25c8f7d80563af1536f7031d4aaf0000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff16034d8d0c049655716500","03706477000000000154f44025000000001976a914ff7e2e79b39b93e4fd59467bdb131b560fedc4cf88ac00000000",["3b0a20b9870bcb3673ca1eca5298e04ce1598f04c0657ad64b4ca04babc76c11","40bb14988091009c65f6baff6c698155a416a634297330b4a32b980be54c5dff","18e58740e99741b36328ce7c9eeb47cf8cd1e723a8c9f6b6325433fb28711b0f","a61c4697621ab5aee5d51a414fde6afa943f9c21693c65014c65e9963283a218"],"20000000","18034c29","65715596",false],"id":null}
[2023-12-07 06:18:21] stratum_recv_line failed
[2023-12-07 06:18:21] ...retry after 10 seconds

cpuminer-pooler, it can mine:

...
* Connected to btc.luckymonster.pro (107.174.63.212) port 7112 (#0)
* Connection #0 to host btc.luckymonster.pro left intact
[2023-12-07 06:19:01] > {"id": 1, "method": "mining.subscribe", "params": ["cpuminer/2.5.1"]}
[2023-12-07 06:19:01] < {"result":[[["mining.set_difficulty","0HMUOM4KE2QB2"],["mining.notify","0HMUOM4KE2QB2"]],"40065138",4],"error":null,"id":1}
[2023-12-07 06:19:01] > {"id": 2, "method": "mining.authorize", "params": ["1Bkg23fU9EnazGw2yyYVwQKHmjq1MRsEx4.TEST", "x"]}
[2023-12-07 06:19:01] < {"jsonrpc":"2.0","method":"mining.set_difficulty","params":[25000.0],"id":null}
[2023-12-07 06:19:01] < {"jsonrpc":"2.0","method":"mining.notify","params":["00051ca5","01c1ca67440b6dc54cfe25c8f7d80563af1536f7031d4aaf0000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff16034d8d0c04be55716500","037064770000000001b01b4125000000001976a914ff7e2e79b39b93e4fd59467bdb131b560fedc4cf88ac00000000",["3b0a20b9870bcb3673ca1eca5298e04ce1598f04c0657ad64b4ca04babc76c11","684b99b9f04705ee0146369fc2761fb6a248220b0433a9a7a266f628ff2e15f9","b6b6bd137877d20a195eb5d94f442ece9ba19b676f2c6de79e7902e4e67a26f2","9d15b688b7f09a3599ecd7e7af96330dac91d0e1f8fafeb47018d9aeeeed18b8","5aa013db35b24f20984102ceb7908f2fb5efc834c0208017c6151bae244210a0"],"20000000","18034c29","657155be",false],"id":null}
[2023-12-07 06:19:01] < {"result":true,"error":null,"id":2}
[2023-12-07 06:19:02] thread 0: 2097152 hashes, 10156 khash/s

Difference is in parameters for method mining.authorize, it looks like many pools do not accept extra parameters...

accepted:

{"id": 2, "method": "mining.authorize", "params": ["1Bkg23fU9EnazGw2yyYVwQKHmjq1MRsEx4.TEST", "x"]}

rejected:

{"id": 2, "method": "mining.authorize", "params": ["1Bkg23fU9EnazGw2yyYVwQKHmjq1MRsEx4.TEST", "x", ["s2", "b"]]}
rplant8 commented 4 months ago

This miner is not a commercial product, I make it only to support my pool. work with other pools is not guaranteed or supported.