What is the variable in a block that holds hash of found PoW?

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.

Nur

Posted 2014-04-13T20:59:34.717

Reputation: 331

Answers

5

It is not stored. The proof of work is in the fact that the hash of your generated block should be of a certain form. It does not make sense to store it either, because you cannot trust it to be the real hash of the block and thus should be calculated anyway.

Jori

Posted 2014-04-13T20:59:34.717

Reputation: 1 522

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.490

I 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

2

It is not stored as part of the block data itself. Other clients reply with their list of hashes ahead of yours when you broadcast getblocks. From that list, each block header is downloaded and kept in the local block chain leveldb with the hash as a key.

From Bitcoin Wiki:

Initial block download

At the start of a connection, you send a getblocks message containing the hash of the latest block you know about. If the peer doesn't think that this is the latest block, it will send an inv that contains up to 500 blocks ahead of the one you listed. You will then request all of these blocks with getdata, and the peer will send them to you with block messages. After you have downloaded and processed all of these blocks, you will send another getblocks, etc., until you have all of the blocks.

chizu

Posted 2014-04-13T20:59:34.717

Reputation: 31