0

I am currently working on a Bitcoin Cash related project with the goal of helping contribute to the ecosystem. I am getting to the point where I will soon be ready to start integrating with the protocol, but I am not quite sure how to proceed. The workflow I am looking for goes something like this:

  1. User visits my website
  2. User is presented a QR code that is for a specific payment amount (always $0.25 usd)
  3. User scans QR code and submits payment
  4. Website is listening for the broadcast of the payment (0-conf), and as soon as the network broadcasts the payment, a callback is executed therefore the user's session knows that their payment has been received.

I know the Bitcoin Cash Fund project is currently working on a bitcoincash.js library but it's not ready yet. Since that is the case, I assume I am going to have to fork the current bitcoin core js library and make it work with the cashaddr format to generate addresses for the QR codes.

The other piece that I am unclear about is how to go about listening for broadcasted txns. I see there is a blockchain.info websocket server, which I assume since they announced full support for BCH, that it will work with BCH: https://blockchain.info/api/api_websocket

But, from what I can tell, I don't think it's possible to use the testnet?

So that is making me wonder if relying on a 3rd party for this, especially with it being 0-conf, is a bad idea? If so, I assume the answer is to run my own node and somehow have my own websocket server query it at regular intervals. Is that correct?

Also, on the topic of pub/sub for this, what is the best way for the client know a payment was made for that specific user? Is it to just generate a new address with each visit to the site? Or is it to include some sort of uuid as metadata with the txn?

1

You can host your own Bitcore Web services Bitcore

You can do things like as follows.

  1. User present QR with the random address using this library Bitcore Library

  2. User sends payment using wallet.

  3. Website will be listening to transaction broadcasted by customer wallet.

Here is the resource for a payment protocol read it thorough you will get an idea. Bitcore Pay Pro

Talking about 0-conf: Once a transaction is sent, it is broadcasted immediately even if the next block has a few minutes before its found. If you as a merchant running a node has capability to verify the transactions.

You can host your own BWS. No need to rely on 3rd party.

For more please refer to bws docs.

0

You can use the insticce.com api to generate unique addresses for your app. It will hit a callback url of your choice when payment is received.

It also forwards all payments immediately to a forwarding address of your choice. You have the option to wait for a confirmation before getting notified if you like.

If you accept zero conf you will be notified, and also receive the payment at your forwarding address within seconds of the customer hitting "send".

It works on testnet, mainnet and uses cashaddr format.

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.