Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
BurtW
on 04/01/2016, 12:22:38 UTC
This is a basic description of the algorithm which should yield the fastest results:


Code:
Initialization:

Set BitcoinAddresses[256] = the list of bitcoin addresses from the transaction, binary form without the checksum
Set BitcoinAddressIndex = 0;
Set PrivateKey = 1;
Set PublicKey = G;

Loop Until BitcoinAddressIndex == 256: // == "forever"

Call Convert PublicKey to BitcoinAddress [but just to the binary form, do not calculate the checksum or encode to ASCII]

If BitcoinAddress == BitcoinAddresses[BitcoinAddressIndex] Then

    Log BitcoinAddressIndex, PrivateKey, PublicKey, BitcoinAddress

    Create transaction and claim Bitcoins if any available at BitcoinAddress

Endif

++PrivateKey;

Call Increment PublicKey by G // Highly optimized, very specialized function to just compute PublicKey = PublicKey + G

EndLoop

Note on the PublicKey to BitcoinAddress conversion function:

You only need to do the first 3 of the 9 steps in this process.

1 - Take the PublicKey and format it properly (add the 1 byte of 0x04, change to compressed form if needed)
2 - Perform SHA-256 hashing on the result
3 - Perform RIPEMD-160 hashing on the result of SHA-256

This result can be compared directly to the BitcoinAddresses[] array assuming you have stored the 256 Bitcoin addresses in the proper binary form.

To get the proper values for this array simply undo the last 6 steps of the PublicKey to BitcoinAddress function for each of the 256 Bitcoin addresses in the transaction:

1 - Decode the base58 string to a binary byte array
2 - Strip off the 4 checksum bytes from the tail
3 - Strip off the version byte (0x00) from the front
4 - Store the result in the array

Which step above is using the slow EC_POINT_point2oct function?