Bitcoin Forum
November 03, 2024, 11:02:36 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Generating thousands of addresses  (Read 5439 times)
btcsf (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 19, 2012, 12:43:26 PM
 #1

Hello

I'm in the process of coding a webshop app, and would like to accept bitcoins.

What I want to do is this:

  • Pre-Generate a few thousand addresses with vanitygen.
  • Import the addresses in a mysql table.
  • Import the private keys in the Bitcoin app so I can easily see the money I've made.
  • Every new user that registers gets a bitcoin address from the mysql table.
  • A bitcoin notification service pings a script on the webserver when someone sends bitcoins to their address.
  • Their balance is updated and they can make purchases.

I'm having a few problems, though:

- Vanitygen is slow (2009 Core 2 Duo)

- Most notification services only support a low number of addresses.

- It's hard to import thousands of bitcoins into the Bitcoin app.

- An internet wallet like Blockchain only supports up to 400 addresses. (is there an alternative that supports more?)

I'd guess someone has done all this before. Is there an easy solution to this? Or am I handling this wrong?
Raoul Duke
aka psy
Legendary
*
Offline Offline

Activity: 1358
Merit: 1002



View Profile
August 19, 2012, 12:47:27 PM
 #2

Code:
for i in `seq 1 5000`; do bitcoind getnewaddress; done >addresses.txt

That command will generate 5000 addresses on your wallet using bitcoind(no import needed) and save the addresses to a text file.
Change 5000 to any other number you like.
payb.tc
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
August 19, 2012, 12:58:01 PM
 #3

why the need to generate them all at once?

if you're getting 10 customers a day, you just need to generate 11+ addresses a day to keep up and fill your db.

why the need to have them as vanity addresses? how long is the vanity string you have in mind?
btcsf (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 19, 2012, 01:09:49 PM
 #4

Code:
for i in `seq 1 5000`; do bitcoind getnewaddress; done >addresses.txt

That command will generate 5000 addresses on your wallet using bitcoind(no import needed) and save the addresses to a text file.
Change 5000 to any other number you like.

Nice, just what I was looking for. Thank you very much.

Edit: I'm on a Mac. How do I install bitcoind? I found this wiki-article, but there's nothing listed under the Mac section.

https://en.bitcoin.it/wiki/Running_bitcoind#Mac
btcsf (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 19, 2012, 01:11:13 PM
 #5

why the need to generate them all at once?

if you're getting 10 customers a day, you just need to generate 11+ addresses a day to keep up and fill your db.

why the need to have them as vanity addresses? how long is the vanity string you have in mind?


I would rather just do it once and be done with it.

I was using vanitygen because it was the only tool I knew that could mass-generate bitcoin addresses.
flatfly
Legendary
*
Offline Offline

Activity: 1092
Merit: 1016

760930


View Profile
August 19, 2012, 02:10:35 PM
 #6

Much much easier if you don't have bitcoind: use the clever Bitaddress.org code ("Bulk Wallet" tab)

Just specify how many addresses you want to generate.

https://www.bitaddress.org/bitaddress.org-v1.6-SHA1-162d1ff4fd1e09222cbaca6c282672ee6c195e1b.html
payb.tc
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
August 19, 2012, 02:13:54 PM
 #7

Much much easier if you don't have bitcoind: use the clever Bitaddress.org code ("Bulk Wallet" tab)

Just specify how many addresses you want to generate.

https://www.bitaddress.org/bitaddress.org-v1.6-SHA1-162d1ff4fd1e09222cbaca6c282672ee6c195e1b.html

but then you still have the job of importing them into a wallet, and for the standard client, that will take days.

if you use the bulk address generator of bitaddress.org, your best bet after that is to import into an armory wallet.

btcsf (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
August 19, 2012, 03:37:26 PM
 #8

After googling some more I guess I'm SOL if I have a Mac and want to do business with Bitcoins.

1) Bitcoind apparently doesn't work on Mac OS X.
2) The Armory client is pretty hard to compile.

Guess I have a reason to fire up my Windows partition :-)
rate5
Member
**
Offline Offline

Activity: 104
Merit: 100



View Profile
August 19, 2012, 03:55:09 PM
 #9

After googling some more I guess I'm SOL if I have a Mac and want to do business with Bitcoins.

1) Bitcoind apparently doesn't work on Mac OS X.
2) The Armory client is pretty hard to compile.

Guess I have a reason to fire up my Windows partition :-)

The command psy gave is a linux command I would recommend installing Ubuntu in a virtual machine and running it that way Smiley
Raoul Duke
aka psy
Legendary
*
Offline Offline

Activity: 1358
Merit: 1002



View Profile
August 19, 2012, 04:01:00 PM
 #10

After googling some more I guess I'm SOL if I have a Mac and want to do business with Bitcoins.

1) Bitcoind apparently doesn't work on Mac OS X.
2) The Armory client is pretty hard to compile.

Guess I have a reason to fire up my Windows partition :-)

The command psy gave is a linux command I would recommend installing Ubuntu in a virtual machine and running it that way Smiley

This is correct and recommended.
crazylikeafox
Sr. Member
****
Offline Offline

Activity: 798
Merit: 251



View Profile
November 21, 2012, 06:16:34 PM
 #11

Code:
for i in `seq 1 5000`; do bitcoind getnewaddress; done >addresses.txt

That command will generate 5000 addresses on your wallet using bitcoind(no import needed) and save the addresses to a text file.
Change 5000 to any other number you like.

Sorry to bump an old thread, but just thought I'd post a step-by-step equivalent for Windows, since I had a need for it recently.

1) Open a command prompt, go to the bitcoind directory (your bitcoin directory\daemon)

2) Type "bitcoind -daemon".  Keep this window open for as long as the batch below is running.

3) Open another command prompt.  Navigate to the bitcoind directory again.  Enter the code below at the prompt and press enter:
Code:
for /l %x in (1, 1, 5000) do bitcoind getnewaddress >> newaddrs.txt

If you want to put the above code in a batch file, use 2 '%' symbols in front of the x instead of 1.  Replace the 5000 in the code above with the number of addresses you'd like to generate.  All addresses created will be dumped to newaddrs.txt, and bitcoind happily stores them in your official client wallet automatically.  Theoretically you can enter that same command above in multiple command prompts simultaneously and generate new addresses faster.
SgtSpike
Legendary
*
Offline Offline

Activity: 1400
Merit: 1005



View Profile
November 21, 2012, 06:29:48 PM
 #12

Fair warning, running the QT client begins to get sluggish after about 15k addresses, and is nearly unusable after 120k or so.
payb.tc
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
November 21, 2012, 10:11:27 PM
 #13

Fair warning, running the QT client begins to get sluggish after about 15k addresses, and is nearly unusable after 120k or so.

also, armory is extremely slow with 10k addresses. each click takes about 15 minutes... so a small operation involving a few clicks will take hours.

kakobrekla
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500


Psi laju, karavani prolaze.


View Profile
November 21, 2012, 10:13:57 PM
 #14

This is what I use. Same stuff basically. Save and chmod. Pass an int of addresses as first argument.

Code:
#!/bin/bash

FILE=list_$(date +%s).txt

for x in $(eval echo {1..$1})
do
    bitcoind getnewaddress >> $FILE
done


casascius
Mike Caldwell
VIP
Legendary
*
Offline Offline

Activity: 1386
Merit: 1140


The Casascius 1oz 10BTC Silver Round (w/ Gold B)


View Profile WWW
November 21, 2012, 10:14:31 PM
 #15

I bulk load private keys into bitcoind all the time by commenting out one line of code in the source and recompiling. I comment out the line that rescans from the genesis block after doing an importprivkey. After doing so, importprivkey returns immediately.

Bulk load, and then restart bitcoind with -rescan. Works beautifully.

Companies claiming they got hacked and lost your coins sounds like fraud so perfect it could be called fashionable.  I never believe them.  If I ever experience the misfortune of a real intrusion, I declare I have been honest about the way I have managed the keys in Casascius Coins.  I maintain no ability to recover or reproduce the keys, not even under limitless duress or total intrusion.  Remember that trusting strangers with your coins without any recourse is, as a matter of principle, not a best practice.  Don't keep coins online. Use paper or hardware wallets instead.
casascius
Mike Caldwell
VIP
Legendary
*
Offline Offline

Activity: 1386
Merit: 1140


The Casascius 1oz 10BTC Silver Round (w/ Gold B)


View Profile WWW
November 21, 2012, 10:16:32 PM
 #16

BTW, parallels does a GREAT job of running Ubuntu on a Mac including full support for GPU and clipboard as well as resizing the desktop.

Companies claiming they got hacked and lost your coins sounds like fraud so perfect it could be called fashionable.  I never believe them.  If I ever experience the misfortune of a real intrusion, I declare I have been honest about the way I have managed the keys in Casascius Coins.  I maintain no ability to recover or reproduce the keys, not even under limitless duress or total intrusion.  Remember that trusting strangers with your coins without any recourse is, as a matter of principle, not a best practice.  Don't keep coins online. Use paper or hardware wallets instead.
dpc
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
November 21, 2012, 11:09:23 PM
 #17

Using an address per-customer seems like a waste of resources.

I think using lazy generation of addresses per-transaction is much better idea. Especially that many online customers are one-shots only. They will buy stuff, pay, get it delivered and never return or return next year.

When customer makes a purchase it should get free payment address from a DB for one week (arbitrary time). After this time the address is released to the main pool. Only when weekly transaction rate is getting too big (pool is used for 90%, one generates new addresses and ads them to the DB).
MoonShadow
Legendary
*
Offline Offline

Activity: 1708
Merit: 1010



View Profile
November 21, 2012, 11:18:33 PM
 #18

After googling some more I guess I'm SOL if I have a Mac and want to do business with Bitcoins.

1) Bitcoind apparently doesn't work on Mac OS X.

It works fine, it's just not supported, per se.  I use a iMac.  All of the necessary posix commands should be within reach, once you get to a command line, which is the part Apple doesn't really make easy.  I'm not going to offer to tell you the process, because I don't remember, but my client is set to maintain a buffer of about 2K future addresses via config file arguments, so I know that it's possible.

EDIT: I do remember that the important parts of bitcoind are in strange places on the iMac filesystem, it took me a while to locate them and thus alter the appropriate commands to make it work the way that I wanted.

"The powers of financial capitalism had another far-reaching aim, nothing less than to create a world system of financial control in private hands able to dominate the political system of each country and the economy of the world as a whole. This system was to be controlled in a feudalist fashion by the central banks of the world acting in concert, by secret agreements arrived at in frequent meetings and conferences. The apex of the systems was to be the Bank for International Settlements in Basel, Switzerland, a private bank owned and controlled by the world's central banks which were themselves private corporations. Each central bank...sought to dominate its government by its ability to control Treasury loans, to manipulate foreign exchanges, to influence the level of economic activity in the country, and to influence cooperative politicians by subsequent economic rewards in the business world."

- Carroll Quigley, CFR member, mentor to Bill Clinton, from 'Tragedy And Hope'
casascius
Mike Caldwell
VIP
Legendary
*
Offline Offline

Activity: 1386
Merit: 1140


The Casascius 1oz 10BTC Silver Round (w/ Gold B)


View Profile WWW
November 22, 2012, 12:08:43 AM
 #19

Using an address per-customer seems like a waste of resources.

This is only true to the extent that address creation and address maintenance is a waste of resources.  It shouldn't be, and doesn't have to be.  The total resource expenditure of storing an address in a non-wasteful manner is well under 100 bytes.

When implemented properly, the total resources expended in creating and maintaining an address should be significantly less than the resources expended in logging their web visit.  Even in spite of this, simply reassigning addresses that were assigned months ago and never used is a good way to reclaim whatever resources are associated with unused addresses.

Companies claiming they got hacked and lost your coins sounds like fraud so perfect it could be called fashionable.  I never believe them.  If I ever experience the misfortune of a real intrusion, I declare I have been honest about the way I have managed the keys in Casascius Coins.  I maintain no ability to recover or reproduce the keys, not even under limitless duress or total intrusion.  Remember that trusting strangers with your coins without any recourse is, as a matter of principle, not a best practice.  Don't keep coins online. Use paper or hardware wallets instead.
crazylikeafox
Sr. Member
****
Offline Offline

Activity: 798
Merit: 251



View Profile
November 22, 2012, 01:05:18 PM
 #20

Fair warning, running the QT client begins to get sluggish after about 15k addresses, and is nearly unusable after 120k or so.

I haven't noticed any sluggishness with the newest version of the QT client, and I now have a wallet with 50K addresses in it.  Also the wallet is only around 7MB.  The real problem with the official client is the amount of time it takes to sync after install.  That by itself will hamper the adoption of bitcoin by the general population.  Although alternatives are available that make the use of the official software unnecessary, a casual user that goes to the bitcoin main site and downloads the software will be immediately turned off and may not bother or even understand that alternatives are available.
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!