Skip to main content

RNG Coins - Provably Fair

Learn about Moon's RNG Coins

RNG coins are provably fair

RNG coins are simulated markets on Moon. Each symbol prints a new price every **250 milliseconds**, all week long, from a cryptographic seed that is fixed before the week starts.

Because the path is a pure function of that seed, anyone can replay it after the seed is published and confirm that prices were not rewritten around open positions.

How a week works:

Each coin runs on a **Monday–Sunday UTC week**.

| | |

|---|---|

| Week start | Monday 00:00:00.000 UTC |

| Tick interval | 250 ms |

| Ticks per week | 2,419,200 |

| Opening price | the symbol's `basePrice` |

At the start of the week a fresh seed is drawn and stored. Every tick of that week is then derived from `(seed, tick index)` - nothing else. The current week's seed stays private so the rest of the path cannot be predicted. When the week closes, the seed is published in the catalog (the last five completed weeks, current week excluded).

It is then impossible to change any price that was already printed: a different seed would produce a different path.

How a price is generated:

Each symbol has three public parameters:

| Parameter | Meaning |

|---|---|

| `symbol` | ticker name (`ORBT`, `TITN`, …) |

| `basePrice` | opening price of every week; its decimal places are the quote precision |

| `volatility` | maximum fractional move per tick, mapped onto `[-volatility, +volatility]` |

For tick index `i` (starting at `0`):

1. `tickHash = SHA-256("{seed}:{i}")` as a 64-character hex string.

2. `hmac = HMAC-SHA256(key = tickHash, message = symbol)`.

3. Take the first 4 bytes of the HMAC as a big-endian unsigned 32-bit integer `u`.

4. `unit = u / 4,294,967,295` — a value in `[0, 1]`.

5. `move = (2 × unit − 1) × volatility` — a value in `[-volatility, +volatility]`.

6. `price = round(previousPrice × (1 + move), decimals)`.

`decimals` is the number of fractional digits in `basePrice` (trailing zeros do not count: `3000.12` → 2, `2.12345` → 5).

The published tick at index `i` has:

```

timestamp = weekStartUnixMs + i × 250

```

A safety clamp keeps the price strictly positive if a step would hit zero or NaN (`previousPrice × 1e-9`). That does not affect normal trading ranges.
​
​

Verification example:

Anyone can verify the prices from a trading week after the seed has been revealed. As an example, the following Python code calculates the first 5 prices of a week given its seed:

{{script}}

import hashlib

import hmac

price = 3000.12

seed = "b6b6e0a68d0aceae62aea19b05f43330d26e6855c8412914ef569fdafd8d80da"

symbol = "ORBT"

volatility = 0.0001

decimals = 2

print(f"Price at time 0: {price}")

for tick in range(4):

combined = f"{seed}:{tick}".encode("ascii")

server_hash = hashlib.sha256(combined).hexdigest()

digest = hmac.new(

server_hash.encode("ascii"),

symbol.encode("ascii"),

hashlib.sha256,

).digest()

unsigned_int = int.from_bytes(digest[:4], byteorder="big", signed=False)

unit = unsigned_int / float(2**32 - 1)

move = (unit * 2 - 1) * volatility

price = price * (1.0 + move)

print(f"Price at time {tick + 1}: {round(price, decimals)}")

{{/script}}

The output is:

{{result}}

Price at time 0: 3000.12

Price at time 1: 2999.93

Price at time 2: 2999.66

Price at time 3: 2999.44

Price at time 4: 2999.5

{{/result}}

`Price at time 0` is the week's opening `basePrice`. `Price at time 1` is published tick **index 0** (Monday 00:00:00.000 UTC). Swap in a revealed catalog seed, the matching `symbol`, `basePrice`, `volatility`, and `decimals` to replay any completed week.

Symbols:

| Symbol | Name | Base price | Volatility | Decimals |

|---|---|---:|---:|---:|

| `ORBT` | Orbit | 3000.12 | 0.0001 | 2 |

| `TITN` | Titan | 2.12345 | 0.0001 | 5 |

Did this answer your question?