TheBlueMatt / mining-proxy

BetterHash Stratum+Pool Proxies and a Sample Pool
MIT License
54 stars 13 forks source link

default difficulty #24

Open djayr opened 6 years ago

djayr commented 6 years ago

I am trying to make this work with Nicehash, but if I run it in a solo mode, than difficulty is extremely high like 21111111111111+ so all are rejects, if I run it together with a pool its using mining.set.difficulty which requests difficulty from a miner and sets it to around 16k which in contrast is too low ...

How can we set a static or min/max difficulty for instance ?

TheBlueMatt commented 6 years ago

You're trying to mine on nicehash or as a pool for nicehash? I've definitely tested it as a pool but the nicehash detection may have broken at some point. You cannot, however, use this as a client to mine on nicehash - after all the whole point of nicehash is that the buyer of the hashpower gets to pick what you mine on (attack? altcoin? shitcoin? you don't get to pick), so it would kinda defeat the purpose.

On September 20, 2018 3:39:01 PM UTC, djayr notifications@github.com wrote:

I am trying to make this work with Nicehash, but if I run it in a solo mode, than difficulty is extremely high like 21111111111111+ so all are rejects, if I run it together with a pool its using mining.set.difficulty which requests difficulty from a miner and sets it to around 16k which in contrast is too low ...

How can we set a static or min/max difficulty for instance ?

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/TheBlueMatt/mining-proxy/issues/24

djayr commented 6 years ago

I am trying to setup mining-proxy as receiving pool for solo mining,it works! :) But all I need is to be able to pick custom static difficulty.

djayr commented 6 years ago

Okay now maybe I know what you meant, I can't use this with nicehash because they only support stratum mining ..? I found out I can set my custom difficulty in a sample_pool.rs that set's min difficulty,but only for sample-pool itself. I was thinking of setting custom difficulty for mining-proxy, Is that possible ? Nicehash aside.

Does it mean, that if I want to utilize by you introduced betterhash protocol - I need to use --mining_listen_bind command,I have not yet been able figure out how to connect miners to that port does it work over http ?

TheBlueMatt commented 6 years ago

It sounds like it may just be a bug in my nicehash detection - if you're using this as a stratum server for NiceHash, it should detect it as NiceHash via the useragent "NiceHash/1.0.0" at https://github.com/TheBlueMatt/mining-proxy/blob/master/src/stratum_server.rs#L601 and set the nicehash_quirks bool, resulting in a difficulty of at least 1 million set at https://github.com/TheBlueMatt/mining-proxy/blob/master/src/stratum_server.rs#L816. Can you add some debug println!()s and see if those are being hit appropriately as well as provide the command line arguments you're passing the daemons?

djayr commented 6 years ago

COMMAND: /mining-proxy/target/debug/mining-proxy --job_provider=127.0.0.1:8334 --stratum_listen_bind=0.0.0.0:14400 --mining_auth_key=L1waCptBSphD6pNMw4WqDHcCYQi48QzcSmQud8X1z2biAsJ1opYS --payout_address=3NuFzXNwrdAGspdpnUSsrMPp7DLMcZ5Zw8

OUTPUT: Trying connection to 127.0.0.1:8334 Connected to 127.0.0.1:8334! Received ProtocolVersion, using version 1 Received new CoinbasePrefixPostfix Received new BlockTemplate with diff lower bound 2199023255552 No available pool info! Solo mining!

If I connect with ccminer


(/home/usergpu/POOl/ccminer/ccminer -a sha256d --url=stratum+tcp://IP --userpass=user:pass --debug --protocol-dump --no-extranonce)

[2018-10-01 05:33:41] Stratum difficulty set to 2.19902e+12 [2018-10-01 05:33:41] sha256d block 543865, diff 7152633351906.413 [2018-10-01 05:33:41] restart_threads [2018-10-01 05:33:41] sleeptime: 200 ms [2018-10-01 05:33:41] job bb1b062 3321684005434163728 target change: 0 (2199023255552.0)

If I use Nicehash pool verification


Sending mining.subscribe... OK Sending mining.authorize... OK Received mining.notify subscription... OK Received mining.set_difficulty... OK: difficulty=2199023255552 Received mining.notify work... OK Received authorization result... OK

Pool verification process is complete. Tested pool is compatible!

As we can deduct it sets lower bound difficulty to 2199023255552 (way too high), not only for nicehash but also for other miners, I think it would work well if it would be possible to set difficulty from a proxy side on command line

TheBlueMatt commented 6 years ago

Ah, If you only use a mining-proxy it will just pass the network difficulty through as there is nothing for it to do with lower difficulty shares. You need to point it to a running BetterHash pool server.

On October 1, 2018 5:48:18 AM UTC, djayr notifications@github.com wrote:

COMMAND: /mining-proxy/target/debug/mining-proxy --job_provider=127.0.0.1:8334 --stratum_listen_bind=0.0.0.0:10550 --mining_auth_key=L1waCptBSphD6pNMw4WqDHcCYQi48QzcSmQud8X1z2biAsJ1opYS --payout_address=3NuFzXNwrdAGspdpnUSsrMPp7DLMcZ5Zw8

OUTPUT: Trying connection to 127.0.0.1:8334 Connected to 127.0.0.1:8334! Received ProtocolVersion, using version 1 Received new CoinbasePrefixPostfix Received new BlockTemplate with diff lower bound 2199023255552 No available pool info! Solo mining!

If I connect with ccminer


(/home/usergpu/POOl/ccminer/ccminer -a sha256d --url=stratum+tcp://IP --userpass=user:pass --debug --protocol-dump --no-extranonce)

[2018-10-01 05:33:41] Stratum difficulty set to 2.19902e+12 [2018-10-01 05:33:41] sha256d block 543865, diff 7152633351906.413 [2018-10-01 05:33:41] restart_threads [2018-10-01 05:33:41] sleeptime: 200 ms [2018-10-01 05:33:41] job bb1b062 3321684005434163728 target change: 0 (2199023255552.0)

If I use Nicehash pool verification


Sending mining.subscribe... OK Sending mining.authorize... OK Received mining.notify subscription... OK Received mining.set_difficulty... OK: difficulty=2199023255552 Received mining.notify work... OK Received authorization result... OK

Pool verification process is complete. Tested pool is compatible!

As we can deduct it sets difficulty to 2199023255552, not only for nicehash but also for other miners, I think it would work well if it would be possible to set difficulty from a proxy side on command line

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/TheBlueMatt/mining-proxy/issues/24#issuecomment-425795942

TheBlueMatt commented 6 years ago

I'm more curious on why pointing the mining-proxy to a localhost sample-pool doesn't detect the client as a NiceHash proxy and set the min difficulty to 1 million.

On October 2, 2018 7:57:21 PM UTC, Matt Corallo notifications@github.com wrote:

Ah, If you only use a mining-proxy it will just pass the network difficulty through as there is nothing for it to do with lower difficulty shares. You need to point it to a running BetterHash pool server.

On October 1, 2018 5:48:18 AM UTC, djayr notifications@github.com wrote:

COMMAND: /mining-proxy/target/debug/mining-proxy --job_provider=127.0.0.1:8334 --stratum_listen_bind=0.0.0.0:10550 --mining_auth_key=L1waCptBSphD6pNMw4WqDHcCYQi48QzcSmQud8X1z2biAsJ1opYS --payout_address=3NuFzXNwrdAGspdpnUSsrMPp7DLMcZ5Zw8

OUTPUT: Trying connection to 127.0.0.1:8334 Connected to 127.0.0.1:8334! Received ProtocolVersion, using version 1 Received new CoinbasePrefixPostfix Received new BlockTemplate with diff lower bound 2199023255552 No available pool info! Solo mining!

If I connect with ccminer


(/home/usergpu/POOl/ccminer/ccminer -a sha256d --url=stratum+tcp://IP --userpass=user:pass --debug --protocol-dump --no-extranonce)

[2018-10-01 05:33:41] Stratum difficulty set to 2.19902e+12 [2018-10-01 05:33:41] sha256d block 543865, diff 7152633351906.413 [2018-10-01 05:33:41] restart_threads [2018-10-01 05:33:41] sleeptime: 200 ms [2018-10-01 05:33:41] job bb1b062 3321684005434163728 target change: 0 (2199023255552.0)

If I use Nicehash pool verification


Sending mining.subscribe... OK Sending mining.authorize... OK Received mining.notify subscription... OK Received mining.set_difficulty... OK: difficulty=2199023255552 Received mining.notify work... OK Received authorization result... OK

Pool verification process is complete. Tested pool is compatible!

As we can deduct it sets difficulty to 2199023255552, not only for nicehash but also for other miners, I think it would work well if it would be possible to set difficulty from a proxy side on command line

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/TheBlueMatt/mining-proxy/issues/24#issuecomment-425795942

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/TheBlueMatt/mining-proxy/issues/24#issuecomment-426408930