Post
Topic
Board Games and rounds
Re: Ok, here's a 1BTC puzzle.
by
ligor
on 27/06/2019, 19:03:43 UTC
Thanks again,
I removed is, but still no succes

Traceback (most recent call last):
  File "C:\Mijn Documenten\P\Mydocs\JScript\Bitcoin Priv KY\Python\GPuzzelky.py", line 12, in
    private_key_static = binascii.hexlify("InsertPlainTextPhraseHere32Chara")
TypeError: a bytes-like object is required, not 'str'

Sorry    Roll Eyes
 

seems you use Python 3. You can try it :

Quote
import binascii, hashlib, base58
from bitcointools import *

def priv2addr(priv):
    pub = privtopub(priv)
    addr = pubtoaddr(pub)
    return (addr)

# Step 1: here we have the private key
#private_key_static = "0000000000000000000000000000000000000000000000000000000000000002"
private_key_static = binascii.hexlify("InsertPlainTextPhraseHere32Chara".encode())
print (private_key_static.decode())
#private_key_static = ("Because it was an educated guess")


# Step 2: let's add 80 in front of it

extended_key = b"80"+private_key_static.strip()
# Step 3: first SHA-256
first_sha256 = hashlib.sha256(binascii.unhexlify(extended_key)).hexdigest()
# Step 4: second SHA-256
second_sha256 = hashlib.sha256(binascii.unhexlify(first_sha256)).hexdigest()
# Step 5-6: add checksum to end of extended key
final_key = extended_key+second_sha256[:8].encode()
print (final_key.decode())
# Step 7: finally the Wallet Import Format is the base 58 encode of final_key
WIF = base58.b58encode(binascii.unhexlify(final_key)).decode()
print (WIF)
print (priv2addr(WIF))