My initial need to check the confirmations (actually 6) of multiple pending deposit on my hot wallet addresses which i generated for each deposit request.
So i wish to check any confirmed deposit on those addresses.
I'm using bitcore, bitcore-wallet-service with bitcoind with tindex 1 setting.
My plan was like following:
1. listen mempool update bitcoind.on('tx')
--> if there's a match of output address with my receiving address ==> create a mempool deposit tx (with tx of the address) on db
2. listen new block update bitcoind.on('block')
--> if there's a match with mempool deposit tx id ==> move the mempool deposit tx to pending deposit tx on db
--> check all existing pending deposit tx for confirmation until 6 (using getRawTransaction)
I know it could be done with some cloud api like blockchain.net etc. But i need implement on my own node.
I've been studying the blockchain only 1 month. so please how can i accomplish this task?
Thanks in advance.
I won't tell you exactly how I would have done it, but here a few leads.
First, you have 2 options to bitcoind which will help you:
-blocknotify=
Execute command when the best block changes (%s in cmd is replaced by
block hash)
-walletnotify=
Execute command when a wallet transaction changes (%s in cmd is replaced
by TxID)
The first one will call an external program (ie: your script/binary) on each block received; The second, on all transactions involved in a change in your wallet (including new transactions).
My guess is you can build something around these + the json api. It should be fairly easy to retrieve tx information when a new one is added in your wallet & updating the confirmation number on each block received. I would not use mempool for this.