Friday, March 11, 2016

The simple but secure way of private keys generation for bitcoin.

There are two most problems with generating bitcoin private keys: true randomness and data security. The better randomness can be taken from some nature process. For simplicity here I will just use a coin to generate the binary input. The data security can be improved by using the so called "offline computer". For my case I am using the Raspberry Pi with Raspbian, electrium wallet and pybitcointools library installed. After the initial installation the computer is "plugged off" from internet forever.

The script below reacts only on two keys "0" and "1" in the key generation mode. So I am flipping the coin and input "0" or "1" depends from result. After key is generated the script asks the key name and saves private key to one file and public key and address to another file. Public file should be copied to usb stick and can be used in watching wallet, while private key is never leaving the "offline computer" and is used to sign the transactions. Please refer to electrium wallet docs for details.


  • added key range check
  • saving files in named by key folder
  • prevent overwriting key files


  1. Hey,

    Hope you are doing well. I am planning to start a new blog and I have come up with some names for my blog, out of which "webzak" is
    one of them.

    I would like to know if you are interested in selling this domain(, if yes, please reply back to this email.
    I am willing to purchase this domain from you.

    Looking forward for your reply

    Thanks and Regards,
    Rekhilesh Adiyeri

  2. This comment has been removed by a blog administrator.