Skip to main content
Version: Mainnet

Random Number Generator Oracle

The RollApp RNG (Random Number Generator) Oracle is a smart contract deployed on your RollApp that provides verifiable random numbers. This functionality is essential for applications requiring randomness, such as gaming or lottery systems.

Overview

The RNG Oracle consists of:

  • A smart contract deployed on your RollApp
  • An off-chain worker process that generates and submits random numbers
  • Integration with the roller CLI tool for deployment and management
note

The RNG Oracle is currently only available for EVM-compatible RollApps.

Prerequisites

Before deploying the RNG Oracle, ensure you have:

  • A running RollApp full node or sequencer node
  • The roller CLI tool installed
  • Access to the RollApp's admin account

Deployment

Follow these steps to deploy and configure the RNG Oracle:

  1. Deploy the RNG Oracle contract:
roller oracle rng deploy
  1. Start the off-chain worker process using one of these methods:
roller oracle rng start

Contracts API

The RNG Oracle provides a contracts API for interacting with the RNG Oracle contract.

For detailed API documentation on how to use the RNG Oracle, please refer to the RNG Oracle Contracts

Example

for a compelte example and detailed API documentation on how to use the RNG Oracle, please refer to the RNG Oracle Example

Best Practices

  • Always verify the RNG Oracle service is running before relying on it in your applications
  • Monitor the service logs for any potential issues
  • Consider implementing fallback mechanisms in case of service disruption