6
5
I want to create a website which involves the creation of a new single-use address that a user would send bitcoins to. I'd like to know programmatically when the user has sent bitcoins to the address so the website can post a "thank you" note (or do whatever else). What is the best way to do this?
The flow would be:
- Website creates and shows user a new single-use address and says, "send bitcoins here"
- User sends bitcoins to the address
- As soon as the address receives bitcoins, the website says "thank you for sending 0.3 BTC!"
I suppose I could poll the address in question every few minutes, but this is problematic because the user may abandon the website after step 1 (i.e., never send any bitcoins), so the website might end up polling forever.
I am using the official bitcoind client now, but I'm open to using something else.
I understand Blockchain.info provides an API to get push notifications on a given address activity, but I'd rather not rely on a third-party service.
I'd be really interested if there is a push method but I don't believe there is any support for this at this time built into the client. – Jay West – 2013-01-19T04:15:38.590
@JayWest at this time there is no push method. At the current time the only option is to create the illusion for the end user that push notification is occurring by using a background process to continually pull data from bitcoind (either getreceivedbyaddress or listtransactions depending on the usage. – DeathAndTaxes – 2013-01-22T02:04:08.987