Until our update 5.0 calculating the balance of wallets took nearly one hour. With the balance tracker, you are ready in just a few seconds!
With the help of our service tool the “preloaded blockchain” we have now been able to accelerate the syncing with the game database. Besides that, we were able to speed up the download of the blockchain. Nevertheless, the calculation of a player’s balance is still very time consuming. Unfortunately, there is no way to use the existing service to speed up this process.
Our vision was to speed up the syncing of wallets as much as possible. Until recently it had always been necessary to parse the whole blockchain starting with the genesis block, to find out if there were unspent outputs for transactions. This used to be done by each client for the specific address in use.
What the balance tracker does
In our update 5.0 we introduced our service called “balance tracker”. It utilizes a block explorer to reduce the waiting time as the client does not have to compute the balance on its own.
A block explorer creates a separate database, is able to extend it with data from the full node and keeps itself updated constantly. To do so it is connected with a full node in which all transactions are included.
Please note that we did not just add a block explorer to our game. Firstly, it would not deliver the exact data which would be needed to initialize the tracker in our client. Receiving the balance of an address is not a problem. However, it does not receive the corresponding UTXOs which are needed, so we have to get those separately for every single transaction.
Secondly, the service eliminates potential errors if the explorer changes its output or if we decide that another block explorer suits our needs better. For instance, we can update it anytime without releasing a new game version.
So we have decided to enable our client to communicate with our service. The service is in contact with the block explorer which gets its data from a full node.
How the block explorer works
It was quite hard to find a suitable explorer. The widely used NBXplorer, for instance, is just a minimalistic UTXO tracker whose main use is to track addresses — and only those which were actively registered. We tried to expand the explorer but it turned out that tracking a huge amount of addresses is simply not possible within a reasonable implementation time.
Other explorers were unusable because their technology did not match our needs. After all, we operate on CentOS 7 which only uses stable components. Most modern explorers were not an option because CentOS 7 does not use Python 3.7 and they require a later version. Therefore, we decided to use the ElectrumX server.
To communicate with the explorer the client sends a script hash. With the UTXO the block explorer searches for all corresponding transactions. When the data is collected, it is sent to our game client which computes the available funds.
This information is transferred to the client in a small data package which can be downloaded in a very short time. So your waiting time was reduced from several hours, when doing it by yourself, to just a few seconds!
Nevertheless, this will not replace our preloaded blockchain service. Both fulfill 2 different tasks: While the preloaded blockchain service accelerates collecting game data, the balance tracker is responsible for a speedy calculation of your funds.
Of course, you do not have to use any of our services! As a true blockchain game, we want to give our players maximum freedom. You can turn them off at anytime in the settings. Please note, the waiting time for starting up will be considerably longer if you do not use our services.