There is a lot of advantages of blockchain technology but its transparency, combined with the deterministic nature of computers is a stumbling block in creating true on-chain randomness. Yet, random number generators (RNGs) are essential tools for solving various algorithmic problems. Here we will discuss the approach Oasis has adopted to ensure smart contract developers can integrate randomness into their applications in a hassle-free manner. What is RNG As deterministic machines, computers function by following predictable instructions. So, randomness is never truly possible. However, almost random numbers can be generated with external inputs or complex algorithms. But how feasible is this? Not very. For example, a deterministic RNG can only mimic randomness and produce pseudo-random outputs using algorithms transforming a starting “seed” value into sequences. If the “seed” is known, it all becomes predictable. On the other hand, non-deterministic RNG can generate completely random numbers by using erratic physical phenomena, like dice rolls or photon scattering, as a workaround for the computer reading predictable patterns. Why blockchains need RNG? When you try to replicate RNG in the smart contract framework, it gets interesting. Whether you are developing dApps for the web3 at large or the cryptoAI space, you will need provable fairness or unbiased and tamperproof outcomes based on unpredictable inputs. Even from a core blockchain point of view, RNG plays a crucial role in cryptographic operations. It produces the unique keys or values needed for securing transactions, encrypting data, or authenticating users, ensuring that outputs cannot be guessed or replicated. Without secure on-chain RNG, reverse engineering of keys, outcome manipulation and all kinds of exploits become possible. Now, blockchain technology also use deterministic rules, and all nodes reaching a consensus is a non-negotiable criteria. This makes on-chain randomness tricky but it is still doable. For example, verifiable random functions, commit-reveal schemes, or the method Oasis has adopted — using Verifiable Random Function (VRF) and some other cryptographic primitives. Let’s now take a closer look into Oasis. How Oasis RNG works? With its default focus on smart privacy and scalability, Oasis uses its confidential EVM runtime, Sapphire to streamline RNG through its randomBytes precompile. By abstracting a simple Solidity function, any smart contract developer can integrate randomness into their applications without dealing with the complexities of blockchain RNG. It basically works like this. Generating the Per-Block Root RNG Sapphire communicates with a key manager runtime to generate secret keys. The key manager supports multiple kinds of keys, some of which are long-term and some of which are ephemeral. The ephemeral keys are used for encrypting transactions and also the RNG. To improve security, these keys are never persisted anywhere and are rotated each epoch. This means fresh keys are generated, and after a while, old keys get securely erased and cannot be recovered even if any component is later compromised. The RNG exposed to Sapphire contracts is initialized on every block. Each block uses private ephemeral entropy obtained from the key manager runtime. Only remotely attested Sapphire instances can obtain this private entropy inside the TEE, which ensures that no external observers can learn anything about the RNG state. Next, this entropy is processed and used as a root VRF key. To turn this entropy into a usable key, Sapphire employs SHA-3-derived algorithms like TupleHash, KMAC256, and cSHAKE. These functions process the epoch-specific entropy from the key manager runtime, producing a unique per-block root RNG that anchors all subsequent randomness in the block with consistency and security. Domain Separation for Per-Transaction RNGs The per-block root RNG alone isn’t enough. Each transaction needs its own private RNG, which is where domain separation comes in. Sapphire builds on the key manager’s output by using Merlin transcripts to initialize per-transaction RNGs from the root RNG, customizing randomness for individual interactions using transaction-specific data. This customization is implemented in the Rust Runtime SDK used to build Sapphire, which handles the VRF and domain separation schemes. Together with the key manager’s private entropy, it ensures private, unbiased, and unpredictable outputs are exposed to developers via the randomBytes precompile. Code examples Basic Random Number Generation This snippet shows how to generate a 32-byte random value, ideal for straightforward RNG needs in a dApp like a poker game. bytes memory randomPad = Sapphire.randomBytes(32, ""); Random Number for Signing Key Pair This snippet uses randomBytes to seed a signing key pair generation, which you can use as a part of a more complex RNG-driven mechanism while ensuring cryptographic security. Sapphire.SigningAlg alg = Sapphire.SigningAlg.Ed25519Pure;bytes memory pk;bytes memory sk;(pk, sk) = Sapphire.generateSigningKeyPair(alg, Sapphire.randomBytes(32, "")); Key Resources: Sapphire docsSapphire repositoryrandomBytesOasis ROFLOasis playground for demo dApps Have a question or need help? Join our Discord and head over to the #dev-central channel. Originally published at https://dev.to on September 22, 2025. Secure On-chain Randomness By Oasis Is A Great Way To Answer The Blockchain Need For RNG was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this storyThere is a lot of advantages of blockchain technology but its transparency, combined with the deterministic nature of computers is a stumbling block in creating true on-chain randomness. Yet, random number generators (RNGs) are essential tools for solving various algorithmic problems. Here we will discuss the approach Oasis has adopted to ensure smart contract developers can integrate randomness into their applications in a hassle-free manner. What is RNG As deterministic machines, computers function by following predictable instructions. So, randomness is never truly possible. However, almost random numbers can be generated with external inputs or complex algorithms. But how feasible is this? Not very. For example, a deterministic RNG can only mimic randomness and produce pseudo-random outputs using algorithms transforming a starting “seed” value into sequences. If the “seed” is known, it all becomes predictable. On the other hand, non-deterministic RNG can generate completely random numbers by using erratic physical phenomena, like dice rolls or photon scattering, as a workaround for the computer reading predictable patterns. Why blockchains need RNG? When you try to replicate RNG in the smart contract framework, it gets interesting. Whether you are developing dApps for the web3 at large or the cryptoAI space, you will need provable fairness or unbiased and tamperproof outcomes based on unpredictable inputs. Even from a core blockchain point of view, RNG plays a crucial role in cryptographic operations. It produces the unique keys or values needed for securing transactions, encrypting data, or authenticating users, ensuring that outputs cannot be guessed or replicated. Without secure on-chain RNG, reverse engineering of keys, outcome manipulation and all kinds of exploits become possible. Now, blockchain technology also use deterministic rules, and all nodes reaching a consensus is a non-negotiable criteria. This makes on-chain randomness tricky but it is still doable. For example, verifiable random functions, commit-reveal schemes, or the method Oasis has adopted — using Verifiable Random Function (VRF) and some other cryptographic primitives. Let’s now take a closer look into Oasis. How Oasis RNG works? With its default focus on smart privacy and scalability, Oasis uses its confidential EVM runtime, Sapphire to streamline RNG through its randomBytes precompile. By abstracting a simple Solidity function, any smart contract developer can integrate randomness into their applications without dealing with the complexities of blockchain RNG. It basically works like this. Generating the Per-Block Root RNG Sapphire communicates with a key manager runtime to generate secret keys. The key manager supports multiple kinds of keys, some of which are long-term and some of which are ephemeral. The ephemeral keys are used for encrypting transactions and also the RNG. To improve security, these keys are never persisted anywhere and are rotated each epoch. This means fresh keys are generated, and after a while, old keys get securely erased and cannot be recovered even if any component is later compromised. The RNG exposed to Sapphire contracts is initialized on every block. Each block uses private ephemeral entropy obtained from the key manager runtime. Only remotely attested Sapphire instances can obtain this private entropy inside the TEE, which ensures that no external observers can learn anything about the RNG state. Next, this entropy is processed and used as a root VRF key. To turn this entropy into a usable key, Sapphire employs SHA-3-derived algorithms like TupleHash, KMAC256, and cSHAKE. These functions process the epoch-specific entropy from the key manager runtime, producing a unique per-block root RNG that anchors all subsequent randomness in the block with consistency and security. Domain Separation for Per-Transaction RNGs The per-block root RNG alone isn’t enough. Each transaction needs its own private RNG, which is where domain separation comes in. Sapphire builds on the key manager’s output by using Merlin transcripts to initialize per-transaction RNGs from the root RNG, customizing randomness for individual interactions using transaction-specific data. This customization is implemented in the Rust Runtime SDK used to build Sapphire, which handles the VRF and domain separation schemes. Together with the key manager’s private entropy, it ensures private, unbiased, and unpredictable outputs are exposed to developers via the randomBytes precompile. Code examples Basic Random Number Generation This snippet shows how to generate a 32-byte random value, ideal for straightforward RNG needs in a dApp like a poker game. bytes memory randomPad = Sapphire.randomBytes(32, ""); Random Number for Signing Key Pair This snippet uses randomBytes to seed a signing key pair generation, which you can use as a part of a more complex RNG-driven mechanism while ensuring cryptographic security. Sapphire.SigningAlg alg = Sapphire.SigningAlg.Ed25519Pure;bytes memory pk;bytes memory sk;(pk, sk) = Sapphire.generateSigningKeyPair(alg, Sapphire.randomBytes(32, "")); Key Resources: Sapphire docsSapphire repositoryrandomBytesOasis ROFLOasis playground for demo dApps Have a question or need help? Join our Discord and head over to the #dev-central channel. Originally published at https://dev.to on September 22, 2025. Secure On-chain Randomness By Oasis Is A Great Way To Answer The Blockchain Need For RNG was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story

Secure On-chain Randomness By Oasis Is A Great Way To Answer The Blockchain Need For RNG

2025/09/23 16:40
5 min read

There is a lot of advantages of blockchain technology but its transparency, combined with the deterministic nature of computers is a stumbling block in creating true on-chain randomness. Yet, random number generators (RNGs) are essential tools for solving various algorithmic problems. Here we will discuss the approach Oasis has adopted to ensure smart contract developers can integrate randomness into their applications in a hassle-free manner.

What is RNG

As deterministic machines, computers function by following predictable instructions. So, randomness is never truly possible. However, almost random numbers can be generated with external inputs or complex algorithms. But how feasible is this?

Not very. For example, a deterministic RNG can only mimic randomness and produce pseudo-random outputs using algorithms transforming a starting “seed” value into sequences. If the “seed” is known, it all becomes predictable.

On the other hand, non-deterministic RNG can generate completely random numbers by using erratic physical phenomena, like dice rolls or photon scattering, as a workaround for the computer reading predictable patterns.

Why blockchains need RNG?

When you try to replicate RNG in the smart contract framework, it gets interesting. Whether you are developing dApps for the web3 at large or the cryptoAI space, you will need provable fairness or unbiased and tamperproof outcomes based on unpredictable inputs.

Even from a core blockchain point of view, RNG plays a crucial role in cryptographic operations. It produces the unique keys or values needed for securing transactions, encrypting data, or authenticating users, ensuring that outputs cannot be guessed or replicated. Without secure on-chain RNG, reverse engineering of keys, outcome manipulation and all kinds of exploits become possible.

Now, blockchain technology also use deterministic rules, and all nodes reaching a consensus is a non-negotiable criteria. This makes on-chain randomness tricky but it is still doable. For example, verifiable random functions, commit-reveal schemes, or the method Oasis has adopted — using Verifiable Random Function (VRF) and some other cryptographic primitives. Let’s now take a closer look into Oasis.

How Oasis RNG works?

With its default focus on smart privacy and scalability, Oasis uses its confidential EVM runtime, Sapphire to streamline RNG through its randomBytes precompile. By abstracting a simple Solidity function, any smart contract developer can integrate randomness into their applications without dealing with the complexities of blockchain RNG.

It basically works like this.

Generating the Per-Block Root RNG

  • Sapphire communicates with a key manager runtime to generate secret keys. The key manager supports multiple kinds of keys, some of which are long-term and some of which are ephemeral.
  • The ephemeral keys are used for encrypting transactions and also the RNG. To improve security, these keys are never persisted anywhere and are rotated each epoch. This means fresh keys are generated, and after a while, old keys get securely erased and cannot be recovered even if any component is later compromised.
  • The RNG exposed to Sapphire contracts is initialized on every block. Each block uses private ephemeral entropy obtained from the key manager runtime. Only remotely attested Sapphire instances can obtain this private entropy inside the TEE, which ensures that no external observers can learn anything about the RNG state.
  • Next, this entropy is processed and used as a root VRF key. To turn this entropy into a usable key, Sapphire employs SHA-3-derived algorithms like TupleHash, KMAC256, and cSHAKE. These functions process the epoch-specific entropy from the key manager runtime, producing a unique per-block root RNG that anchors all subsequent randomness in the block with consistency and security.

Domain Separation for Per-Transaction RNGs

  • The per-block root RNG alone isn’t enough. Each transaction needs its own private RNG, which is where domain separation comes in. Sapphire builds on the key manager’s output by using Merlin transcripts to initialize per-transaction RNGs from the root RNG, customizing randomness for individual interactions using transaction-specific data.
  • This customization is implemented in the Rust Runtime SDK used to build Sapphire, which handles the VRF and domain separation schemes. Together with the key manager’s private entropy, it ensures private, unbiased, and unpredictable outputs are exposed to developers via the randomBytes precompile.

Code examples

Basic Random Number Generation
This snippet shows how to generate a 32-byte random value, ideal for straightforward RNG needs in a dApp like a poker game.

bytes memory randomPad = Sapphire.randomBytes(32, "");

Random Number for Signing Key Pair
This snippet uses randomBytes to seed a signing key pair generation, which you can use as a part of a more complex RNG-driven mechanism while ensuring cryptographic security.

Sapphire.SigningAlg alg = Sapphire.SigningAlg.Ed25519Pure;
bytes memory pk;
bytes memory sk;
(pk, sk) = Sapphire.generateSigningKeyPair(alg, Sapphire.randomBytes(32, ""));

Key Resources:

Sapphire docs
Sapphire repository
randomBytes
Oasis ROFL
Oasis playground for demo dApps

Have a question or need help? Join our Discord and head over to the #dev-central channel.

Originally published at https://dev.to on September 22, 2025.


Secure On-chain Randomness By Oasis Is A Great Way To Answer The Blockchain Need For RNG was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.

Disclaimer: The articles reposted on this site are sourced from public platforms and are provided for informational purposes only. They do not necessarily reflect the views of MEXC. All rights remain with the original authors. If you believe any content infringes on third-party rights, please contact service@support.mexc.com for removal. MEXC makes no guarantees regarding the accuracy, completeness, or timeliness of the content and is not responsible for any actions taken based on the information provided. The content does not constitute financial, legal, or other professional advice, nor should it be considered a recommendation or endorsement by MEXC.

You May Also Like

American Bitcoin’s $5B Nasdaq Debut Puts Trump-Backed Miner in Crypto Spotlight

American Bitcoin’s $5B Nasdaq Debut Puts Trump-Backed Miner in Crypto Spotlight

The post American Bitcoin’s $5B Nasdaq Debut Puts Trump-Backed Miner in Crypto Spotlight appeared on BitcoinEthereumNews.com. Key Takeaways: American Bitcoin (ABTC) surged nearly 85% on its Nasdaq debut, briefly reaching a $5B valuation. The Trump family, alongside Hut 8 Mining, controls 98% of the newly merged crypto-mining entity. Eric Trump called Bitcoin “modern-day gold,” predicting it could reach $1 million per coin. American Bitcoin, a fast-rising crypto mining firm with strong political and institutional backing, has officially entered Wall Street. After merging with Gryphon Digital Mining, the company made its Nasdaq debut under the ticker ABTC, instantly drawing global attention to both its stock performance and its bold vision for Bitcoin’s future. Read More: Trump-Backed Crypto Firm Eyes Asia for Bold Bitcoin Expansion Nasdaq Debut: An Explosive First Day ABTC’s first day of trading proved as dramatic as expected. Shares surged almost 85% at the open, touching a peak of $14 before settling at lower levels by the close. That initial spike valued the company around $5 billion, positioning it as one of 2025’s most-watched listings. At the last session, ABTC has been trading at $7.28 per share, which is a small positive 2.97% per day. Although the price has decelerated since opening highs, analysts note that the company has been off to a strong start and early investor activity is a hard-to-find feat in a newly-launched crypto mining business. According to market watchers, the listing comes at a time of new momentum in the digital asset markets. With Bitcoin trading above $110,000 this quarter, American Bitcoin’s entry comes at a time when both institutional investors and retail traders are showing heightened interest in exposure to Bitcoin-linked equities. Ownership Structure: Trump Family and Hut 8 at the Helm Its management and ownership set up has increased the visibility of the company. The Trump family and the Canadian mining giant Hut 8 Mining jointly own 98 percent…
Share
BitcoinEthereumNews2025/09/18 01:33
UBS CEO Targets Direct Crypto Access With “Fast Follower” Tokenization Strategy

UBS CEO Targets Direct Crypto Access With “Fast Follower” Tokenization Strategy

The tension in UBS’s latest strategy update is not between profit and innovation, but between speed and control. On February 4, 2026, as the bank reported a record
Share
Ethnews2026/02/05 04:56
BlackRock boosts AI and US equity exposure in $185 billion models

BlackRock boosts AI and US equity exposure in $185 billion models

The post BlackRock boosts AI and US equity exposure in $185 billion models appeared on BitcoinEthereumNews.com. BlackRock is steering $185 billion worth of model portfolios deeper into US stocks and artificial intelligence. The decision came this week as the asset manager adjusted its entire model suite, increasing its equity allocation and dumping exposure to international developed markets. The firm now sits 2% overweight on stocks, after money moved between several of its biggest exchange-traded funds. This wasn’t a slow shuffle. Billions flowed across multiple ETFs on Tuesday as BlackRock executed the realignment. The iShares S&P 100 ETF (OEF) alone brought in $3.4 billion, the largest single-day haul in its history. The iShares Core S&P 500 ETF (IVV) collected $2.3 billion, while the iShares US Equity Factor Rotation Active ETF (DYNF) added nearly $2 billion. The rebalancing triggered swift inflows and outflows that realigned investor exposure on the back of performance data and macroeconomic outlooks. BlackRock raises equities on strong US earnings The model updates come as BlackRock backs the rally in American stocks, fueled by strong earnings and optimism around rate cuts. In an investment letter obtained by Bloomberg, the firm said US companies have delivered 11% earnings growth since the third quarter of 2024. Meanwhile, earnings across other developed markets barely touched 2%. That gap helped push the decision to drop international holdings in favor of American ones. Michael Gates, lead portfolio manager for BlackRock’s Target Allocation ETF model portfolio suite, said the US market is the only one showing consistency in sales growth, profit delivery, and revisions in analyst forecasts. “The US equity market continues to stand alone in terms of earnings delivery, sales growth and sustainable trends in analyst estimates and revisions,” Michael wrote. He added that non-US developed markets lagged far behind, especially when it came to sales. This week’s changes reflect that position. The move was made ahead of the Federal…
Share
BitcoinEthereumNews2025/09/18 01:44