Take the 2-minute tour ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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.

share|improve this answer
    
Then based on what information network can verify if I solved the PoW or not? –  Nur Apr 13 at 21:10
    
The hash should be lower than or equal to a predefined number (i.e. the target). –  Jori Apr 13 at 21:12
1  
The block. You can change the nonce and timestamp to change the hash until it is below or equal to the target. –  Jori Apr 13 at 21:27
3  
They 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 Apr 13 at 21:36
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 Apr 13 at 22:41

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.