3

to create the block chain, the Bitcoin network runs hashing algorithms for each block, is it mathematically possible to predict the hash value of say, the 100th block from the last block currently in the chain?

2 Answers 2

4

Bitcoin uses two rounds of SHA256 on the entire contents of each block (which includes a reference to the previous block) as well as a randomly varied nonce. When the result of those calculations are below a network-determined threshold it is considered to be a valid solution. These solutions are published along with the block as it is distributed to the network so finding the hash of old blocks is trivially easy, you just look them up. Verifying that the math was done correctly and that the result meets the criteria requires only a single iteration of sha256(sha256(block+nonce)) while finding the appropriate nonce the first time takes an absolutely insane number of attempts.

The insane number of attempts is necessarily because the output of sha256 is, effectively, pseudorandom and covers a huge space. The algorithm is deterministic, so sha256(x) will always have the same result, but the result is entirely unpredictable and minor changes in the value of x will dramatically alter the results.

The only way to predict the output of a cryptographically secure hash algorithm like sha256 is a pre-image attack: You would have to pre-generate the contents of all possible blocks, hash them and store the results. At that point solving a block would be as trivial as a database lookup, assuming you could store all 2^256 possible outcomes, which you can't, and that you could generate all 2^256 possible outcomes before the heat death of the universe, which you can't.

1

No, not at all. The hash of every block depends on the previous block. And it also depends on all the transactions included in the block. That's the whole point :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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