I am running bitcoinqt on my server. Each second, I use a .NET API to query the daemon to find new transactions which contain needed addresses. (The addresses are not from the local wallet.)
So, first I do GetRawMemPool()
to get list of all new transaction Ids, and then for each id I do GetRawTransaction(transactionID)
and DecodeRawTransaction()
to get transaction details to find out if it contains needed addresses.
The problem is that this process, querying the daemon for each transaction in the mempool, sometimes takes a lot of time, up to 1 min, since the mempool sometimes has 10-12k transactions in the pool. I think the most CPU intensive is the DecodeRawTransaction()
call.
So, this method of confirming a payment is taking far too long, and is currently not acceptable for my application. I need at most 10-20 seconds.
So, is there another way to get this information faster?
(I can't use third party api like blockchain)
DecodeRawTransaction(GetRawTransaction(transactionID))
is the same thing asGetRawTransaction(transactionID, 1)
. The1
specifies to decode the result before returning it. That will eliminate 1 RPC call per TX in the mempool, but there are still better ways of doing this.