1

I have clients that would like to pay for services in BTC.

TL;DR

To generate a new payment address must I generate a new private key (essentially a new wallet)?

Is it better to generate independent private keys for each payment from each client, or to use a determinstic wallet?

Is it possible to automatically move the BTC to a central wallet address without storing the private key for either solution?

How To Generate Multiple Addresses?

Based on this bitcoin.it article:

Addresses are not intended to be used more than once, and doing so has numerous problems associated [with it].

Therefore, the logic I have follows that each payment received from each client should be to it's own address.

However, I am confused about the generation of multiple addresses, and the best way in which to do it.

Other questions on here, such as this one and this one, indicate that each private key will result in a single address only. Am I therefore right to conclude that each address for each payment from each client must have it's own private key?

If that is the case (as in my limited understanding it would seem to be), and I am generating the wallet addresses using software, is it better to:

  1. Use a deterministic wallet that generates each payment address for each client from a single 'master key', or
  2. Generate an indepedent private key for each payment address for each client?

Moving BTC To Central Wallet

I need to move the BTC from the received wallet into my wallet in order to spend it.

In either of the scenarios I mentioned, would the 'master key(s)' be securely stored on the server for programmatic use in order to facilitate moving the received funds into my wallet?

If that is the case, would it be more secure to have independent private keys for each instance of a payment from a client?

2

Short answer: check out BTCPay, it does what you ask. You don't have to create your own server to use it, you can just create an account on an existing instance, for example this one should be fine to being with.

Long answer: you're right when you say that one private key generates one address, but Hierarchical Deterministic (HD) wallets are made to solve that. Basically they allow to generate a virtually unlimited number of private and public key pairs from one piece of data. Deterministic means that if you know this piece of data, the "seed", you will always generate the same keys in the same order.

But it gets better than that, as you can derive only the public keys, meaning that you can use an unsecured server to generate addresses and receive bitcoin payments without ever exposing your private keys! That's the way BTCPay server work, and that's why you can use another person server to receive payments without trusting him. Worst case he will only know all your addresses, but can never steal your bitcoins.

I'm simplifying a bit, but that's the general idea.

As for your last question, you could have the private keys on another wallet like Electrum, or a Ledger, and then just use that to spend the bitcoins you received on your BTCPay server. I won't go into more details here, you can have a look at the BTCPay documentation or get in touch with their community.

NB: I recommend BTCPay because as far as I can understand your need I think it is the best option, but if you're not confortable with it you could as well use Electrum or a Ledger and send new addresses to your client in email or a secret pastebin for example.

That's great if your customers are okay to pay you in bitcoins. Stay safe, and remember never ever give your seed, or private keys to anyone or any service on the internet.

| improve this answer | |
  • Thank you for your detailed answer. I have tried BTCPay Server to achieve this already but was having some difficulties with it. Given what you have described here I am going to persevere with trying to get it to work rather than try to implement my own solution. – Martin Jun 19 at 10:30
1

I believe there are two key decisions to be made, for your case, and essentially the second would depend on the first that is: Would your customer want control over their own funds? If so, a private/public key(s) is in order. If they don't then you can decide if you want to have separate private keys for each client or not.

What it's important in any case is that each payment should be sent to a different public key. You can have as many public keys as you want and only one private key. What I mean is you don't need to create a new pair just to get a new payment address.

Note: BTCPayServer allows you to operate with such different setups.

| improve this answer | |
  • Thank you for your answer. My customers have no control of the funds once paid so I do not need them to be able to access their keys. Given this and the other answer, I have decided to attempt to get BTCPay Server working and to integrate with that via the API. – Martin Jun 19 at 10:32
  • This is slightly incorrect: each public key will have its own related private key, that will be required to spend the funds. Multiple public keys are not derived from the same private key. A modern HD wallet does use a single mnemonic seed phrase to create a master private key, but that key is then just used to derive child keypairs. – chytrik Jun 19 at 18:06
  • Thanks for the heads-up @chytrik. Now I'm intrigued on how does that work for regular/legacy wallets. Will check that implementation whenever I find some spare time. – rudygodoy Jun 24 at 17:21
  • 1
    Non-HD wallets will just generate random new keypairs as needed. This makes keeping a backup difficult: you have to create a new backup every time a new address is created! – chytrik Jun 24 at 18:41

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.