<p>A safe alternative would be to pre-generate a large number of public wallet addresses offline in your client, then loop through those when displaying them on your website.</p>

<p><strong>That way your private keys are completely safe.</strong>  This is the best option in my opinion.</p>

<p>You could generate <em>a lot</em> of keys locally.</p>

<p>To enforce the goal of no 2 transactions per key, you could write a script to check the public address for usage before delivering it to the user.  If the address has already been used, remove it from your list of addresses that you deliver.</p>

CC BY-SA 3.0
2016-03-12T18:02:29.503Z
2016-03-12T18:02:29.503Z
Scott
<h3>Option 1. Hierarchical Deterministic Wallet in your server</h3>
<p>One that is widely used is Electrum (electrum.org). You can install it in your webserver (it can be a watch only wallet so you don't keep your private keys in the server) and every time it receives a request it will generate a new address. You can see a full tutorial here:</p>
<p><a href="http://docs.electrum.org/en/latest/merchant.html" rel="nofollow noreferrer">http://docs.electrum.org/en/latest/merchant.html</a></p>
<p>Another option would be to use a plugin to do that in a much easier way. If you are using Wordpress + WooCommerce you can use this:</p>
<p><a href="https://wordpress.org/plugins/bitcoin-payments-for-woocommerce/installation/" rel="nofollow noreferrer">https://wordpress.org/plugins/bitcoin-payments-for-woocommerce/installation/</a></p>
<p>There are many other plugins that work in the same way for most CMS and eCommerce solutions.</p>
<h3>Option 2. Use a payment processor</h3>
<p>They will take care of everything for you, but they will keep a small fee. Everytime someone clicks on the donate button, they will create a new address and show it to the user. Usually you just need to embed some html on your website on install a plugin they provide. This, however, will send the funds to your account at the payment processor. You can withdraw from there, but you are losing control of your funds until you do.</p>
<p>Some well known are:</p>
<ul>
<li><a href="http://gocoin.com" rel="nofollow noreferrer">Gocoin.com</a></li>
<li><a href="http://bitpay.com" rel="nofollow noreferrer">Bitpay.com</a></li>
<li><a href="http://coinbase.com" rel="nofollow noreferrer">Coinbase.com</a></li>
</ul>

CC BY-SA 3.0
2016-05-11T21:17:17.537Z
2016-05-11T21:17:17.537Z
2020-06-16T11:10:03.350Z
Fernando Gutierrez
<p>Your site can use the script <a href="https://gist.github.com/colindean/5239812" rel="nofollow">here</a> to generate a bitcoin address (and corresponding private key) 'on the fly'.  Then, you should be able to import the keys/addresses into your wallet.</p>

CC BY-SA 3.0
2016-01-11T19:46:06.380Z
Downsides: Public facing web server is handling private keys. Server crash might cause you to lose private keys and thus money. You might end up with a LOT of keys which could become messy. HD wallet XPUB seems like a better option.
Jannes
CC BY-SA 3.0
2016-01-11T19:58:48.870Z
Good point.  This problem can be mitigated by encrypting the private keys on the server as they are generated, offloading them to a non-public-facing host, and decrypting them there when needed.
mti2935
CC BY-SA 3.0
2016-01-11T20:37:33.740Z
Or better yet - Generate a batch of private key / address pairs offline, and load only the addresses to the public facing server.
mti2935
CC BY-SA 3.0
2016-01-12T00:00:35.177Z
That's probably the recommended way. Still very important to keep an eye on the webserver as a hacker can simply replace the addresses with his own.
Jannes
CC BY-SA 3.0
2016-04-11T21:54:00.740Z
I would not recommend ever storing private keys on a live, public-facing web server.  At the very least, look into building a multi-tier architecture (https://en.wikipedia.org/wiki/Multitier_architecture) where the private keys are generated/stored at a deeper level of your private network.
Jestin
CC BY-SA 3.0
2016-01-11T19:36:25.873Z
2016-01-11T19:36:25.873Z
mti2935
<p>Use <a href="https://github.com/achow101/bittipaddr" rel="nofollow noreferrer">https://github.com/achow101/bittipaddr</a>. Developed exactly for the purpose you mentioned. </p>

<blockquote>
  <p>Embed an automatically changing Bitcoin address into any webpage or
  forum post. It will serve a new address for each donation so that you
  will not have to worry about any address reuse issues with your
  donations.</p>
</blockquote>

<p>TO embed add following code in your html as mentioned in <a href="https://bitcointalk.org/index.php?topic=1650551.0" rel="nofollow noreferrer">https://bitcointalk.org/index.php?topic=1650551.0</a></p>

<pre><code>&lt;iframe src="http://bittipaddress.com/bittipaddr/addressfor/da7ir8dl" style="border:none;" scrolling="no"&gt;&lt;/iframe&gt;
</code></pre>

CC BY-SA 3.0
2016-12-08T14:24:46.340Z
2016-12-08T14:24:46.340Z
dark knight
<p>Is there a way to display on a website of mine, a new address for every transaction?</p>

<p>e.g., I have a wallet, and every time it receives a donation, displays a new address on my website that corresponds to the address my wallet will recognize, so that no address ever receives two transactions?</p>

<p>thanks!!</p>

CC BY-SA 3.0
2016-01-11T19:47:42.113Z
Sounds like a job for stealth addresses (I forgot the more recent name for them) which are not really implemented yet. 2nd choice would be an HD wallet where you put the XPUB key on your server and let it generate addresses on the fly.  The server can generate a pool of like 10 addresses without payment (so not everything gets the same address) and then when a payment comes in you signal the server to skip all those and start using the next 10 addresses. Anyway, I don't have a copy/paste ready answer and there are a lot of details to this.
Jannes
CC BY-SA 3.0
2016-01-12T01:13:18.417Z
You want to use hierarchical deterministic wallets. They solve exactly the problem you are describing - to generate any number of new addresses on the fly.
Nayuki
CC BY-SA 3.0
2016-03-12T18:03:57.247Z
Hierarchical Deterministic Wallets, interesting!  Had to look that one up: https://en.bitcoin.it/wiki/Deterministic_wallet
Scott
<bitcoind><address-generation>
Displaying rotating bitcoin address
Tim Gregg
# Displaying rotating bitcoin address

(Asked by: username_0 on 2016-01-11)

Is there a way to display on a website of mine, a new address for every transaction?

e.g., I have a wallet, and every time it receives a donation, displays a new address on my website that corresponds to the address my wallet will recognize, so that no address ever receives two transactions?

thanks!!

**Tags:** bitcoind, address-generation

> **Comments:**
> **username_1**: Sounds like a job for stealth addresses (I forgot the more recent name for them) which are not really implemented yet. 2nd choice would be an HD wallet where you put the XPUB key on your server and let it generate addresses on the fly.  The server can generate a pool of like 10 addresses without payment (so not everything gets the same address) and then when a payment comes in you signal the server to skip all those and start using the next 10 addresses. Anyway, I don't have a copy/paste ready answer and there are a lot of details to this.  
> **username_2**: You want to use hierarchical deterministic wallets. They solve exactly the problem you are describing - to generate any number of new addresses on the fly.  
> **username_3**: Hierarchical Deterministic Wallets, interesting!  Had to look that one up: https://en.bitcoin.it/wiki/Deterministic_wallet  

---

## 4 answers

### Answer by username_3 on 2016-03-12. Score: 1

A safe alternative would be to pre-generate a large number of public wallet addresses offline in your client, then loop through those when displaying them on your website.

**That way your private keys are completely safe.** This is the best option in my opinion.

You could generate *a lot* of keys locally.

To enforce the goal of no 2 transactions per key, you could write a script to check the public address for usage before delivering it to the user. If the address has already been used, remove it from your list of addresses that you deliver.


---

### Answer by username_4 on 2016-05-11. Score: 0

### Option 1. Hierarchical Deterministic Wallet in your server

One that is widely used is Electrum (electrum.org). You can install it in your webserver (it can be a watch only wallet so you don't keep your private keys in the server) and every time it receives a request it will generate a new address. You can see a full tutorial here:

<http://docs.electrum.org/en/latest/merchant.html>

Another option would be to use a plugin to do that in a much easier way. If you are using Wordpress + WooCommerce you can use this:

<https://wordpress.org/plugins/bitcoin-payments-for-woocommerce/installation/>

There are many other plugins that work in the same way for most CMS and eCommerce solutions.

### Option 2. Use a payment processor

They will take care of everything for you, but they will keep a small fee. Everytime someone clicks on the donate button, they will create a new address and show it to the user. Usually you just need to embed some html on your website on install a plugin they provide. This, however, will send the funds to your account at the payment processor. You can withdraw from there, but you are losing control of your funds until you do.

Some well known are:

* [Gocoin.com](http://gocoin.com)
* [Bitpay.com](http://bitpay.com)
* [Coinbase.com](http://coinbase.com)


---

### Answer by username_5 on 2016-01-11. Score: 0

Your site can use the script [here](https://gist.github.com/colindean/5239812) to generate a bitcoin address (and corresponding private key) 'on the fly'. Then, you should be able to import the keys/addresses into your wallet.

> **Comments:**
> **username_1**: Downsides: Public facing web server is handling private keys. Server crash might cause you to lose private keys and thus money. You might end up with a LOT of keys which could become messy. HD wallet XPUB seems like a better option.  
> **username_5**: Good point.  This problem can be mitigated by encrypting the private keys on the server as they are generated, offloading them to a non-public-facing host, and decrypting them there when needed.  
> **username_5**: Or better yet - Generate a batch of private key / address pairs offline, and load only the addresses to the public facing server.  
> **username_1**: That's probably the recommended way. Still very important to keep an eye on the webserver as a hacker can simply replace the addresses with his own.  
> **username_6**: I would not recommend ever storing private keys on a live, public-facing web server.  At the very least, look into building a multi-tier architecture (https://en.wikipedia.org/wiki/Multitier_architecture) where the private keys are generated/stored at a deeper level of your private network.  

---

### Answer by username_7 on 2016-12-08. Score: 0

Use <https://github.com/achow101/bittipaddr>. Developed exactly for the purpose you mentioned.

> Embed an automatically changing Bitcoin address into any webpage or
> forum post. It will serve a new address for each donation so that you
> will not have to worry about any address reuse issues with your
> donations.

TO embed add following code in your html as mentioned in <https://bitcointalk.org/index.php?topic=1650551.0>

```
<iframe src="http://bittipaddress.com/bittipaddr/addressfor/da7ir8dl" style="border:none;" scrolling="no"></iframe>

```


---

