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?

-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.

@HristoHristov Out of curiosity: did you use this? If yes, how fast did it go? Was it with ~ 200kKeys/seconds?
– Mathias711Jul 14 '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 HristovJul 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 :)
– Mathias711Jul 14 '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 '14 at 17:54

Here is a discussion about payperwal.py — a single python file with no external module dependencies, and which seems to have been thoroughly tested and verified to produce proper randomity even on machines with broken random number generators.

You can use bitcoinj — a thoroughly tested Java library written by a google employee as a 20% project. It is used by some wallet apps, such as samurai wallet, bitcoin wallet, greenbits (mycelium plans to migrate to bitcoinj).