Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Sergio_Demian_Lerner on May 31, 2012, 05:53:03 PM



Title: Possible use for the double hash in blocks
Post by: Sergio_Demian_Lerner on May 31, 2012, 05:53:03 PM
It has been said that double hashing in the PoW of the blocks serves to prevent hash extension attacks. This has been refuted: that attack does not make any harm because the hash preimage is public.

Today I realize that there is another reason why double hashing can be useful.

Double hashing can be used to prove that one have a block with certain PoW, before sending the whole header to a peer.

Suppose that H=Hash(W) and W=Hash(Block-header).

We want that blocks travel as fast as they can through the network to reduce the chances of the creation of parallel chains.
The Bitcoin block header size is generally 81 bytes, so each peer must receive at least 81 bytes in order decide if the block will be accepted, and forward it.
But if a node firsts sends only W, then the peer can compute H'=Hash(W) and conclude immediately that a lot of work has been put in order to build W. So the peer can immediately stop what is doing (downloading/uploading transactions) and set maximum priority to receive the block whose header hashes to W and resend it to its peers.

I know that it's not much that is gained (32 bytes instead of 81), but at least that is an use for the double hash.
 
Best regards,
S


Title: Re: Possible use for the double hash in blocks
Post by: dinox on June 02, 2012, 10:22:07 PM
I would say it's latency, and not the size of the block header, that matters.