1

Im trying to reproduce the following:

========================================= from Bitcoin Wiki

Transaction puzzle

Transaction '...' is an interesting puzzle.

given hash = 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000

To spend the transaction you need to come up with some data such that hashing the data twice results in the given hash. The required data happened to be the Genesis block, and the given hash was the genesis block hash

==========================================

genesis = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'

The following function doublehashes input(it works for step 14 in this example)

def function(input):
    data = input.decode('hex_codec')
    result = binascii.hexlify(hashlib.sha256(hashlib.sha256(data).digest()).digest())
    print result

But inputting the genesis hash, it produces the following result:

string: "ae253ca2a54debcac7ecf414f6734f48c56421a08bb59182ff9f39a6fffdb588"

hex: "61 65 32 35 33 63 61 32 61 35 34 64 65 62 63 61 63 37 65 63 66 34 31 34 66 36 37 33 34 66 34 38 63 35 36 34 32 31 61 30 38 62 62 35 39 31 38 32 66 66 39 66 33 39 61 36 66 66 66 64 62 35 38 38 0d 0a"

I'm obviously doing something wrong but can't seem to figure out what.


ANSWER: As mentioned by Falsaltru;

The required hash was used earlier to calculate the blockhash, thus why the hash itself was 'not hard to find'.

1
  • Pardon me, OP is fixed now. This didn't cause the isseu however, problem remains. Commented Dec 25, 2014 at 2:10

1 Answer 1

1

You can get the given hash by reversing the genesis (bytes):

>>> import binascii                                                                             
>>> genesis = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'
>>> given_hash = '6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000'
>>> binascii.unhexlify(given_hash) == binascii.unhexlify(genesis)[::-1]
True
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.