Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: tacotime on December 30, 2012, 07:22:40 PM



Title: Hash tree and hash algorithms: can a hash tree use multiple hash algorithms?
Post by: tacotime on December 30, 2012, 07:22:40 PM
Hi,

I'm working on a bitcoin fork right now and I'm trying to figure out something related to data structures.

I want to develop a blockchain (hash tree) whose algorithm for hashing subsequent blocks is determined as a function of the nonce of the 0th, 0th + c, 0th + 2c, ... , etc block (leaf) where c is a constant.  I assume that the nonce values are pseudorandom and non-predictable, but I don't know if that's actually true.

Which leads to the question: Can I compose a hash tree like this?  What kind of problems do you think I'll run into, and are they impossible to overcome?  I want to see if anyone knows the answer to this before I begin trying.

I don't know if this kind of hash tree has a name or not either, or if it's been implemented before.  I guess it might be called a polymorphic hash tree.


Title: Re: Hash tree and hash algorithms: can a hash tree use multiple hash algorithms?
Post by: jl2012 on December 30, 2012, 07:35:13 PM
I think PPC has multiple algorithms: PoW and PoS


Title: Re: Hash tree and hash algorithms: can a hash tree use multiple hash algorithms?
Post by: dree12 on December 30, 2012, 07:45:36 PM
Hi,

I'm working on a bitcoin fork right now and I'm trying to figure out something related to data structures.

I want to develop a blockchain (hash tree) whose algorithm for hashing subsequent blocks is determined as a function of the nonce of the 0th, 0th + c, 0th + 2c, ... , etc block (leaf) where c is a constant.  I assume that the nonce values are pseudorandom and non-predictable, but I don't know if that's actually true.

Which leads to the question: Can I compose a hash tree like this?  What kind of problems do you think I'll run into, and are they impossible to overcome?  I want to see if anyone knows the answer to this before I begin trying.

I don't know if this kind of hash tree has a name or not either, or if it's been implemented before.  I guess it might be called a polymorphic hash tree.
Nonce values may not necessarily be secure. Because the miner can selectively choose nonces without a significant impact on hash rate, intelligent miners will choose the most self-beneficial nonce values.

For example, I can write code to increase the nonce by 5 rather than simply incrementing it, to ensure that the nonce is divisible by 5. Nonce values are only non-predictable if there is no financial incentive to make them predictable.


Title: Re: Hash tree and hash algorithms: can a hash tree use multiple hash algorithms?
Post by: DeathAndTaxes on December 30, 2012, 08:16:10 PM
As dree12 pointed out you don't want to use nonces.  Super easy to game.  Would just require a miner program which skips certain undesirable nonces.

You could simply use the block hashes which if blocks are "difficult" to construct should be relatively psuedo-random.  It would be possible to game the output but that would require throwing away undesirable blocks.  Unlike nonces they have real value.

So you have a couple options.  The simplest would be to just use the x least significant digits of the various block hashes in the algorithm which determines the algorithm for the next block.


Title: Re: Hash tree and hash algorithms: can a hash tree use multiple hash algorithms?
Post by: tacotime on December 31, 2012, 06:08:05 AM
Right, I guess I can just use the block hashes themselves then.  Reading up on it, it doesn't seem like multiple hash algorithms should be a problem, although I don't think it's been implemented before (PPC uses only SHA256 as a hash function; the proof of stake blocks are just very low difficulty apparently).