Toccata 101 · Part 1 · card 7

Time on Kaspa

counting time for humans

Like most human inventions, timekeeping formed to fulfil needs of measurement. From food calculations, like when to plant and when to harvest, to industrial factory needs and train timetables. Each period conceptualized and formed time to its needs. One of the most urgent needs was measuring the day and night. Different reasons, spanning from astrology to counting finger joints, led to the number 12 becoming the number of parts (hours) inside day and night, with 24 of those parts making a full day. The number 60, which has its own vast span of uses through history as well as some connection to the number 12, ended up as the number of minutes in an hour and seconds in a minute.

A second was originally just 1/86,400 of a mean solar day (24 [hours a day] x 60 [minutes an hour] x 60 [seconds a minute]). But Earth's rotation isn't perfectly steady, and when humans developed better measurement tech, the definition changed to an atomic one: the duration of 9,192,631,770 cycles of radiation from a caesium-133 atom.

Those methods of counting time are familiar and comfy for us but as the headline suggests, it's for humans. The Kaspa network uses a different kind of counting, for its own needs.

What the network counts

DAA score

The network's count of blocks, about ten every second.

reading
approx. current DAA score

Blue score

A block's blue score is its selected parent's blue score plus the number of blue blocks in its merge set.

1 2 3 4 5 6 Calculate the blue score

Illustration: 6 total blue blocks, blue score is 6.

Blue work

A block's blue work is its selected parent's blue work plus the work of each blue block in its merge set.

3 8 2 9 5 Calculate the blue work

Coin age

Every time a UTXO is created it captures the network's current DAA score. At the same time, a new and specific DAA score count starts. This count is the coin age: the difference between the current global DAA score and the UTXO's creation score.

reading
UTXO of 10 KAS

What a miner writes

The block timestamp

Unix time in milliseconds, stored as a single integer. The node that builds the template writes it from its own clock. Consensus accepts it only if it is strictly after the past median time. Each checking node also rejects it if it is more than 132 seconds ahead of that node's clock.

1788926495334 9 Sep 2026, 04:01:35.334 UTC

The past median time

Take the timestamps of 27 sampled blocks from a block's past, one in every 100, sort them, and average the 11 values closest to the centre. That value is the past median time. A new block's timestamp must be above it, and a lock naming a date is measured against it.

average these 11

Time measurements on Kaspa being utilized by covenants

1

DAA score

The covenant script names a DAA score. At that score the UTXO locked under that covenant will be released and ready to be included in future blocks.

2

Past median time

The covenant names a date in Unix time. The UTXO cannot be spent until the past median time passes it.

3

Coin age

Coin age DAA score can be used to unlock UTXO from covenant as regular DAA score does.

Unix 1970

A computer cannot store "3 March 2026, 14:22" as a date. It can store one number. To turn a moment into a number you need a point to count from, and every machine has to use the same point. If not, the number will lose its meaning the second it leaves the machine that wrote it.

The people building Unix at Bell Labs around 1970 needed such a point. They picked the start of the year. As things often do (just like we inherited the timekeeping methods from old civilizations), Unix spread, C spread, the internet spread, and now every phone, browser, database and server on earth counts from that same instant. It's called Unix time. Right now it is 0 milliseconds, taken from the device you are reading this on.

So a lock naming a date holds a plain number, and a lock naming a DAA score holds a plain number in the same slot. The network tells them apart by size alone. Below 500,000,000,000 the number is a DAA score. At or above, it is a date.

That figure is inherited. Bitcoin drew the line first at 500 million seconds after 1970, which lands in November 1985. Kaspa counts in milliseconds, so the same instant is written a thousand times larger. Both networks split counts from dates at the same moment in 1985. An arbitrary choice, it's just where a round number happens to fall.

It works because the two kinds of number are nowhere near each other. A date today is around 1.79 trillion. A DAA score is a few hundred million, and would need roughly 1,600 years at ten blocks a second to reach the line.

Blue work

Miners solve complex math computation problems until a block under the difficulty target is found. The miner's work is measurable. Blue work is the sum of that effort for every blue block in its past.

This version of PoW in our network exists because counting isn't honest. Difficulty adjusts over time, so a block from a quiet hour was cheaper and a block from a busy one was more expensive. Two blocks might have the same number of blocks behind them, but there was a different amount of miner work produced to find them. The selected chain picks the block with more blue work behind it.

Sources

The counters are in rusty-kaspa v2.0.1. Ten blocks a second is target_time_per_block of 100 ms in consensus/core/src/config/bps.rs. Blue score, blue work and the rule that reads them are in ghostdag/protocol.rs. A lock naming a moment is checked in tx_validation_in_header_context.rs (check_tx_is_finalized), which reads the number as a DAA score below LOCK_TIME_THRESHOLD and as a date at or above it. That constant is 500_000_000_000 in consensus/core/src/constants.rs. When the number is a date, the value it is measured against is the past median time, handed in as LockTimeArg::MedianTime in body_validation_in_context.rs. Coin age is in tx_validation_in_utxo_context.rs (check_sequence_lock): the coin's own block_daa_score plus the relative lock, measured against the DAA score being validated. Bitcoin's line is LOCKTIME_THRESHOLD = 500000000 in src/script/script.h, carrying the comment Tue Nov 5 00:53:20 1985 UTC, which is the same instant written a thousand times smaller. The second is defined by the BIPM as 9,192,631,770 periods of the caesium 133 transition, and it replaced the fraction of a day in 1967. Why the Babylonians counted in 60s has never been settled, and the competing explanations are laid out by MacTutor. The DAA score and the coin's age on this page are read live from api.kaspa.org, and the coin is one output of the address card 1.1 points at.