Bitcoin Forum
December 07, 2016, 10:29:08 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: Calculating a block - merkle root question  (Read 3698 times)
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
June 08, 2011, 08:13:49 PM
 #21

You need to modify the Bitcoin code for that. You can't do it just by using getwork.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481149748
Hero Member
*
Offline Offline

Posts: 1481149748

View Profile Personal Message (Offline)

Ignore
1481149748
Reply with quote  #2

1481149748
Report to moderator
1481149748
Hero Member
*
Offline Offline

Posts: 1481149748

View Profile Personal Message (Offline)

Ignore
1481149748
Reply with quote  #2

1481149748
Report to moderator
Pibers
Newbie
*
Offline Offline

Activity: 9


View Profile
June 09, 2011, 02:48:37 PM
 #22

Hey,
I took data with getwork while block 129593 was the newest on blockexplorer.com and also with bitcoind getinfo it said "block" : 129593.
But now I have a Problem. This is what "bitcoind getwork" gave me (already formated):
Code:
00000001
9ba7ad42f0b7c0c3bcec91db32107ad5ffaa4e07af2ed372000006e400000000
c2aa00b9a62ed9f4642c35b12cea291fc778be2e7b29a3879ffaf9d3c567cdd9
4df0d584
1a1d932f
00000000
000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000
So the previous hash (if I reverse it) is:
000000004e600000273de2fa70e4aaff5da70123bd19cecb3c0c7b0f24da7ab9

But bitexplorer said that previous hash is:
000000000000169df290bd7628e59dae18405aba2f660b4ff832f93dc9a10fb0

The first hash also hasn't enough zeros I guess!? What's wrong there?

What can I do to convert the data from blockexplorer to a valid data string for getwork? I would like to test to send a valid block (after it is solved) and see no other way to do it than taking the data from blockexplorer...
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
June 09, 2011, 06:18:24 PM
 #23

The hashes have been reversed on 8-byte boundaries. I guess this is a hashing optimization. I'm not sure.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Pibers
Newbie
*
Offline Offline

Activity: 9


View Profile
June 09, 2011, 08:20:44 PM
 #24

Mh thanks but I don't get that but I think it is not so important Smiley
Though I have one last question. When I want to calculate a block am I on the right way with that?
- I take the data string from getwork (without line breakes)
- I try many values at the place in the string where the nonce is (should be from char at position 153 to 161)
- After each nonce value I SHA256 the whole string
- Now I test if there is the right count of leading zeros!?

I dont understand the last step. Afaik I have to check if the hash is smaller than the current target. But how can I do this?
For example the hash from previous post:
000000000000169df290bd7628e59dae18405aba2f660b4ff832f93dc9a10fb0

How can I check if it is valid? (I dont mean the check bitcoin does like if the merkle tree or the timestamp is right. I mean just the check if it hast the right difficulty)
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
June 09, 2011, 09:11:57 PM
 #25

They're both large numbers. Just see if the hash is less than the target.

You shouldn't do this every try, though. It's more efficient to count the zeroes and then do a full test when you have a candidate.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Pibers
Newbie
*
Offline Offline

Activity: 9


View Profile
June 10, 2011, 04:21:43 PM
 #26

Oh yes, now where you have said it it is obvious  Embarrassed
Thanks! Smiley

I guess you have no solved old data block or know where I can get one? Maybe for testnet?
theymos
Administrator
Legendary
*
Offline Offline

Activity: 2492


View Profile
June 10, 2011, 05:56:04 PM
 #27

I don't have old getdata output. Here's a block header you can try hashing, though this does not have the reversal on 8-bytes:
Code:
010000001d8f4ec0443e1f19f305e488c1085c95de7cc3fd25e0d2c5bb5d0000000000009762547903d36881a86751f3f5049e23050113f779735ef82734ebf0b4450081d8c8c84db3936a1a334b035b

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
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!