Token Age Consumed - Technical
Tzanko MatevApr 10, 2020
We will describe here one statistic that we call the token age consumed. This is a measurement which detects changes in the volume of the token circulation and can show us when tokens that have been frozen for long time come into circulation. We have computed this measurement for all ERC20 tokens. In theory it can be computed for any cryptocurrency which has publicly readable transactions (so not like #ZEC or #XMR)
To understand what the token age consumed is, we need to rethink our idea of a token account. At any given moment an account has a value which is a single number. But this number is a result of transactions coming in and going out of the account. Some of those transactions happened very long time ago while others happened only recently.
Let's look at the following example. Assume that Alice and Bob have each one account of SAN tokens. Both of them have 10000 tokens. Alice bought her tokens 4 months ago and didn't move them. Bob on the other hand was buying and selling large amounts of tokens the whole time. So we can imagine that Alice's tokens were out of circulation for the whole 4 months, while Bob's tokens were in circulation. In this scenario it is not a significant event if Bob transfers 5000 of his tokens today. But it is much more significant if Alice transfers 5000 tokens. The token age consumed is a measurement which will tell us if all of a sudden many people start transferring tokens which have not been touched for long time.
To understand how the token age consumed is calculated imagine that the coins in each account are ordered as a stack: Incoming transactions put money on top of the stack and outgoing transactions take money from the top. For every portion of this stack we can note the block number of the corresponding incoming transaction. So for any given block number and for any account we can construct a stack which describes the history of the account at that block number. We have
Here are token amounts, and are block numbers. Also the sum equals the current balance of the account.
Assume that the current block number is There are several cases regarding the account :
In that case the contribution (token age consumed) of the account towards the token age consumed at block is 0.
In that case we need to put the amount of the incoming transaction at the top of our stack. If that amount was , the new stack becomes
In that case the contribution of the account towards the token age consumed at block is 0.
The outgoing transaction will consume the elements at the top of the stack. If the amount of the transaction was , then all elements such that will be completely consumed. Let be the smallest such index . The element might be partially consumed if there was any amount left from the outgoing transaction. So the new stack will become
In case of an outgoing transaction the account contributed to the token age consumed at block . Its contribution is:
which basically means all elements will be fully consumed and their age is added to the whole contribution, while the last consumed stack can be only partially consumed.
If there were multiple incoming and/or outgoing transactions happening at the same block number we replace them in our calculations with a single transaction. This transaction will be incoming if the total incoming amount is greater than the total outgoing amount, and it will be outgoing otherwise. So we can reduce this case to one of the cases we described above.
After we have computed the token age consumed contribution at block for every account, we can compute the total token age consumed:
Imagine again that Alice and Bob are exchanging tokens. Initially Alice has 5000 tokens, which she obtained at block 0 and Bob doesn't have any tokens.
First Alice transfers 1000 tokens to Bob at block 5. Her transaction stack has a single element and 1000 tokens are consumed from it, contributing token age consumed for block 5. Now Alice transaction stack is and Bob transaction stack is .
Later Bob decides to move this tokens to an exchange and sell them, so at block 15 Bob transfers his tokens to an exchange wallet, which contributes token age consumed to block 15. On the other hand Alice transfers 2000 tokens to Bob at the same block 15, which makes the total token age consumed for block 15 . The transaction stacks of Alice is , while the stack of Bob is .
At block 25, both Alice and Bob decide to transfer their tokens to an exchange, contributing to the total token age consumed for block 25.