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?


  • 3
    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 Jan 11 '16 at 19:47
  • 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. – Nayuki Jan 12 '16 at 1:13
  • Hierarchical Deterministic Wallets, interesting! Had to look that one up: en.bitcoin.it/wiki/Deterministic_wallet – Scott Mar 12 '16 at 18:03

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.


Your site can use the script here 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.

  • 2
    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 Jan 11 '16 at 19:46
  • 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 Jan 11 '16 at 19:58
  • 1
    Or better yet - Generate a batch of private key / address pairs offline, and load only the addresses to the public facing server. – mti2935 Jan 11 '16 at 20:37
  • 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 Jan 12 '16 at 0:00
  • 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 (en.wikipedia.org/wiki/Multitier_architecture) where the private keys are generated/stored at a deeper level of your private network. – Jestin Apr 11 '16 at 21:54

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:


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:


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:


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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.