I was not sure how to formulate the question title. What I want to achieve is the same as VanityGen and many other tools do to create an address starting with a predefined part, but with private keys.

So basically I want to create a Bitcoin public/private key pair of which the private key begins with a string I define.

Are there tools that already do this? If not, is it possible? How should it be done theoretically?

  • Maybe think about brain wallet (just a few words to remember/save or combine). Whenever you will need to spend coins you will just go to bitaddress.org and generate private key.
    – user4973
    Commented May 11, 2013 at 22:11

2 Answers 2


You can choose the private key to be whatever you want, and calculate the corresponding public key and bitcoin address.

Adding to this answer, there is really no reason to want to do this. But if one really insisted, here is a way to do it with hal. First start with generating a random private key

$ hal key generate
  "raw_private_key": "7019c07716861030e9334b88c24ee595b6fd922514a13de812e36cf6f910a898",
  "wif_private_key": "KzycuDEqJaMyjHWJDD9cdyPeH1rtCTgE5m1EHfCdnTs4ng2D43Bt",
  "public_key": "02260106e42d7aef51b92c6c4aa2d0a5a6f3e0c6ad68ee9fadd8bd50d8cbe1a0b4",
  "uncompressed_public_key": "04260106e42d7aef51b92c6c4aa2d0a5a6f3e0c6ad68ee9fadd8bd50d8cbe1a0b4349d9106ee1724cf51c954e6aec9522febd7fcb46d7248a0ce390810fc0ac6a0",
  "addresses": {
    "p2pkh": "1J6wqBd7QVGt7vGCNfUShoDEwQg2LFTgRR",
    "p2wpkh": "bc1qhwvl6yyrtheep7rmsxmf536m45dzfz4wrxdacu",
    "p2shwpkh": "3QLdovvKokkyiyX3jTzgfaMCv9MiaoVW5C"

Then change the beginning of the raw private key to deadbeef or whatever you want


Then get the address for it

$ hal key inspect deadbeef16861030e9334b88c24ee595b6fd922514a13de812e36cf6f910a898
  "raw_private_key": "deadbeef16861030e9334b88c24ee595b6fd922514a13de812e36cf6f910a898",
  "public_key": "02de9367c92d7a42953e1afdf74d509d3992ba78bfb93f448859a1557e2685ca60",
  "uncompressed_public_key": "04de9367c92d7a42953e1afdf74d509d3992ba78bfb93f448859a1557e2685ca60b142aa0a4f495e16f80f811ec4556e3d33be28c930fab6e6a051e9a5bdc91d52",
  "addresses": {
    "p2pkh": "1BhftRM4fNZRYdDYMUdujq9C84bRX84Qf8",
    "p2wpkh": "bc1qw439kmezxvdff0hnalmeqvfsnttd9gkjux5rct",
    "p2shwpkh": "34KVR36eoQrf48bmjQ46JU5dGVg1gqdUFg"
  • However, the more predictable the private key is, the weaker your security is. You don't want your private key to be "password" or expect your wallet to be empty. Commented Mar 20, 2013 at 11:35
  • No I just want to know a specific part of it so that I can write the rest down and add additional security to remember a part myself. Commented Mar 20, 2013 at 12:04
  • @AlgolCobol, How can I create such a priv/pub key pair? Commented Mar 20, 2013 at 12:05
  • Still the question is only answered partially. "Are there tools that already do this? How should it be done theoretically?" Commented May 12, 2013 at 14:35
  • @StevenRoose: At this point, you wrote the complete answer. Might have been better to post it as your own and accept that then. ;)
    – Murch
    Commented Mar 12, 2021 at 17:19

The most common way is to create the public address, compressed or uncompressed from a hex value, through the elliptic curve, hashing and so on.

Please check this awesome web to see the whole process and with different options to start: link

And if you like to check python code to see the whole process: here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.