Spotlight on: mini private keys

Tuesday 26 January 2016

You’ve heard of private keys, but do you know about mini private keys?

If you use bitcoin, you’ll know what a private key is: that long string of numbers and letters that gives anyone who has it access to the coins in that address. Private keys are essentially just a lot of random characters (that satisfy certain requirements). The string is long enough and complex enough that no computer in the world could ever guess them, even if it had billions of years to try. That complexity, or entropy, is the reason bitcoin is so secure. If you keep your private key safe, there is literally no way in the universe that your bitcoins can be stolen.

Whilst a typical private key is a 256-bit number - 64 characters of hex or 51 characters of the standard Base 58 Wallet Import Format (WIF) - a mini private key is just 30 characters. Despite being shorter, it’s still more than secure enough to protect your coins, partly because there’s a point at which a longer private key makes no difference to the security of the address to which it maps. A mini key also has a standard form of the regular length. It’s even possible to create shorter mini private keys. The first Casascius physical coins held a 22-character key.

Hex: E9 87 3D 79 C6 D8 7D C0 FB 6A 57 78 63 33 89 F4 45 32 13 30 3D A6 1F 20 BD 67 FC 23 3A A3 32 62
WIF: 5Kb8kLf9zgWQnogidDA76MzPL6TsZZY36hWXMssSzNydYXYB9KF
And (22-char) mini: SzavMBLoXU6kDrqtUVmffv

All these keys control the same address: 1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj

Keys

Choosing a good private key, a complex string of random characters, is vital to the security of your wallet

The advantages of mini keys is that they are shorter and more suited to applications where that matters. For example, they were used in the Casascius physical coins, where space was at a premium. I’ve also generated mini private keys and stamped them onto blocks of Aluminium for long-term cold storage. If you have the inclination for it, they’re also far easier to memorise - a true brainwallet.

It’s pretty easy to generate mini keys yourself, using a piece of Python code. Warning: the code in the link below uses the random library, which is not remotely random enough for bitcoin. As recommended elsewhere I've used os.urandom, and there are plenty of other sources of randomness, but (disclaimer) you use this advice at your own risk.

Take a look at https://en.bitcoin.it/wiki/Mini_private_key_format for more information.


comments powered by Disqus