0

I'm building a webapp that needs to update account info and send a message when an account's address gets a deposit, and/or confirm withdrawals.

I'm not sure what the best way to do this is. Would you have a separate application keep sending API calls to blockchain.info until a new transaction comes through? Then initiate the right callback function?

Using blockchain.info seems flimsy since it's a 3rd party service. How would you do this monitoring the bitcoin network? It seems like using any bitcoin client would rely on some commandline action. Would the best way be continuing to send the commandline action out until the returned data is different, and then initiate the callback? Is there a better design pattern that I am missing?

  • Are you trying to tell your user when their money has entered their wallet? Shouldn't their wallet tell them that? – Izzy Jul 30 '13 at 11:54
  • The wallet may know bitcoin has been received, but how would the wallet know to email / notify the specific user? A callback on the address is needed. – John Jul 30 '13 at 14:56
3

If you rely on bitcoind and JSON-RPC API you could try launching daemon with -walletnotify option.

bitcoind -daemon -waletnotify="process-txn.sh %s"

This will call process-txn.sh with transaction id on the input. Then you can query the daemon for transaction details.

  • Doesn't walletnotify work only for addresses registered? How to get all transactions? Clearly the node receives it. Bitcoinj allows it. – Jus12 Nov 1 '16 at 17:20
1

I have built an open source service that does exactly this. Every time a new address is generated, it's associated with an account in a database. The Bitcoin client is running using the optional -walletnotify command to notify the database about the new transaction. When the database receives a new transaction, the account associated with that address can be notified.

Check out https://bitlab.co/wallet to see a demo of this in action. Also, the source for the back-end is available at https://github.com/bitlabco/bitlab-nodejs

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.