Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: jlp on February 04, 2014, 01:54:24 AM



Title: Should I use Blocknotify to update my unconfirmed transactions?
Post by: jlp on February 04, 2014, 01:54:24 AM
I'm trying to integrate and accept Bitcoin on my web app.

I'm using Bitcoin's walletnotify to tell me if a customer has sent Bitcoins to the address that I provided him/her.  Then I call the "gettransaction" RPC call to the Bitcoin API to get the transaction ID and unconfirmed amount and store this with the address into my database.  Then I'm using Bitcoin's blocknotify to prompt me when maybe one or more of my unconfirmed transactions might be confirmed (6? times).  When I get a blocknotify, I will find all of the transactions in my database that are unconfirmed and then use "gettransaction" to get the number of confirmations for those transactions.

I found out, through the "getblock" RPC call to the Bitcoin API, that the block will include many transactions that did not send to nor receive Bitcoins from my wallet.  With the array of transactions returned from "getblock", I called "gettransaction" on those transactions.  I got the following error on many of these transactions:

error: {"code":-5,"message":"Invalid or non-wallet transaction id"}

According to the following posting, this means those transactions are not involved with my wallet:

https://bitcointalk.org/index.php?topic=100824.0 (https://bitcointalk.org/index.php?topic=100824.0)

This makes me think that blocknotify will pompt me thousands or hundreds of thousands of times, as there must be millions of transactions on the Bitcoin network that are unrelated to my wallet.  Am I correct?  If so, this doesn't seem that blocknotify is a viable method to update the confirmations on my transactions.

Did anyone use this method and if so, did your server spent a lot of resources in processing blocknotifies?  What is a better way to update the transaction confirmations?  If there a way to use blocknotify or something else from Bitcoin-QT/bitcoind?


Title: Re: Should I use Blocknotify to update my unconfirmed transactions?
Post by: M1SHO on March 14, 2014, 01:46:22 AM
Did you found any solution ? I'm also working on something similar for litecoin.