[][src]Trait sp_runtime::traits::RandomnessBeacon

pub trait RandomnessBeacon {
    fn random() -> [u8; 32];
}

A type that provides a randomness beacon.

Required methods

fn random() -> [u8; 32]

Returns 32 bytes of random data. The output will change eventually, but is not guaranteed to be different between any two calls.

Security

This MUST NOT be used for gambling, as it can be influenced by a malicious validator in the short term. It MAY be used in many cryptographic protocols, however, so long as one remembers that this (like everything else on-chain) is public. For example, it can be used where a number is needed that cannot have been chosen by an adversary, for purposes such as public-coin zero-knowledge proofs.

Loading content...

Implementors

Loading content...