Definition

Recall that a coin-age model allows us at each given point in time to split all coins into segments where each segment xx has an assigned amount vxv_x and creation timestamp otxot_x. The set of all segments that exist at time tt will be denoted by StS_t.

Then, the formula for computing the mean coin age MCA(t)MCA(t) is:

MCA(t)=xSt(totx)vxxStvxMCA(t) = \frac{\sum_{x\in S_t} (t-ot_x)v_x}{\sum_{x\in S_t}v_x}

Let us call the quantity in the numerator, the total coin age and let us denote it by TCA(t)TCA(t). The quantity in the denominator is the total supply existing at time tt. We will call it TS(t)TS(t)

Total supply

We can already compute the coin circulation. For each period pp we can compute the amount of coins that have been active in the last pp days. Let us denote this amount by Circp(t)Circ_p(t).

Lemma

TS(t)=Circp(t)TS(t) = Circ_p(t)

for pp sufficiently large. More precisely the equality holds if pp is larger than the total life of the coin.

Total age

Let's focus on computing the total age of each coin. We have

TCA(t)=t(xStvx)xStotx=TS(t)tTCT(t)TCA(t) = t\left(\sum_{x\in S_t} v_x\right) - \sum_{x\in S_t} ot_x = TS(t)t - TCT(t)

We call the second summand, the total creation timestamp. If we divide it by the token supply we will get the mean creation timestamp MCT(t)MCT(t). Hence we have the following formula:

MCA(t)=tMCT(t)MCA(t) = t - MCT(t)

In other words the mean coin age is equal to the current timestamp minus the mean creation timestamp.

Total creation timestamp

According to the theory that we have already developed, we can efficiently compute the total creation timestamp. It is the metric Mf(t)M_f(t) associated to the function f(x,t)=otxvxf(x,t) = ot_x v_x.

Lemma

Let EE denote the event stream associated to the coin age model SS. Then

ΔTCT(t)=eEte=tσeotxve\Delta TCT(t) = \sum_{e\in E \\ t_e = t} \sigma_e ot_x v_e

The SQL statement for computing the real-time total creation timestamp delta is

1
2
3
4
5
6
SELECT
  asset_id,
  dt,
  sum(sigma*odt*amount) as value
FROM {events}
GROUP BY asset_id, dt

In practice we don't use the real-time delta functions. Instead we use daily or five-minute deltas. Those functions must be constructed in such a way that the value of the daily TCT is the same as the value of the real-time TCT at the start of each day. For the five-minute analogue a similar condition must hold. We have:

Lemma

The daily TCT delta is computed using the following SQL:

1
2
3
4
5
6
SELECT
  asset_id,
  toStartOfDay(dt + 86400) AS daily_dt,
  sum(sigma*odt*amount) AS value
FROM {events}
GROUP BY asset_id, daily_dt

The five-minute TCT delta is computed using the following SQL:

1
2
3
4
5
6
SELECT
  asset_id,
  toStartOfFiveMinutes(dt + 300) AS five_minute_dt,
  sum(sigma*odt*amount) AS value
FROM {events}
GROUP BY asset_id, daily_dt

Mean age computation

From the facts above we can easily derive the mean coin age. We first compute the daily or five-minute ΔTCT\Delta TCT. Then we use a cumulative sum to compute the daily of five-minute total creation timestamp TCTTCT. From that we can compute the mean creation timestamp as a composite metric with the SQL formula

1
total_creation_timestamp/circulation_20y

Finally we can compute the mean coin age as a composite metric with the SQL formula:

1
dt - mean_creation_timestamp

Relation to age consumed

There is a relation between the total creation timestamp delta and age consumed. The age consumed (or coin-days destroyed) is computed by the formula:

AC(t)=eEte=tσe(tote)veAC(t) = \sum_{e\in E \\ t_e = t} -\sigma_e (t-ot_e)v_e

So you have

AC(t)=ΔTCT(t)teEte=tσeveAC(t) = \Delta TCT(t) - t\sum_{e\in E \\ t_e=t} \sigma_e v_e

The latter summand is the timestamp multiplied by the total supply delta at the time tt. If we choose a sufficiently large period pp it is also equal to ΔCircp(t)\Delta Circ_p(t). So if we already compute the age consumed we can compute the delta total creation timestamp as a composite metric:

1
age_consumed + dt * circulation_delta_20y

However our age consumed metric is measured in days. If we want the delta TCT to be measured in seconds the formula is

1
age_consumed*86400 + dt*circulation_delta_20y

If we want it to be measured in days, then we have

1
age_consumed + dt/86400 * circulation_delta_20y

In conclusion once we have age_consumed and circulation we can compute the mean coin age using only cumulative sums and composite metrics.

Was this article helpful?