๐๐๐ญ๐ข๐ฎ๐ฆ: ๐๐จ๐ฐ ๐๐ฆ๐๐ซ๐ญ ๐๐จ๐ง๐ญ๐ซ๐๐๐ญ๐ฌ ๐๐๐ญ ๐๐๐ง๐๐จ๐ฆ ๐๐ฎ๐ฆ๐๐๐ซ๐ฌ
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









