Access WASM random oracle
This page contains information about a RandomOracle smart contract designed for the Substrate ecosystem.
Overview
The RandomOracle
contract is designed to store random values for different rounds. Each round has an associated RandomData
struct containing a randomness value, a signature, and the previous signature. The contract provides methods for setting random values and retrieving random values for a given round.
Setup
Clone the repository:
Install required tools and dependencies:
Usage
Build the contract:
Deploy contract using this UI
Example
To use the RandomOracle
contract in your own project, follow these steps:
In your own project, add the
random-wasm-oracle
as a dependency. Open your project's Cargo.toml and add the following:
In your project's smart contract, import the necessary modules and types from the
random-wasm-oracle
crate:
In your contract's storage, add a RandomOracleRef field:
In your contract's constructor, add a parameter for the
RandomOracle
contract's address and initialize theRandomOracleRef
:
Implement methods to interact with the
RandomOracle
contract, e.g., getting random values for a specific round:
Build and deploy your contract, providing the
RandomOracle
contract's addresshttps://shibuya.subscan.io/account/Y9YVxsyH8bza5zyK1AVW4iw1r7twVdoXMoDzWwdwraapvSM
when instantiating your contract.Interact with your contract to call the methods that use the
RandomOracle
contract.