-
Notifications
You must be signed in to change notification settings - Fork 288
Description
Is your feature request related to a problem? Please describe.
I am the owner of subnet 38 which works with an evm smart contract that needs on-chain unpredictable randomness. Right now, the only practical approach is to read the drand pallet’s storage via the storage precompile (building drand.pulses(round) and LastStoredRound keys). That approach is drand-specific and tied to current storage layout. There is no single, stable, “official” way for contracts to get randomness through chain precompiles directly.
Describe the solution you'd like
Introduce (or formally specify) a randomness precompile in subtensor that:
Exposes a stable, source-agnostic API for EVM contracts, e.g.:
- “Last stored round” (e.g. getLastRound() → uint64)
- “Randomness for round N” (e.g. getRandomness(uint64 round) → bytes32)
Describe alternatives you've considered
-
Uses drand as the backend for now (same semantics as current drand-on-chain behaviour).
-
Keeps the same precompile address and function signatures when the backend is later switched from drand to the new randomness source. Only the internal implementation changes; existing verified contracts continue to work without changes.
Additional context
subnet website link: https://www.taocolosseum.com
subnet smart contract repo link: https://github.com/TAO-Colosseum/tao-colosseum-smart-contract