Bitcoin Forum
November 10, 2024, 07:03:10 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Create addresses in bulk, fast.  (Read 1305 times)
flatfly (OP)
Legendary
*
Offline Offline

Activity: 1092
Merit: 1016

760930


View Profile
December 09, 2013, 07:45:18 PM
Last edit: December 09, 2013, 08:14:10 PM by flatfly
 #1

Some users (mostly merchants and exchanges) have expressed the need to generate thousands or millions of addresses at once. I've looked at the options available and was surprised to find they were all quite slow, which is why I have knocked up a new little command: Bulkgen (not released yet.)
Below are some rough figures from my offline machine (a very old, VERY SLOW Win XP netbook.)

I will try to run the same tests on a faster machine soon.


Time required to generate 1000 addresses:
Code:
Bitcoind:	   17 min      (C++)
Electrum lib:      19 min      (Python 2.x)
Bitaddress:   132 sec      (JavaScript)
Vanitygen: 15.3 sec      (C++)
Bulkgen:       7.8 sec      (Python 2.x + OpenSSL 1.0.1e)

EDIT: corrected results for Vanitygen and Bulkgen

Did I forget any other tools?


Bulkgen is an open-source bulk address generator tool, based on OpenSSL and a public domain library. It will be released for Windows only in the beginning. People will be welcome to port it to other platforms (which should be quite trivial).


Notes:
  
1. As far as I can see, bitcoind's getnewaddress does not only generate a new address, but also adds it into the wallet database, which takes extra time of course.
 
2. The command "Vanitygen -k 1" runs much faster than all other options, but I think this comes at a heavy cost: If one private key of the batch is compromised, all others becomes vulnerable, due to the fact that vanitygen only performs a new EC multiplication once every 10 million addresses, which is what allows it to be so fast (Please correct me if I'm wrong).
crazy_rabbit
Legendary
*
Offline Offline

Activity: 1204
Merit: 1002


RUM AND CARROTS: A PIRATE LIFE FOR ME


View Profile
December 09, 2013, 07:50:41 PM
 #2


2. The command "Vanitygen -k 1" runs much faster than all other options, but I think this comes at a heavy cost: If one private key of the batch is compromised, all others becomes vulnerable, due to the fact that vanitygen only performs a new EC multiplication once every 10 million addresses, which is what allows it to be so fast (Please correct me if I'm wrong).


Really? That seems to be quite a serious weakness if true.

more or less retired.
TippingPoint
Legendary
*
Offline Offline

Activity: 905
Merit: 1000



View Profile
December 09, 2013, 08:13:16 PM
 #3

This is probably the source of that statement:

https://bitcointalk.org/index.php?topic=25804.0
Quote
To speed up address generation, vanitygen uses the RNG to choose a private key, and literally increments the private key in a loop searching for a match.  As long as the starting point is not disclosed, if a match is found, the private key will not be any easier to guess than if every private key tested were taken from the RNG.  Vanitygen will also reload the private key from the RNG after 10,000,000 unsuccessful searches (100M for oclvanitygen), or when a match is found and multiple patterns are being searched for.

Quote
Nonetheless, if you feel the default RNG is unable to provide numbers that are sufficiently difficult to guess, vanitygen can be directed to seed the RNG from an external file using the -s option.
flatfly (OP)
Legendary
*
Offline Offline

Activity: 1092
Merit: 1016

760930


View Profile
December 09, 2013, 08:21:47 PM
Last edit: December 09, 2013, 10:48:43 PM by flatfly
 #4

This is probably the source of that statement:

https://bitcointalk.org/index.php?topic=25804.0
Quote
To speed up address generation, vanitygen uses the RNG to choose a private key, and literally increments the private key in a loop searching for a match.  As long as the starting point is not disclosed, if a match is found, the private key will not be any easier to guess than if every private key tested were taken from the RNG.  Vanitygen will also reload the private key from the RNG after 10,000,000 unsuccessful searches (100M for oclvanitygen), or when a match is found and multiple patterns are being searched for.

Quote
Nonetheless, if you feel the default RNG is unable to provide numbers that are sufficiently difficult to guess, vanitygen can be directed to seed the RNG from an external file using the -s option.

Indeed that's where I got the clue from. Unless I'm missing something, this could represent a risk as I stated above. Of course, this risk is only present when using vanitygen as a bulk generator with no external seed, which it is fair to say is not its primary intended use.

Anyway, after double-checking my measurements, it seems that Bulkgen IS surprisingly even faster than Vanitygen (for bulk generation.) Smiley

EDIT: I might be wrong about Vanitygen's vulnerability. From the above quote, it seems that it also resets the starting point whenever a match is found (which is, all the time when run with the '-k 1' arguments).  If anybody with enough experience could confirm this, it would be great.  
RoxxR
Full Member
***
Offline Offline

Activity: 209
Merit: 148


View Profile
December 10, 2013, 02:27:24 PM
 #5

There's something I can't understand, how can a Python script be faster than Vanitygen??
flatfly (OP)
Legendary
*
Offline Offline

Activity: 1092
Merit: 1016

760930


View Profile
December 10, 2013, 09:14:05 PM
 #6

There's something I can't understand, how can a Python script be faster than Vanitygen??

Well for the CPU-intensive stuff (EC math), it uses OpenSSL, which is a compiled and optimized library.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!