Logical flow to check for receipt of a bitcoin payment


I'm experimenting with writing some Bitcoin software in Node.JS using the node-bitcoin lib to talk directly to my own bitcoind via JSON-RPC, and I am trying to work out the best-practice way to recognise when a bitcoin payment has been received by an address.

The only way I can really think of doing is is as follows:

  1. a recipient provides the Bitcoin address they wish to receive payment to (presumes they have their own wallet already - else I could generate one for them)
  2. My webpage generates a QR code in the proscribed format for a user's smartphone wallet app to scan.
  3. The user scans the QR code and sends payment via their wallet app
  4. I then assumed I could poll getreceivedbyaddress with the recipient's address until the transactions showed up, but the docs explicitly state that this:

Works only for addresses in the local wallet, external addresses will always show 0.

So I assume the solution is to generate a new receiving address for the recipient rather than let them provide their own receiving address. Ideally in this situation I'd generate a new receiving address for each sale the recipient makes.

Then I can easily poll getreceivedbyaddress, analyse the raw transaction when I see it come in, and, assuming it all makes sense, ping a web-socket event to the webpage telling it to close the QR code and spit out a formal receipt.

Does that make sense or is there a preferred way to do this?

Dave Sag

Posted 2014-08-10T12:43:45.140

Reputation: 111

Question was closed 2014-08-12T12:54:31.283

related: How to know when a payment has been received by bitcoind?

– Murch – 2014-08-12T12:16:53.510

Cool thanks! I'll go read up on -WalletNotify – Dave Sag – 2014-08-12T12:33:42.157

You're welcome. If the linked question answers your question completely, please kindly flag your own question as a duplicate. – Murch – 2014-08-12T12:37:41.697

Good idea. I've done that now. – Dave Sag – 2014-08-12T12:45:31.203

No answers