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
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:
- Deploy the RNG Oracle contract:
roller oracle rng deploy
- Start the off-chain worker process using one of these methods:
- Interactive Mode
- Systemd Service
roller oracle rng start
- Generate the rng oracle systemd service files
roller oracle rng services load
- Start the service
roller oracle rng services start
- Verify the service is running
journalctl -fu rng
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