Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to generate, say 100000 key pairs (address/private key). It should be done offline, without using websites/javascript , with a program on the command line. Of course, the software should use the best way to generate randomness. There is such function on , but it's javascript and is not easy to be used by scripts on the command line. Do you know of such software?

share|improve this question
You might want to consider deterministic wallets instead of generating list of keys. - this way you could avoid maintaining the list of keys – Mikko Ohtamaa Jul 14 '14 at 11:08
Thanks for the suggestion, but in this case I actually need the list in order to match addresses to users and spend the amounts. – Hristo Hristov Jul 14 '14 at 14:47
Well you can always use the user id as the deterministic seed :) – Mikko Ohtamaa Jul 14 '14 at 18:27
That would be easily determined ;) – Hristo Hristov Jul 14 '14 at 19:35

A very simple way is to use Vanitygen with the following command:

vanitygen -k -o output.txt -s seeds.txt 1
  • -k keeps it going after it finds a hit
  • -o output.txt will write the key pairs to the file output.txt
  • -s seeds.txt will let you have different seeds. Create this on beforehand
  • 1 is the pattern Vanitygen will look for. Because all addresses start with 1, every hit will be good. Also nice if you want to have nice addresses, like 1Hristo or something. Keep in mind that it will reduce speed ALOT.

Vanitygen creates about 300 kKey/second on my 2010 MBP CPU. With oclvanitygen it is around 750 kKeys/second. The output.txt will reduce the speed a bit, but it will not take a lifetime. I am not on a computer right now on which I can test the command, but it should work.

This will generate key pairs until infinity. If you really want to have exactly 1000000 (or any other number) pairs, try something with a bash for-loop, and something like

vanitygen 1 >> output.txt

Again, I cannot check this right now, so I don't know how the pairs will be in the output.txt, but it should be appended and readable for you.

share|improve this answer
Great idea, thanks! – Hristo Hristov Jul 14 '14 at 11:30
@HristoHristov Out of curiosity: did you use this? If yes, how fast did it go? Was it with ~ 200kKeys/seconds? – Mathias711 Jul 14 '14 at 14:18
It's 1.99 Mkey/s for hard prefixes, but in the case with "1" and writing to output.txt, I'm getting 1K keys per second, which is good enough. It's slower of course, because I guess it's faster to discard an invalid key early, instead of completing the calculations for each key. Anyway, it's fast enough for this case. – Hristo Hristov Jul 14 '14 at 14:43
That's a slowing factor I didn't expect. For what I understood from vanitygen is that it creates a key, computes the address and checks it. If good, print the key pair and create new pair (with -k option). If false, create new key. That printing doesnt cost that much resources I imagined. But thanks for the numbers :) – Mathias711 Jul 14 '14 at 14:52
That slowdown is not at all surprising to me: printing and writing to a file is expensive business, especially if the app was only expecting to rarely print values. If it were useful, a version of vanitygen (addressgen?) could be created optimized for this use case. But since it's good enough as-is... – Tim S. Jul 14 '14 at 17:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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