read.cash is a platform where you can earn money for your articles and comments. You can get paid upvotes
from other users or just earn points for writing articles and comments, which are converted daily to
Bitcoin Cash (BCH) cryptocurrency, which can be used on the Internet or converted to your local money.
Takes one minute, no documents required
Advanced BCH Monitoring with Tasker (Part 6: Bitcoin Cash SDK for tasker)
As we saw in part 1, the main goal for all the interfaces and implementations we've been developing is to offer a common software development kit for tasker users to automatize their BCH-related routines and develop new ones.
Our Addresses list can grow to be really long if we use many BIP39 wallets, usually having tons of addresses that do not contain any UTXO at all, we already created a function at the Block Explorer interface that gives us a list of addresses with funds and we are going to use it to update the %CACHED_ADDRESSES variables, effectively reducing the querying cost.
There are several ways where the number of funded addresses could be rendered obsolete:
When a transaction is performed on an unused address the cache won't catch it, as it's happening on one of the addresses that we are ignoring
When one address that had funds spends all of them, going to zero balance
To solve the first one we can schedule a periodic call to computeCache and to solve the second, one could be tempted to just remove the address, that would be ok in all cases where spending all funds implies sending them to another person, but actually the most common case is to have some change as a leftover and sending it to another address (usually dedicated for receiving change) in our wallet, that's why we would be checking, with the following function, if one of our addresses was depleted.
This code will prompt you to input the addresses you are going to use, the currency and the API key if applicable. This is meant to be used whenever you want to change one of these settings, but at least once before start using this SDK.
This code will load the balance, load the currency quotes, notify the changes and update the cache if necessary, this code is meant to be used as a periodic task (i.e: every thirty minutes)