1

I am looking to set up a simple single page store. This store should respect the privacy of users by not requiring personal information where none is needed. I want to retain control of the funds, I don't want to sign up with an exchange, but want payments to go directly to my wallet. How can I achieve that?

2
  • 4
    Product recommendations are off topic here, as they tend to be outdated quickly. However, try BTCPayServer. Jul 21, 2019 at 16:57
  • Hi Courtney, I've edited your question to focus on the problem you're trying to solve. Please feel free to revert or amend my edit to best represent your issue.
    – Murch
    Jul 21, 2019 at 19:27

1 Answer 1

0

If for you it's ok to use 3rd parties' services, a simple google search will present to you several plug-ins that suit your purpose.

If you want to do it by yourself, here is how you may want to tackle this endevour:

  1. you must have an HD wallet (aka deterministic wallet compliant with BIP 32).

  2. you put your XPUB in your server and you use it to generate dynamically the public keys that will be shown to your customers.

  3. You want to make sure that every customer sees a different public address, so that when you receive a payment you will know who paid for what. If you always use the same public address (besides compromising the privacy of all parties involved in the transaction) you won't have any way to know which customer paid for what product. More on this point later.

  4. in HD wallets new key pairs and public addresses are generated using the XPUB in conjunction with an HD path such as this: M/44'/0'/0'/0/x. Every time a new customer sees the payment page , in order to show him or her a new address, you need to change the 'x' (child) value. For example the first customer will see an address which corresponds to HD path M/44'/0'/0'/0/0 , the second customer will see the public address which corresponds to M/44'/0'/0'/0/1 and the third one will see M/44'/0'/0'/0/2 and so forth. You can go on for millions of addresses, but you need to put in place some mechanism that allows you to keep track of the last child number. You can do that on a JSON file on your server or through your DB.

  5. if you want to apply some sort of automated business logic you need to monitor the blockchain to listen to incoming payments to the addresses you created. Sure enough, purchase data must be saved into your DB along with the bitcoin public address created for that specific purchase. This will come handy later when you will need to automatically confirm the purchase to the customer and deliver the order.

  6. You may want to use a websocket to listen to unconfirmed payments (in mempool) received by the address shown in the webpage that the cusomer is seeing. As soon as a payment is detected , with a dozen lines of JS you ll be able to print a "thank you" message on the customer's screen.

  7. Monitor the blockchain for confirmed payments (at least one confirmation, but 3 confirmations is safer) received by the addresses you generated. When you see a new confirmed payment you can confirm the purchase to the customer by email and ship your product to him or her.

As a final piece of recomendation, you should set up some sort of count down or other mechanism that limits the validity of the address you generated and prices quoted. This is vital to protect yourself and your customer from the tremendous price swings of BTC against major fiats.

I hope that this helped you :-)

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