Take the 2-minute tour ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

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 https://www.bitaddress.org , 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
2  
You might want to consider deterministic wallets instead of generating list of keys. en.bitcoin.it/wiki/Deterministic_wallet - this way you could avoid maintaining the list of keys –  Mikko Ohtamaa Jul 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 at 14:47
    
Well you can always use the user id as the deterministic seed :) –  Mikko Ohtamaa Jul 14 at 18:27
    
That would be easily determined ;) –  Hristo Hristov Jul 14 at 19:35

1 Answer 1

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 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 at 14:18
1  
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 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 at 14:52
1  
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 at 17:54

Your Answer

 
discard

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.