<p>At Justcoin.com, we've used a few different methods over the years:</p>

<ul>
<li>Generate addresses using <a href="https://en.bitcoin.it/wiki/Bitcoind" rel="nofollow">bitcoind</a>, now called bitcoin core, when we need them. To avoid key loss in the case of storage failure, we use a large <a href="https://en.bitcoin.it/wiki/Key_pool" rel="nofollow">key pool</a>. The command is simply <a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list" rel="nofollow">getnewaddress</a>.</li>
<li><a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" rel="nofollow">Hierarchical deterministic wallets</a> are much better and we use these for an increasing number of things. When using these for hot wallets, we import new private keys into our hot wallet before its ever used. That way we can still spend its inputs from bitcoind.</li>
</ul>

CC BY-SA 3.0
2014-07-07T14:17:57.880Z
2014-07-07T14:17:57.880Z
abrkn
<p>How do online Bitcoin wallet sites work? How can they have thousands of addresses laying around, or do they create them on the fly?  What sort of software is used to create all those Bitcoin addresses?  The reason I ask, is that I'm toying with an idea for a website that would require per-user Bitcoin addresses for payment.</p>

CC BY-SA 3.0
2014-07-07T09:29:23.537Z
I'm no owner of such a a site, but I can imagine they are created when someone needs them, with some random parameters (IP, time, mouse tracking, input text, whatever). Creating them beforehand seems also an option, I cannot see a reason not to do it. What are your own pro and cons? (just curious)
Mathias711
CC BY-SA 3.0
2014-07-07T09:39:16.470Z
For the site I'm planning, I'll need one wallet for each user, to which the user can pay for the service - I figure it can be made semi-anonymous while still easy to keep track of wheter or not the user has paid that way.  What I'm wondering, is *how* such a site can create many wallets without risking creating an already existing wallet (ie. used by some running bitcoin-program or some e-wallet site)?  Yes just by using random-number the chance for that is very low, but like with winning the lottery, the chance *is* there.
Baard Kopperud
CC BY-SA 3.0
2014-07-07T09:44:26.353Z
Dont be afraid that multiple addresses are generated ([question](http://bitcoin.stackexchange.com/questions/25422/how-does-the-bitcoin-network-disallow-people-generating-a-key-pair-already-gener/25423#25423)). Even if the RNG is very bad server-side, they still can check if the generated address is already in use on their site. There is however no way to check if it's already been generated before - but not used.
Mathias711
CC BY-SA 3.0
2014-07-07T16:08:58.467Z
There is never any way to *guarantee* that you will not create a private key (a "wallet" is just a collection of private keys) that someone else is not already using.  But, if you are using good random number generators, the probability of doing so is **extremely small.**  It is **much** smaller than any lottery.  Anyone who is going to do this for production should go through the mathematical exercise of working out this probability for themselves, and you will see that it is not worth worrying about.
Nate Eldredge
<wallet><e-wallet>
How do wallet-sites generate large numbers of Bitcoin addresses?
Baard Kopperud
# How do wallet-sites generate large numbers of Bitcoin addresses?

(Asked by: username_0 on 2014-07-07)

How do online Bitcoin wallet sites work? How can they have thousands of addresses laying around, or do they create them on the fly? What sort of software is used to create all those Bitcoin addresses? The reason I ask, is that I'm toying with an idea for a website that would require per-user Bitcoin addresses for payment.

**Tags:** wallet, e-wallet

> **Comments:**
> **username_1**: I'm no owner of such a a site, but I can imagine they are created when someone needs them, with some random parameters (IP, time, mouse tracking, input text, whatever). Creating them beforehand seems also an option, I cannot see a reason not to do it. What are your own pro and cons? (just curious)  
> **username_0**: For the site I'm planning, I'll need one wallet for each user, to which the user can pay for the service - I figure it can be made semi-anonymous while still easy to keep track of wheter or not the user has paid that way.  What I'm wondering, is *how* such a site can create many wallets without risking creating an already existing wallet (ie. used by some running bitcoin-program or some e-wallet site)?  Yes just by using random-number the chance for that is very low, but like with winning the lottery, the chance *is* there.  
> **username_1**: Dont be afraid that multiple addresses are generated ([question](http://bitcoin.stackexchange.com/questions/25422/how-does-the-bitcoin-network-disallow-people-generating-a-key-pair-already-gener/25423#25423)). Even if the RNG is very bad server-side, they still can check if the generated address is already in use on their site. There is however no way to check if it's already been generated before - but not used.  
> **username_2**: There is never any way to *guarantee* that you will not create a private key (a "wallet" is just a collection of private keys) that someone else is not already using.  But, if you are using good random number generators, the probability of doing so is **extremely small.**  It is **much** smaller than any lottery.  Anyone who is going to do this for production should go through the mathematical exercise of working out this probability for themselves, and you will see that it is not worth worrying about.  

---

## 1 answers

### Answer by username_3 on 2014-07-07. Score: 4 | Accepted answer

At Justcoin.com, we've used a few different methods over the years:

* Generate addresses using [bitcoind](https://en.bitcoin.it/wiki/Bitcoind), now called bitcoin core, when we need them. To avoid key loss in the case of storage failure, we use a large [key pool](https://en.bitcoin.it/wiki/Key_pool). The command is simply [getnewaddress](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list).
* [Hierarchical deterministic wallets](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) are much better and we use these for an increasing number of things. When using these for hot wallets, we import new private keys into our hot wallet before its ever used. That way we can still spend its inputs from bitcoind.


---

