Guest User

Untitled

a guest
Aug 20th, 2019
180
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from bitcoin_tools.core.keys import generate_keys, store_keys
  2. from bitcoin_tools.wallet import generate_wif, generate_btc_addr
  3.  
  4. # First of all the ECDSA keys are generated.
  5. sk, pk = generate_keys()
  6. # Then, the Bitcoin address is derived from the public key created above.
  7. btc_addr = generate_btc_addr(pk)
  8. # Both the public and private key are stored in disk in pem format. The Bitcoin address is used as an identifier in the
  9. # name of the folder that contains both keys.
  10. store_keys(sk.to_pem(), pk.to_pem(), btc_addr)
  11. # Finally, the private key is encoded as WIF and also stored in disk, ready to be imported in a wallet.
  12. generate_wif(btc_addr, sk)
RAW Paste Data