Token Age Consumed - Technical Details

    We will describe here one statistic that we call the token age consumed. This is a measurement that detects changes in the volume of the token circulation and can show us when tokens that have been frozen for a long time come into circulation. We have computed this measurement for all ERC20 tokens. In theory it can be calculated for any cryptocurrency which has publicly readable transactions (so not like #ZEC or #XMR)

    To understand the token age consumed, 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 a 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 entire four 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 critical if Alice transfers 5000 tokens. The token age consumed is a measurement that will tell us if many people suddenly start transferring tokens that have not moved for a 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 any account , we can construct a stack that describes the account's history 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 :

    No transactions

    In that case the contribution (token age consumed) of the account towards the token age consumed at block is 0.

    Incoming transaction

    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.

    Outgoing transaction

    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 the case of an outgoing transaction, the account contributed to the token age consumed at block . Its contribution is:

    which 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.

    Multiple transactions

    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. 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 calculate the total token age consumed:

    Example

    Imagine again that Alice and Bob are exchanging tokens. Initially, Alice had 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 these 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.