Bitcoin Forum
December 04, 2016, 10:37:30 PM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1] 2 »  All
  Print  
Author Topic: Change pushpool difficulty - [BOUNTY]  (Read 5283 times)
wannaBhacker
Member
**
Offline Offline

Activity: 96


View Profile
July 11, 2011, 09:04:50 PM
 #1

I will pay 1 BTC to someone that tells me which files to edit to change the default work difficulty to say 10 and 50 and 100 in pushpool. I want to set up a pool and can see a couple of places but have no idea what to change it to or if those are all of the spots. Can anyone help me out? I know it has to be really easy. Does anyone that runs a pool have some tips and hints to keep CPU usage low or to limit the amount of get work requests per worker? I was thinking about opening it up to botnets but with a higher difficulty it should still give GPU's an advantage. How stupid of an idea is that? Remember, just an idea. I really want to change the difficulty.

Also, another 1 BTC for someone to provide code to implement pushpool doing a SHA512 hash on the supplied password and modifying the database to have not just a user and password but also a salt field. Sure worker usernames aren't really as secure as say the web interface by why would we not protect those while we are at it too? Is that another dumb idea of mine?
1480891050
Hero Member
*
Offline Offline

Posts: 1480891050

View Profile Personal Message (Offline)

Ignore
1480891050
Reply with quote  #2

1480891050
Report to moderator
1480891050
Hero Member
*
Offline Offline

Posts: 1480891050

View Profile Personal Message (Offline)

Ignore
1480891050
Reply with quote  #2

1480891050
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480891050
Hero Member
*
Offline Offline

Posts: 1480891050

View Profile Personal Message (Offline)

Ignore
1480891050
Reply with quote  #2

1480891050
Report to moderator
1480891050
Hero Member
*
Offline Offline

Posts: 1480891050

View Profile Personal Message (Offline)

Ignore
1480891050
Reply with quote  #2

1480891050
Report to moderator
1480891050
Hero Member
*
Offline Offline

Posts: 1480891050

View Profile Personal Message (Offline)

Ignore
1480891050
Reply with quote  #2

1480891050
Report to moderator
antares
Hero Member
*****
Offline Offline

Activity: 518


View Profile
July 11, 2011, 10:12:14 PM
 #2

hey there, changing the difficulty in pushpool will not help you, as the miner softwares themselves only report shares that fall under their setup difficulty. IE if pushpoold would accept shares with lower difficulties, miners would still have to be altered as well to deliver them to pushpoold
drawoc
Full Member
***
Offline Offline

Activity: 168

Firstbits: 175wn


View Profile
July 12, 2011, 04:36:45 AM
 #3

I will pay 1 BTC to someone that tells me which files to edit to change the default work difficulty to say 10 and 50 and 100 in pushpool.

In cfg.json, make sure "rpc.target.rewrite" is set to true:
Code:
# rewrite returned 'target' to difficulty-1?
"rpc.target.rewrite" : true,

Then in config.c, there's a line that says:
Code:
#define EASY_TARGET "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000"

This is the target that the workers try to reach, stored in hexidecimal (higher target = less dificult).
Here is a basic overview of how to calculate the target.

Because difficulty = maximum_target / current_target, we can also say that current_target = maximum_target / difficulty

The "maximum" target (difficulty 1) is:
00000000FFFF0000000000000000000000000000000000000000000000000000
So, if we divide this by 10, we get:
0000000019998000000000000000000000000000000000000000000000000000
Which is the target at difficulty 10.
At 50 it's about:
00000000051EB333333333333333333333333333333333333333333333333333
At 100 it's about:
00000000028F6000000000000000000000000000000000000000000000000000

So simply copying this target into the quotes after #define EASY_TARGET will set the target to a given value. Note that by default it's easier than difficulty 1.

Edit: Obviously, after modifying the source of pushpool (including config.c) you need to recompile for the changes to take effect.

Donate: 175WNXmJ1WVhFgVGKUqEhYtAQGRYAvqPA
Xenland
Legendary
*
Offline Offline

Activity: 980


I'm not just any shaman, I'm a Sha256man


View Profile
July 12, 2011, 03:26:01 PM
 #4

Okay i tried this out, everything compiled fine, how do we know that its working? less shares being subbmitted?
UPloaded the compiled version to my official website just to test it out: www.miningfarm.com
it seems when i do this hashrate calculations goooo way down, but that could be because the formula i use is based of of Difficulty 1 maybe
drawoc
Full Member
***
Offline Offline

Activity: 168

Firstbits: 175wn


View Profile
July 12, 2011, 03:42:17 PM
 #5

Okay i tried this out, everything compiled fine, how do we know that its working? less shares being subbmitted?
UPloaded the compiled version to my official website just to test it out: www.miningfarm.com
it seems when i do this hashrate calculations goooo way down, but that could be because the formula i use is based of of Difficulty 1 maybe

Whenever I use rpcminer, it outputs a line like:
Target = 00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff
Dunno if the other miners do. Anyway, if the target line corresponds to whatever you set in config.c, then it should be working.

Donate: 175WNXmJ1WVhFgVGKUqEhYtAQGRYAvqPA
wannaBhacker
Member
**
Offline Offline

Activity: 96


View Profile
July 12, 2011, 07:11:03 PM
 #6

Let me clarify my OP. I know the config.c and how to set the target there. That's the easy one.

Now, open up msg.c and head down to the check_hash function, specifically the return of better_hash. It looks like it is checking a hard coded 40 bits of 0's. Won't I need to change this spot too? What should I change this to based on the 10, 50, 100 scenarios?

Then am I missing any other spots that would also need to be change?

TeraPool
Jr. Member
*
Offline Offline

Activity: 42


View Profile
July 12, 2011, 11:33:48 PM
 #7

Why would one want to change the difficulty level in pushpool anyways?

Xenland
Legendary
*
Offline Offline

Activity: 980


I'm not just any shaman, I'm a Sha256man


View Profile
July 12, 2011, 11:38:04 PM
 #8

Why would one want to change the difficulty level in pushpool anyways?

I had an in-depth discussion with alot of people in the chat and we came up with the conclusion that all it would do is be a lighter load on the shares validation and it would keep the bandwidth down.
drawoc
Full Member
***
Offline Offline

Activity: 168

Firstbits: 175wn


View Profile
July 13, 2011, 04:08:58 AM
 #9

First of all, for the config.c part, I forgot that the target should be specified in LSB byte order (the order of each group of 2 hex digits needs to be reversed)
For example, for the target:
0000000019998000000000000000000000000000000000000000000000000000
You would specify this in config.c as:
0000000000000000000000000000000000000000000000000080991900000000

The target:
00000000051EB333000000000000000000000000000000000000000000000000
Goes to:
00000000000000000000000000000000000000000000000033B31E0500000000

This:
00000000028F6000000000000000000000000000000000000000000000000000
Would be written as:
000000000000000000000000000000000000000000000000000F628000000000

Let me clarify my OP. I know the config.c and how to set the target there. That's the easy one.

Now, open up msg.c and head down to the check_hash function, specifically the return of better_hash. It looks like it is checking a hard coded 40 bits of 0's. Won't I need to change this spot too? What should I change this to based on the 10, 50, 100 scenarios?

Then am I missing any other spots that would also need to be change?

Ah, I missed that initially.

So, for difficulty 10, we'd have the target:
0000000019998000000000000000000000000000000000000000000000000000

We can take the target and split it up into 32 bit sections:
00000000
19998000
00000000
00000000
00000000
00000000
00000000
00000000

The hash has to be less that the target, and the target is using Little endian (LSB first) byte ordering. So, in order for the hash to be less than the target, the first (last because of LSB) 32 bit integer must be zero, and the second integer (2nd to last because of LSB) must be less than or equal to 0x19998000.

So, if you change this line (Line 299):
Code:
if (hash32[7] != 0) {
to:
Code:
if (hash32[7] != 0 || hash32[6] > 0x19998000) {
It should check the hash correctly. (The byte swapping on each of the 32 bit fields has been done for us already, but not on the array as a whole, so we start counting at the end which is 7 ; also keep in mind we're zero indexing)

For a difficulty of 50, i'd round off the threes
From:
00000000051EB333333333333333333333333333333333333333333333333333
To:
00000000051EB333000000000000000000000000000000000000000000000000

And simply check hash32[6] against 0x051EB333 instead of 0x19998000.
Similarly, for difficulty 100 i'd just check against 0x028F6000

Note that I don't much like byte swapping, and haven't tested my (one line of) code out, so you might want to get someone else to look over my logic here.

I'll read over the code for any more spots that might need modification in the morning.

(Hardest 1 BTC ever)

Donate: 175WNXmJ1WVhFgVGKUqEhYtAQGRYAvqPA
jgarzik
Legendary
*
Offline Offline

Activity: 1470


View Profile
July 13, 2011, 04:12:16 AM
 #10

Now, open up msg.c and head down to the check_hash function, specifically the return of better_hash. It looks like it is checking a hard coded 40 bits of 0's. Won't I need to change this spot too? What should I change this to based on the 10, 50, 100 scenarios?

Correct.  In addition to changing EASY_TARGET, you must update check_hash.

IMHO the bounty should go to the person submitting a patch that makes difficulty variable, without recompiling the source code!


Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Xenland
Legendary
*
Offline Offline

Activity: 980


I'm not just any shaman, I'm a Sha256man


View Profile
July 13, 2011, 03:07:34 PM
 #11

What does rechecking that hash do?
I've found 2 blocks so far on the MiningFarm.com/stats.php on this difficulty change. With 10+ confirms for both.
drawoc
Full Member
***
Offline Offline

Activity: 168

Firstbits: 175wn


View Profile
July 13, 2011, 04:13:49 PM
 #12

What does rechecking that hash do?
I've found 2 blocks so far on the MiningFarm.com/stats.php on this difficulty change. With 10+ confirms for both.

If you don't change the hash checking code, miners could potentially submit targets that only meet the target:
00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
and not whatever you changed the target to, and still have those hashes be valid.

In other words, if I knew that you were feeding me the target 0000000019998000000000000000000000000000000000000000000000000000, but still had the checking code hard coded for 00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff, I could modify my miner with the target set at 00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff, and gain an unfair advantage by submitting hashes that don't meet the target 0000000019998000000000000000000000000000000000000000000000000000, but are still marked valid by the server.

Donate: 175WNXmJ1WVhFgVGKUqEhYtAQGRYAvqPA
froggy
Full Member
***
Offline Offline

Activity: 127


View Profile WWW
July 23, 2011, 10:19:38 AM
 #13

I've been looking at scalability of pools and completely agree that being able to change pushpool's difficulty is becoming an essential requirement, and will be even more necessary as hashing capabilities of improved hardware/technology increases, and as more people join pools as as difficulty of generating blocks increases.  

If we do make pushpool's difficulty changeable, how does this affect what antares mentioned though?  Will miner clients report lots of "rejected" shares, thus putting off people who are mining at a particular pool?  
dikidera
Full Member
***
Offline Offline

Activity: 126


View Profile
July 24, 2011, 04:14:29 PM
 #14

Now, open up msg.c and head down to the check_hash function, specifically the return of better_hash. It looks like it is checking a hard coded 40 bits of 0's. Won't I need to change this spot too? What should I change this to based on the 10, 50, 100 scenarios?

Correct.  In addition to changing EASY_TARGET, you must update check_hash.

IMHO the bounty should go to the person submitting a patch that makes difficulty variable, without recompiling the source code!


Well no, cause then cgminer will be broken perhaps.
jgarzik
Legendary
*
Offline Offline

Activity: 1470


View Profile
July 24, 2011, 10:33:03 PM
 #15

Now, open up msg.c and head down to the check_hash function, specifically the return of better_hash. It looks like it is checking a hard coded 40 bits of 0's. Won't I need to change this spot too? What should I change this to based on the 10, 50, 100 scenarios?

Correct.  In addition to changing EASY_TARGET, you must update check_hash.

IMHO the bounty should go to the person submitting a patch that makes difficulty variable, without recompiling the source code!


Well no, cause then cgminer will be broken perhaps.

No, that will not break cgminer.  All miners are built to handle any difficulty.

You're just confused.


Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
dikidera
Full Member
***
Offline Offline

Activity: 126


View Profile
July 24, 2011, 11:20:37 PM
 #16

Now, open up msg.c and head down to the check_hash function, specifically the return of better_hash. It looks like it is checking a hard coded 40 bits of 0's. Won't I need to change this spot too? What should I change this to based on the 10, 50, 100 scenarios?

Correct.  In addition to changing EASY_TARGET, you must update check_hash.

IMHO the bounty should go to the person submitting a patch that makes difficulty variable, without recompiling the source code!


Well no, cause then cgminer will be broken perhaps.

No, that will not break cgminer.  All miners are built to handle any difficulty.

You're just confused.


Orly? How about checking the code in the gpuminer_thread or findnonce.c and tell me where you see a check for hash < target or even where the target is derived from?
jgarzik
Legendary
*
Offline Offline

Activity: 1470


View Profile
July 25, 2011, 09:19:44 PM
 #17

Orly? How about checking the code in the gpuminer_thread or findnonce.c and tell me where you see a check for hash < target or even where the target is derived from?

You claimed that cgminer would break with a different difficulty.

cgminer and its ancestor, cpuminer, will push all H==0 solutions.  This is not the same thing.

Your income remains the same, either way.


Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
dikidera
Full Member
***
Offline Offline

Activity: 126


View Profile
July 25, 2011, 11:12:59 PM
 #18

Orly? How about checking the code in the gpuminer_thread or findnonce.c and tell me where you see a check for hash < target or even where the target is derived from?

You claimed that cgminer would break with a different difficulty.

cgminer and its ancestor, cpuminer, will push all H==0 solutions.  This is not the same thing.

Your income remains the same, either way.


Ok, if not break, then it will have a tad bit more rejects, cause it will submit every H==0 because it does not check for hash < target. Only the cpuminer does.
jgarzik
Legendary
*
Offline Offline

Activity: 1470


View Profile
July 26, 2011, 01:58:31 AM
 #19

No, cpuminer does not check for hash < target.

Jeff Garzik, bitcoin core dev team and BitPay engineer; opinions are my own, not my employer.
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
dikidera
Full Member
***
Offline Offline

Activity: 126


View Profile
July 26, 2011, 02:44:26 AM
 #20

No, cpuminer does not check for hash < target.

Oops, i meant the *miner_thread which is for CPU mining. And more specifically, the 4way algorithm. This is, of course, if you enable the fulltest function in util.c to return "rc".
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!