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.
2
You might want to consider deterministic wallets instead of generating list of keys. https://en.bitcoin.it/wiki/Deterministic_wallet - this way you could avoid maintaining the list of keys
– Mikko Ohtamaa – 2014-07-14T11:08:48.787Thanks 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 – 2014-07-14T14:47:29.497
Well you can always use the user id as the deterministic seed :) – Mikko Ohtamaa – 2014-07-14T18:27:06.993
That would be easily determined ;) – Hristo Hristov – 2014-07-14T19:35:13.803