mirror of
https://github.com/bitcoinbook/bitcoinbook
synced 2024-12-23 15:18:11 +00:00
Merge pull request #126 from Siecje/long_lines
Fixing long lines that are cut off in PDF
This commit is contained in:
commit
a7003ef8b1
@ -5,7 +5,8 @@ valid_private_key = False
|
||||
while not valid_private_key:
|
||||
private_key = bitcoin.random_key()
|
||||
decoded_private_key = bitcoin.decode_privkey(private_key, 'hex')
|
||||
valid_private_key = 0 < decoded_private_key < bitcoin.N
|
||||
valid_private_key = 0 < decoded_private_key < bitcoin.N
|
||||
|
||||
print "Private Key (hex) is: ", private_key
|
||||
print "Private Key (decimal) is: ", decoded_private_key
|
||||
|
||||
@ -18,7 +19,8 @@ compressed_private_key = private_key + '01'
|
||||
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')
|
||||
wif_compressed_private_key = bitcoin.encode_privkey(
|
||||
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
|
||||
@ -42,11 +44,6 @@ print "Compressed Public Key (hex) is:", hex_compressed_public_key
|
||||
print "Bitcoin Address (b58check) is:", bitcoin.pubkey_to_address(public_key)
|
||||
|
||||
# Generate compressed bitcoin address from compressed public key
|
||||
print "Compressed Bitcoin Address (b58check) is:", bitcoin.pubkey_to_address(hex_compressed_public_key)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print "Compressed Bitcoin Address (b58check) is:", \
|
||||
bitcoin.pubkey_to_address(hex_compressed_public_key)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user