Just for fun (and to learn a little bit about NEM) I want to build the following application:
It listens to my NEM account and whenever a new transaction is sent to me, it waits will this transaction gets 6 confirmations and after this the application sends me an email.
After reading documentation, here are my thoughts how to do this:
- Run NIS on some server
- Run my application on the same server
- Create a set of finished transactions.
- Every 60 seconds call:
- /chain/height API to find the current height.
-
/account/transfers/incoming API and grab the transactions. If the transaction is not in the set of finished transactions, check whether its
current height - height >= 6
. If so, send the email with details and add it to the finished set.
This looks reasonable, but I do not think that this is the best approach. What if I get more than 25 tx before I get the confirmation number 6? I would rather call transfers/incoming every second, add the new transactions to the below_6_confirmations set and than for every such transaction check whether it has enough confirmations (but I have not seen such API).
Basically I am asking more experienced people: how would you approach this situation (also is this the right place to ask such questions)?