Displaying rotating bitcoin address

2

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!!

Tim Gregg

Posted 2016-01-11T16:17:31.853

Reputation: 31

3Sounds 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 2016-01-11T19:47:42.113

2You 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 2016-01-12T01:13:18.417

Hierarchical Deterministic Wallets, interesting! Had to look that one up: https://en.bitcoin.it/wiki/Deterministic_wallet

Scott 2016-03-12T18:03:57.247

Answers

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.

Scott

Posted 2016-01-11T16:17:31.853

Reputation: 804

0

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.

mti2935

Posted 2016-01-11T16:17:31.853

Reputation: 609

2Downsides: 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 2016-01-11T19:46:06.380

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 2016-01-11T19:58:48.870

1Or better yet - Generate a batch of private key / address pairs offline, and load only the addresses to the public facing server.mti2935 2016-01-11T20:37:33.740

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 2016-01-12T00:00:35.177

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 2016-04-11T21:54:00.740

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:

Fernando Gutierrez

Posted 2016-01-11T16:17:31.853

Reputation: 382

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>

dark knight

Posted 2016-01-11T16:17:31.853

Reputation: 1 532