tobasco
Jr. Member
Offline
Activity: 52
Merit: 2
|
 |
January 14, 2015, 11:16:42 AM |
|
Hi there, I'm looking at the block header information on this page: https://en.bitcoin.it/wiki/Block_hashing_algorithmIt covers the following block header fields: Version hashPrevBlock hashMerkleRoot Time Bits Nonce1. Are these the exact field names used in the protocol, or are these just descriptive names for the purposes of the article?2. A question about the Bits field.When hashing the block header in the example PHP code at the bottom of the bitcoin wiki page, the value used for Bits is 440711666. However, when looking at the block information ( http://blockexplorer.com/b/125552), the value they have displayed for Bits is Difficulty?: 244 112.487774 ("Bits"?: 1a44b9f2)How do I convert the difficulty/bits information displayed on blockexplorer to 440711666?
|
Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254
http://learnmeabitcoin.com
|
|
|
|
|
|
Make a difference with your Ether. Donate Ether for the greater good.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
|
|
|
|
|
|
|
ncsupanda
Legendary
Offline
Activity: 1092
Merit: 1000
|
 |
January 14, 2015, 11:29:07 AM |
|
Hi there, I'm looking at the block header information on this page: https://en.bitcoin.it/wiki/Block_hashing_algorithmIt covers the following block header fields: Version hashPrevBlock hashMerkleRoot Time Bits Nonce1. Are these the exact field names used in the protocol, or are these just descriptive names for the purposes of the article?2. A question about the Bits field.When hashing the block header in the example PHP code at the bottom of the bitcoin wiki page, the value used for Bits is 440711666. However, when looking at the block information ( http://blockexplorer.com/b/125552), the value they have displayed for Bits is Difficulty?: 244 112.487774 ("Bits"?: 1a44b9f2)How do I convert the difficulty/bits information displayed on blockexplorer to 440711666? Take a look at the source code - the first question answers itself. https://github.com/bitcoin/bitcoin
|
|
|
|
|
|
dabura667
|
 |
January 14, 2015, 11:43:18 AM |
|
1. Are these the exact field names used in the protocol, or are these just descriptive names for the purposes of the article?
2. A question about the Bits field.
1. What do you mean "used in the protocol"? Do you mean what is the name of the containers in the source code? 2. https://en.bitcoin.it/wiki/Difficulty#How_is_difficulty_stored_in_blocks.3FOnce you figure out how to calculate the msb with the remaining 3 bytes at this link, you'll figure it out.
|
My Tip Address: 1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
|
|
|
tobasco
Jr. Member
Offline
Activity: 52
Merit: 2
|
 |
January 14, 2015, 11:57:54 AM |
|
1. What do you mean "used in the protocol"? Do you mean what is the name of the containers in the source code?
Yes. Sorry my terminology is poor. I was able to find (I think) that hashMerkleRoot is a block header field name from this file: https://github.com/bitcoin/bitcoin/blob/master/src/merkleblock.cppHowever I must confess that I am noob to the source. Can you point me in the direction of where I might find the code for the hashing the block header (and thus the field/container names)?
|
Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254
http://learnmeabitcoin.com
|
|
|
ncsupanda
Legendary
Offline
Activity: 1092
Merit: 1000
|
 |
January 14, 2015, 12:00:10 PM |
|
1. What do you mean "used in the protocol"? Do you mean what is the name of the containers in the source code?
Yes. Sorry my terminology is poor. I was able to find (I think) that hashMerkleRoot is a block header field name from this file: https://github.com/bitcoin/bitcoin/blob/master/src/merkleblock.cppHowever I must confess that I am noob to the source. Can you point me in the direction of where I might find the code for the hashing the block header (and thus the field/container names)? By "hashing the block header" are you referring to hashing the contents of the merkleblock.cpp file?
|
|
|
|
|
tobasco
Jr. Member
Offline
Activity: 52
Merit: 2
|
 |
January 14, 2015, 12:21:42 PM |
|
By "hashing the block header" are you referring to hashing the contents of the merkleblock.cpp file?
I do not understand the structure of the code well enough to answer your question accurately. Although I'd say that "hashing the contents of the merkleblock.cpp file" is an inaccurate evaluation of what I'm looking to achieve. To try and clarify, what I believe I am now looking for are the file(s) that performs this: "When mining bitcoin, the hashcash algorithm repeatedly hashes the block header while incrementing the counter & extraNonce fields." - https://en.bitcoin.it/wiki/Block_hashing_algorithmNote that finding the block header field names (container names?) in the source code is still my primary goal.
|
Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254
http://learnmeabitcoin.com
|
|
|
tobasco
Jr. Member
Offline
Activity: 52
Merit: 2
|
 |
January 14, 2015, 02:02:03 PM |
|
Okay, so f2b9441a is the Little-endian of 440711666. Where does 440711666 come from? https://en.bitcoin.it/wiki/Block_hashing_algorithm (PHP script at the bottom)
|
Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254
http://learnmeabitcoin.com
|
|
|
ncsupanda
Legendary
Offline
Activity: 1092
Merit: 1000
|
 |
January 14, 2015, 02:07:25 PM |
|
Current target difficulty.
|
|
|
|
|
tobasco
Jr. Member
Offline
Activity: 52
Merit: 2
|
 |
January 14, 2015, 02:12:36 PM |
|
I see, thank you. So how does 244 112.487774 = 440711666? http://blockexplorer.com/b/125552
|
Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254
http://learnmeabitcoin.com
|
|
|
|
grau
|
 |
January 14, 2015, 05:53:01 PM |
|
Below explanation using Matematica. I am sure you figure what the operations mean even if you do not use it regularly. In[15]:= minTarget = FromDigits["ffff", 16]*2^(8*FromDigits["1d", 16] - 3)
Out[15]= 56538243354614949726192090679290607878297928311398285361572003125835857920
In[16]:= target = FromDigits["44b9f2", 16]*2^(8*FromDigits["1a", 16] - 3)
Out[16]= 231607337543830564817752779584294829436484108612716418234853202329600
In[19]:= minTarget/target
Out[19]= 36649828352/150135
In[20]:= N[36649828352/150135]
Out[20]= 244112.
|
|
|
|
|
|
doof
|
 |
January 16, 2015, 12:47:54 AM |
|
|
|
|
|
|
|