Sitemap
Bapparaj

Bapparaj

2 min readNov 27, 2026

--

๐‘๐ž๐ญ๐ข๐ฎ๐ฆ: ๐‡๐จ๐ฐ ๐’๐ฆ๐š๐ซ๐ญ ๐‚๐จ๐ง๐ญ๐ซ๐š๐œ๐ญ๐ฌ ๐†๐ž๐ญ ๐‘๐š๐ง๐๐จ๐ฆ ๐๐ฎ๐ฆ๐›๐ž๐ซ๐ฌ

Press enter or click to view image in full size

Randomness is an important part of many blockchain applications. It can support unpredictable outcomes, randomized game mechanics, and fair selection processes.

However, smart contracts need to operate consistently across the network. Every validator must be able to reach the same result when executing a contract. This makes generating randomness directly inside a smart contract a technical challenge.

Retium addresses this through a native random-number request system.

Why Smart Contracts Need a Randomness System

Smart contracts are designed to execute according to defined rules. If each validator independently generated a different random number, they could produce different results from the same transaction.

To maintain consistent execution, Retium contracts request randomness from the chain rather than generating their own random values.

This approach allows contracts to use random numbers while preserving the networkโ€™s execution model.

How Retiumโ€™s Random Number Request Works

According to Retiumโ€™s developer documentation, the process follows a specific sequence:

1. Requesting a Number

A smart contract can request a random number through Retiumโ€™s native random module. The request is associated with the transaction that initiated it.

2. Waiting for Finality

The original transaction must become final before the random number is delivered.

Get Bapparajโ€™s stories inย yourย inbox

Join Medium for free to get updates fromย thisย writer.

3. Receiving the Callback

After finality, the chain calls the contract again using the "on_random" action. The contract receives the request identifier and the generated number.

4. Processing the Result

The contract can then use the number in its application logic. Retium provides a callback function that checks and processes the response.

Verifiable Randomness

Retiumโ€™s documentation explains that a keeper reveals a secret associated with the request after the transaction becomes final. The resulting number is recorded on-chain and can be verified.

This creates a way for applications and users to check the random result rather than relying only on an applicationโ€™s own statement.

The documentation also notes an important limitation: the keeper that reveals the number sees it before everyone else. The trustworthiness of the random result therefore depends on the keepers, just as other network activity does.

Designed for Smart Contract Developers

Retiumโ€™s random-number functionality is available through its contract development tools. Developers can request a number, receive it through the callback, and process it within the contractโ€™s normal execution limits.

The feature is documented as live on Retiumโ€™s public testnet since node release 3.0.31.

Final Thoughts

Randomness is a useful building block for decentralized applications, but it must fit the blockchainโ€™s execution and verification rules.

Retiumโ€™s native random-number system connects a contractโ€™s request with a later on-chain callback, allowing applications to use random values while keeping the process tied to the networkโ€™s finality and verification model.

Official documentation: https://docs.retium.org/developers/writing-contracts

--

--