Learn how SLM.Games trading uses provably fair algorithms to ensure transparent and verifiable price resolution. Every trade result can be independently verified.
All prices for the 24-hour round have been predetermined using a randomly drawn seed that is revealed at the end of each trading round. Using this published seed, anyone can verify that we followed the algorithm described below and that we did not alter any prices after the round's trading began. In particular, it is not possible for us to change prices based on the bets placed by users.
| DATE | TICKS | SEED | HASH |
|---|
At the beginning of a trading round (00:00 UTC), a new 32-byte seed is randomly chosen. All prices for the round can be reproduced by combining this seed with an integer tick counter incrementing from zero.
The seed is first encoded into a 64-character lowercase hexadecimal string and then concatenated with the string representation of the current value of the tick counter. A hash of the combined string is then calculated using the BLAKE2b hash function with a digest size of 256 bits. By using a cryptographic hash function, we've ensured that price changes are random and unpredictable before the seed has been revealed, but after the seed is known, they can be fully reproduced.
The first 8 bytes of the hash are converted to an unsigned 64-bit integer assuming a little-endian encoding. This integer value is converted to a floating point number in the unit range, which will be uniformaly distributed. Using the inverse cumulative distribution function with the market's configured tick volatility (0.1%) as its standard deviation, we then convert the floating point value to a normally distributed return and use that to update the market's price.
Anyone can verify the prices from a trading round after the seed has been revealed. As an example, the following python code calculates the first 5 prices of a round given its seed:
import hashlib
import statistics
price = 1000.0
seed = 'ed0ccb992fe3ac01692def2edd890b4af33328579204e95fd9b47d79429278e0'
volatility = 0.001
print(f'Price at time 0: {price}')
for tick in range(4):
combined_value = bytes(seed + str(tick), encoding='ascii')
hash_val = hashlib.blake2b(combined_value, digest_size=32).digest()
unsigned_int = int.from_bytes(hash_val[:8], byteorder='little', signed=False)
unit_range_float = float(unsigned_int) / float(2**64 - 1)
normal_return = statistics.NormalDist(mu=0.0, sigma=volatility).inv_cdf(unit_range_float)
price = price * (1.0 + normal_return)
print(f'Price at time {tick + 1}: {round(price, 2)}')
The output is:
Price at time 0: 1000.0 Price at time 1: 998.83 Price at time 2: 999.53 Price at time 3: 1000.62 Price at time 4: 998.88 Price at time 5: 997.24