4
Can anyone please tell me, which variable holds the hash of the solution of block's PoW in broadcasted block? I know that a block consists of (I am pretty sure I am forgetting some variables here):
- Magic no
- Block size
- Transactions (raw)
- Transactions counter
- Block header
- version
- hash of previous block
- timestamp
- bits
- nnonce
- hash(MerkleRoot)
So basically, my question is which variable holds the hash of solution of current block's PoW? Thanks in advance.
Then based on what information network can verify if I solved the PoW or not? – Nur – 2014-04-13T21:10:43.307
The hash should be lower than or equal to a predefined number (i.e. the target). – Jori – 2014-04-13T21:12:12.947
I know that, but this means that I need to send this hash, the hash of PoW. But which variable holds such a hash? – Nur – 2014-04-13T21:13:03.817
No. The hash is implied in the block broadcasted to the network. – Jori – 2014-04-13T21:13:36.223
So where is this hash? As you said yourself it is implemented. So I want to know what variable holds this hash? – Nur – 2014-04-13T21:14:35.357
I said
implied. I'm sorry, but I don't believe I understand you correctly. Could you clarify, please? – Jori – 2014-04-13T21:19:25.490I am sorry I misunderstood you. I mean that as far as I know in order to create a block I need to find a valid hash, which should be less than a target. In case if I found such a hash, it means that I solved a block. But as I understand, now I need to broadcast the whole network that I found such a hash and they should verify it. This means that I need to send them some DATA that will allow all nodes to verify my hash. So what is this DATA, that I am sending them, so they can verify my hash? – Nur – 2014-04-13T21:25:36.110
1The block. You can change the nonce and timestamp to change the hash until it is below or equal to the target. – Jori – 2014-04-13T21:27:02.960
I do not get it, so how will they check whether I found a valid hash? – Nur – 2014-04-13T21:30:04.077
Do you mean that I need to send a Nonce which let me generate such a hash, so other nodes can try this Nonce and verify that it gives a valid hash? – Nur – 2014-04-13T21:32:19.590
3They receive the block you created and hash it. If the hash is below the or equal to the target they accept it, else they reject it. Your above comment is correct, but notice that the nonce is part of the block, it isn't send separately. – Jori – 2014-04-13T21:36:03.903
I ve never heard that nodes hash the entire block to check whether I solved it correctly or not. Can you please provide me with the resource for your statement?
I know that entire blocks are hashed to be added for the next block. – Nur – 2014-04-13T21:39:01.003
3@Nur: Other nodes must hash your new block to check your solution. Otherwise, you could supply any random number as the hash (that meets the required difficulty) and say "see? I solved it!". Other nodes have to hash your block to make sure you are not lying. – Greg Hewgill – 2014-04-13T22:41:27.037