Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
NotATether
on 16/04/2023, 16:24:09 UTC
Just converting a public key to an address will not help here, as there are already specialized programs in C++ and other faster, multithreaded languages, that can do that.

You don't need to computer base58 or bech32 in order to compare the addresses. Comparing the address hashes directly also works and saves an extra (expensive) computation, such that most of the work is pooled into making an efficient SHA256 algorithm OR optimizing the process of making private keys from public keys.

Probably time for me to stop by Cornell university's internet archive for some more finite field research papers.

uncomprewssed key for 66 1Pir2jKv35rpYgUh8dUxNL6JTTm6d7HX6U

Therefore, the uncompressed public key for the P2PKH address "1Pir2jKv35rpYgUh8dUxNL6JTTm6d7HX6U" is:  04ce42244bfa7731d7088ee2f20a72b0dd834a723d2b8f563bc58cfa5d5dc4911a2f8aae5c5b

could be wrong could be wright do what you want with the info im just tossing ideas.



does this look like itd do anything am i in the right path?

Code:
import hashlib
import base58

# uncompressed public key
public_key = "04ce42244bfa7731d7088ee2f20a72b0dd834a723d2b8f563bc58cfa5d5dc4911a2f8aae5c5b"

# step 1: compute SHA-256 hash of public key
sha256 = hashlib.sha256(bytes.fromhex(public_key)).digest()

# step 2: compute RIPEMD-160 hash of SHA-256 result
ripemd160 = hashlib.new("ripemd160")
ripemd160.update(sha256)
hash160 = ripemd160.digest()

# step 3: add version byte (0x00 for MainNet or 0x6f for TestNet) to hash160
version = "00"
hash160_version = version + hash160.hex()

# step 4: compute double-SHA-256 checksum of hash160_version
checksum = hashlib.sha256(hashlib.sha256(bytes.fromhex(hash160_version)).digest()).digest()

# step 5: append the first 4 bytes of the checksum to hash160_version
btc_address_hex = hash160_version + checksum.hex()[:8]

# step 6: encode the result using Base58Check encoding
btc_address = base58.b58encode(bytes.fromhex(btc_address_hex)).decode()

print("BTC public address: ", btc_address)