Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: ahtremblay on June 08, 2011, 04:48:50 AM



Title: How to calculate the target from getwork function?
Post by: ahtremblay on June 08, 2011, 04:48:50 AM
Hello, when I call getwork from linux boitcoind, I obtain a target of 00000000000000000000000000000000000000000000002f931d000000000000. I am not sure what preparatory processing I need to do on this value before comparing it to my hash. My miner will take longer than a billion year to find a hash with 0000000000000000000000000000000000000000000000 leading zeros. Therefore I assume it has to be processed somehow.


Code:
./bitcoind getwork
{
    "midstate" : "48d2cf8bf3e3cd13e69656d4aca930bc30ba1db0440dfcedbe2df42a99460042",
    "data" : "000000017d56792f3c95c9efd8af023e4d55e8e86b3005185e623a040000017400000000a76209a8d888c7bee6746a22102cc3b919f77ec52ddd00d8790569b8143681c84deefec11a1d932f00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000",
    "hash1" : "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000",
    "target" : "00000000000000000000000000000000000000000000002f931d000000000000"
}


Title: Re: How to calculate the target from getwork function?
Post by: Raistlan on June 08, 2011, 10:59:39 AM
Here's the current target at Block Explorer: http://blockexplorer.com/q/hextarget
Code:
0000000000001D932F0000000000000000000000000000000000000000000000
So it looks like it is Little Endian, and if you operate on Big Endian data, you'll want to reverse it, byte by byte.


Title: Re: How to calculate the target from getwork function?
Post by: ahtremblay on June 08, 2011, 07:17:10 PM
Wait. This is the target for finding a full block? I thought the getwork function returned a easier problem.


Title: Re: How to calculate the target from getwork function?
Post by: foo on June 09, 2011, 10:14:42 AM
Wait. This is the target for finding a full block? I thought the getwork function returned a easier problem.
bitcoind returns the current network difficulty. You need pool software to get difficulty 1.