random

package
v0.0.0-...-e667f6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNewRandomnessAndCommitment

func GenerateNewRandomnessAndCommitment(header *types.Header, state vm.StateDB, db *ethdb.Database, seed []byte) (common.Hash, error)

GenerateNewRandomnessAndCommitment generates a new random number and a corresponding commitment. The random number is stored in the database, keyed by the corresponding commitment.

func GetLastRandomness

func GetLastRandomness(coinbase common.Address, db *ethdb.Database, header *types.Header, state vm.StateDB, chain consensus.ChainReader, seed []byte) (common.Hash, error)

GetLastRandomness returns up the last randomness we committed to by first looking up our last commitment in the smart contract, and then finding the corresponding preimage in a (commitment => randomness) mapping we keep in the database.

func IsRunning

func IsRunning() bool

func Random

func Random(header *types.Header, state vm.StateDB) (common.Hash, error)

Random performs an internal call to the EVM to retrieve the current randomness from the official Random contract.

func RevealAndCommit

func RevealAndCommit(randomness, newCommitment common.Hash, proposer common.Address, header *types.Header, state vm.StateDB) error

RevealAndCommit performs an internal call to the EVM that reveals a proposer's previously committed to randomness, and commits new randomness for a future block.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL