1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-25 09:28:25 +00:00

Update key-to-address-ecc-example.py

If line#24 use 'wif_compressed', it will produce a wrong Key (WIF-Compressed) started with 2.

So there should be 'wif', unless :
wif_compressed_private_key = bitcoin.encode_privkey(
    bitcoin.decode_privkey(private_key, 'hex'), 'wif_compressed')
This is also right. 
However, use the 'compressed_private_key' and 'wif_compressed' is wrong.
This commit is contained in:
Fan 2019-12-04 11:39:59 +08:00 committed by GitHub
parent 84e0899d0e
commit c6fa743597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ print("Private Key Compressed (hex) is: ", compressed_private_key)
# Generate a WIF format from the compressed private key (WIF-compressed)
wif_compressed_private_key = bitcoin.encode_privkey(
bitcoin.decode_privkey(compressed_private_key, 'hex'), 'wif_compressed')
bitcoin.decode_privkey(compressed_private_key, 'hex'), 'wif')
print("Private Key (WIF-Compressed) is: ", wif_compressed_private_key)
# Multiply the EC generator point G with the private key to get a public key point