As a concrete example, I’ll explain how to get the ground truth for topic 58 (“8 hour SOL/USD Log-Return Prediction”, with epoch_length = 52
, ground_truth_lag = 5148
) in the current Allora infrastructure, following this new definition. This is intentionally completely manually; all we use is allorad
and the tool yq
to parse its yaml output.
Epochs are enumerated by the block height they start at (also called nonce height). We get the nonce height of the latest epoch via
$ allorad q emissions topic 58 --node 'https://allora-rpc.testnet.allora.network' |\
yq -r .topic.epoch_last_ended
3839781
So the last epoch started at 3839781
, and the previous one started at 3839729
, the one before that at 3839677
, and so on, always in steps of epoch_length
. However, these epochs are not yet completed: the ground truth isn’t available yet, so they also haven’t been scored yet. To get the last completed epoch, we need to subtract ground_truth_lag+epoch_length
, rounded up to a multiple of epoch_length
(which equals 5200
in this example).
So the last completed epoch started at 3834581
, the previous one at 3834529
, and so on (again, steps of 52
).
allorad
can translate these block numbers to times like this:
$ allorad q blocks --query "block.height = 3834581" --order_by asc --limit 1 \
--node 'https://allora-rpc.testnet.allora.network' | yq -r '.blocks[0].header.time'
2025-05-14T12:08:53.932801787Z
The times are in UTC.
As explained above, to get the beginning of the prediction interval, we need to round this down to a full minute, and to get the end we need to add 8 hours to the result:
Base time: 2025-05-14T12:08:00
Target time: 2025-05-14T20:08:00
We can get the SOL/USD price at this time from services like Tiingo or Binance. We’ll use Binance here because it can be used without an API key. Unfortunately, it’s not available from the US and few other countries. For the base price:
$ date -u -d 2025-05-14T12:08:00 +%s
1747224480
$ curl -s "https://api.binance.com/api/v3/klines?symbol=SOLUSDT&interval=1m&startTime=1747224480000&limit=1" | jq -r '.[0][1]'
181.09000000
And again for the target price:
$ date -u -d 2025-05-14T20:08:00 +%s
1747253280
$ curl -s "https://api.binance.com/api/v3/klines?symbol=SOLUSDT&interval=1m&startTime=1747253280000&limit=1" | jq -r '.[0][1]'
176.81000000
So the base price is $181.09 and the target price is $176.81.
Finally, the topic asks for log-returns. These are computed as log10(target_price) - log10(base_price)
. In this example, we would get around -0.010387. That is the ground truth for the epoch starting at 3834581
.
A related question that often comes up is when an epoch is scored and rewards are distributed. To find that, we just need to add 5200 (ground_truth_lag + epoch_length
rounded up as above) to the nonce height, and convert it to a timestamp. For example 3834581 + 5200 = 3839781
, and
$ allorad q blocks --query "block.height = 3839781" --order_by asc --limit 1 \
--node 'https://allora-rpc.testnet.allora.network' | yq -r '.blocks[0].header.time'
2025-05-14T22:28:19.800426618Z
So this block was scored on May 14 at around 22:28:20 UTC.