Author

Topic: Math Problems , last answers and last hashes (Read 1118 times)

legendary
Activity: 3472
Merit: 4801
This link https://en.bitcoin.it/wiki/Protocol_documentation#Block_Headers , does not work , where else can I find that layout ?

Works fine for me.

Try this one, then scroll down to the "Block Header" section:

https://en.bitcoin.it/wiki/Protocol_documentation

Sometimes, I think it is not possible for timestamp to be only 4 byte,

Yes, always 4 bytes.

or for nonce to be only 32 bits

Yes, always 32 bits.

I would like to talk to you by email or on skype if you dont mind.

Sure, go ahead and send me an email.
newbie
Activity: 10
Merit: 0

 Hello DannyHamilton

 This link https://en.bitcoin.it/wiki/Protocol_documentation#Block_Headers   , does not work , where else can I find that layout ?

 I dont want to calculate all hashes or merkle root by hand with paper and pencil.

 What I mean mining by hand is that : Entering all values of necessary content like ,  hashPrevBlock , hashMerkleRoot  , timestamp , nonce and other things to SHA 256 calculator and trying to find a hash that is smaller than given value . I know it is practically very difficult but I am trying to understand the way it works. Because , here , I have some questions in my mind about size of data. Sometimes, I think it is not possible for timestamp to be only 4 byte , or for nonce to be only 32 bits , and I really can not understand somethings.

 And I really appreciate that you give me valuable information . I would like to talk to you by email or on skype if you dont mind .



 
legendary
Activity: 3472
Merit: 4801
- snip -
I have some more new questions and I feel really confused. I think , the only one way to learn this is doing mining by hand , I mean mining without using any machine. My purpose here is not to earn money I want to know the way it works. Is that possible to do mining by hand ?

Mining is simply calculating the SHA256 hash of the block header, and then calculating the SHA256 hash of that hash value.

Then compare that result to the current target.

You want to calculate both entire SHA256 hash by hand?  It can be done, but I'm not sure how it will help you understand.  Are you saying you want to understand how a SHA256 hash is calculated?  If so, you can read about hashing the bitcoin block header by hand here:

http://www.righto.com/2014/09/mining-bitcoin-with-pencil-and-paper.html

You can also watch him do it here:

https://www.youtube.com/watch?v=y3dqhixzGVo

Are you asking about building the block header by hand?  As long as you are willing to calculate the merkle root with a computer, it is pretty easy to assemble the rest of the block header by hand.  If you want to calculate the merkle root by hand, then you are back to calculating the SHA256 hash by hand which is a tedious process.

You can see the layout of the bitcoin block header here:

https://en.bitcoin.it/wiki/Protocol_documentation#Block_Headers

By the way...

Have you read the bitcoin whitepaper originally released by Satoshi Nakamoto?  If not, please look through it before you progress any further.  It's quite possible that you are making some false assumptions about how bitcoin is intended to work, and that might be why you are experiencing confusion.

Are you aware that the purpose of bitcoin "mining" is to supply a proof-of-work that secures the historical blockchain against modification?  Do you understand how it manages to accomplish this?

newbie
Activity: 10
Merit: 0

 Thank you so much DannyHamilton for information . I really aprreciate that .

 But , after every new information I have some more new questions and I feel really confused. I think , the only one way to learn this is doing mining by hand , I mean mining without using any machine. My purpose here is not to earn money I want to know the way it works. Is that possible to do mining by hand ?

legendary
Activity: 3472
Merit: 4801
1-) I think , here , node means the software or person using mining software , is that correct?

Node means the consensus verifying software that defines the peer-to-peer network.  It is not necessary to be mining.  It is possible to be participating in a mining pool without running a full node, and it is possible to run a full node without mining at all.

If so , does every person take a part in determining the target value and how?

Yes, each node independently computes the same target value using the same algorithm as all other nodes.  Therefore, each node should compute the same target.

And where can I download latest most secure node software?

https://github.com/bitcoin/bitcoin/tree/master/src

2-) What is merkle root?

It is the SHA256 hash at the root position of a Merkle tree of transaction hashes.  See here:
https://en.wikipedia.org/wiki/Merkle_tree

3-) There are some hash calculators on internet , do they work correctly?

Some probably do.  Some probably don't.

For example , do you recommend this one http://www.xorbin.com/tools/sha256-hash-calculator? Or which one do you prefer and recommend for me?

I don't use or recommend any.  You'll have to do your own analysis and determine which one you prefer.

4-)The target value is also a word having 64 hexadecimal characters just like the hashes we are finding , correct?

It's a numerical value between 0 and 1.1579209X1077

You are welcome to represent that value in whatever numerical base you like.
  • 256 binary digits
  • 86 octal digits
  • 78 decimal digits
  • 64 hexadecimal digits
  • 44 base 58 digits
  • etc...

5-) I could not see the input data on blockchain list . Maybe I miss something. Can you please explain where I can see that 80 byte block header?

The 80  byte header consists of the following:
  • A 4 byte version number
  • The 32 byte hash of the previous block in the blockchain
  • The 32 byte merkle root of the list of transactions that are being confirmed in this block
  • A 4 byte timestamp
  • A 4 byte representation of the current target
  • The 4 byte nonce

Maybe I misexplained something before , so I want to make it more clear. For example , to SHA 256 hash calculator I wrote as input " hello " and it generated the hash " 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 " , and lets assume this hash is an accepted hash. Here I want to know the word " hello " , because it is the winning input.

The input is the block header of the block being solved.  The miner builds a block header, and then repeatedly tries different nonce values until they find a block header that results in a low enough hash value.  If they've tried ALL possible nonce values and failed to find a "winning" block, then they generate a new block header (changing the timestamp, or the transctions that contribute to the merkle root).

6-) You mentioned about " writing software " to get up to date blockchain data, here by " writing software " do you mean I must code a software , program  myself for this , or using an already existing software?

You may be able to find existing software, I don't know. I've never looked.  Personally, I would just run the Bitcoin Core node and then write a short program using the built in API calls to get the data that I want from the node.
 
7-) And here the input " hello " must be in decimal form or can we use also ascii codes like ♫↨☼?

The input MUST be a valid 80 byte bitcoin block header.  No other input is acceptable.  Any input that is not a valid 80 byte bitcoin block header will be ignored by all peers on the network.
newbie
Activity: 10
Merit: 0
Thank you so much DannyHamilton , for your information. It is really so helpful.

And I have some more questions , I hope you dont mind and I am not bothering you .

1-) I think , here , node means the software or person using mining software , is that correct ? If so , does every person take a part in determining the target value and how ? And where can I download latest most secure node software ?

2-) What is merkle root ?

3-) There are some hash calculators on internet , do they work correctly ? For example , do you recommend this one http://www.xorbin.com/tools/sha256-hash-calculator ?  Or which one do you prefer and recommend for me ?

4-)The target value is also a word having 64 hexadecimal characters just like the hashes we are finding , correct ? And what is the currect target value , I could not calculate the target value from the formula you gave , probably I did not understand something .

5-) I could not see the input data on blockchain list . Maybe I miss something. Can you please explain where I can see that 80 byte block header ? Maybe I misexplained something before , so I want to make it more clear. For example , to SHA 256 hash calculator I wrote as input " hello " and it generated the hash " 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 " , and lets assume this hash is an accepted hash. Here I want to know the word " hello " , because it is the winning input.

6-) You mentioned about " writing software " to get upto date blockchain data , here by " writing software " do you mean I must code a software , program  myself for this , or using an already existing software ?

7-) And here the input " hello " must be in decimal form or can we use also ascii codes like ♫↨☼  ?

Regards. And thank you so much again for your precious information .




legendary
Activity: 3472
Merit: 4801
You would do well not to take advice from anybody that has an advertisement in their signature space on this forum.

The vast majority of those are people that are being paid per post to advertise with those signatures.  Therefore, they'll say just about anything in a discussion thread just to increase their post count (and therefore increase their income).  Generally, they know less about the topic they are discussing than the person asking the questions.

Regarding your original questions:

I am new to Bitcoin. I want to ask some questions that I hope were not asked before. If they were already asked , I am sorry Smiley

They were.  Many times.  It's ok though, I've gotten used to answering the exact same questions hundreds of times. This forum doesn't make it easy to find similar questions that were asked in the past, and most new users find it's easier to just ask the question again instead of putting in the effort and taking the time to search for the previous questions.

1-) In bitcoin mining , actually , we are trying to find a hash that is smaller than a given hash encyrpted by SHA 256 is that correct ?

No.

Mining is trying to find a hash that is smaller than a target value.  The target value is NOT "a given hash encyrpted by SHA 256".  It is a value that is automatically adjusted by all nodes every 2016 blocks to keep the average rate at which new blocks are solved near 10 minutes.

Also, SHA256 does not "encrypt" anything.  It isn't possible to "decrypt" a SHA256 hash.  A hash is a "cryptographic" function, but it is not "encryption".

If so , lets say we are given a hash like this 00da3458efac.... , and we found an input that generates a hash , 0034ea873... , after 00 , the first given hash has " da ", and the hash that we found has " 34 " , in hexadecimal system "34" is smaller than "da" , so our answer is correct ? and we win the block to get 25 BTC or one part of 25 BTC if we are in a pool ?

We are not "given a hash".  There is a target value, and our computed hash must be less than the target value. I've changed your question here:

2-) Where can I see the latest hash that is given and latest answer ( input ) given, and also , where can I see the given hash  that we are expected to find a hash below than?

In bitcoin, there currently are approximately 358142709000000000 hashes calculated every second. Only successful "winning" hashes are given.  Everyone just discards all of their failed hashes. They don't bother wasting time and network bandwidth sharing their failed hashes.

The most recent successful hash is stored in the block header of the most recent block added to the blockchain.  There are a variety of block explorer websites that provide an interface for you to view the the contents of the blockchain.  You could also run your own full node peer on the bitcoin network and get the hash directly out of the block as it is relayed to you.

As an example, you will see at the following link that (as of the time that I am writing this post) the most recent block is block number 363792, and the winning hash value is 0000000000000000112932f093a4ac4c98fb5c9c0052011ad057ceece06fbf81
http://btc.blockr.io/block/info/363792

Each block stores a packed representation (called "Bits") for its actual hexadecimal target. The target can be derived from it via a predefined formula. For example, if the packed target in the block is 0x1b0404cb, the hexadecimal target is:
Code:
0x0404cb * 2**(8*(0x1b - 3)) = 0x00000000000404CB000000000000000000000000000000000000000000000000

At that btc.blockr.io link I provided, you will see there is data that is named "Difficulty".  This is a representation of the "Bits" data.  The current difficulty is 49,402,014,931.227.  The target value for the hash can be computed from this difficulty number.

1-) https://blockchain.info/tr/q/latesthash   , here I can see only the latest hash but it is not clearified whether it is latest accepted hash or latest given hash below which we are expected to find a hash than.

That is intended by blockchain.info to be the most recent successful hash from the most recently broadcast block.

2-) And , I could not find the list of latest answers , by answers I mean the input data that generates a hash code that is in accordance with rules.

The successful hashes are the SHA256 hashes of the block headers of the blocks that were successfully hashed and added to the blockchain. The input data is the 80 byte block header itself.

And the hash code given in this link , https://blockchain.info/tr/q/latesthash , is that upto date always ?

No.  blockchain.info has bugs in their software and their block explorer is occasionally out of synchronization with the bitcoin network.  Frequently their data is incorrect.  The most reliable place to get accurate data about the current state of the bitcoin blockchain is by running your own full node peer with the most recent software update, and writing software to extract the blockchain data directly from the blockchain on your node.
legendary
Activity: 2254
Merit: 1140
The answer to your first question, essentially yes.  Read this, there is an explanation here: http://bitcoin.stackexchange.com/questions/8806/what-is-difficulty-and-how-it-relates-to-target

And the answer to your second question, go to http://blockchain.info and where it says "latest blocks" you can click on each block and see the accepted hash. 

Thank you for your answer.

1-) https://blockchain.info/tr/q/latesthash   , here I can see only the latest hash but it is not clearified whether it is latest accepted hash or latest given hash below which we are expected to find a hash than .

2-) And , I could not find the list of latest answers , by answers I mean the input data that generates a hash code that is in accordance with rules.

If I go to http://blockchain.info , I see only latest transaction lists and other things that I am not looking for , site is in Turkish because I connect from Turkey and I could not see some titles. So if you give me the full link I will be happy.

And the hash code given in this link , https://blockchain.info/tr/q/latesthash , is that upto date always ?

Thanks .. Smiley



https://blockchain.info/blocks

You can click on the block number(height) and it will have the accepted hash for that particular block. That is a list of blocks from the main chain, so that will be the lastest acceped answer for the found block(below the target). It would be impossible for them to have a list of submitted hashes above the target as it would be very long.  The target stays the same for approximately 14 days until the difficulty change(retarget).  The current difficulty will be there in decimal form as well.  You can also see current difficulty as well as a prediction of the next change here:  https://bitcoinwisdom.com/bitcoin/difficulty

I'm not sure if I answered all of your questions.  Feel free to ask
newbie
Activity: 10
Merit: 0
The answer to your first question, essentially yes.  Read this, there is an explanation here: http://bitcoin.stackexchange.com/questions/8806/what-is-difficulty-and-how-it-relates-to-target

And the answer to your second question, go to http://blockchain.info and where it says "latest blocks" you can click on each block and see the accepted hash. 

Thank you for your answer.

1-) https://blockchain.info/tr/q/latesthash   , here I can see only the latest hash but it is not clearified whether it is latest accepted hash or latest given hash below which we are expected to find a hash than .

2-) And , I could not find the list of latest answers , by answers I mean the input data that generates a hash code that is in accordance with rules.

If I go to http://blockchain.info , I see only latest transaction lists and other things that I am not looking for , site is in Turkish because I connect from Turkey and I could not see some titles. So if you give me the full link I will be happy.

And the hash code given in this link , https://blockchain.info/tr/q/latesthash , is that upto date always ?

Thanks .. Smiley

legendary
Activity: 2254
Merit: 1140
The answer to your first question, essentially yes.  Read this, there is an explanation here: http://bitcoin.stackexchange.com/questions/8806/what-is-difficulty-and-how-it-relates-to-target

And the answer to your second question, go to http://blockchain.info and where it says "latest blocks" you can click on each block and see the accepted hash. 
newbie
Activity: 10
Merit: 0
Hello.

I am new to Bitcoin. I want to ask some questions that I hope were not asked before. If they were already asked , I am sorry Smiley

1-) In bitcoin mining , actually , we are trying to find a hash that is smaller than a given hash encyrpted by SHA 256 is that correct ?

If so , lets say we are given a hash like this 00da3458efac.... , and we found an input that generates a hash , 0034ea873... , after 00 , the first given hash has " da ", and the hash that we found has " 34 " , in hexadecimal system "34" is smaller than "da" , so our answer is correct ? and we win the block to get 25 BTC or one part of 25 BTC if we are in a pool ?

2-) Where can I see the latest hash that is given and latest answer ( input ) given , and also , where can I see the given hash  that we are expected to find a hash below than  ?

I am interested in mathematical part of bitcoin , I am asking these questions not to earn money just to get some information about math part of Bitcoin. So, if you give me some other information too that may be helpful for me , I will appreciate .

Regards.


Jump to: