Documentation ¶
Index ¶
- func GenerateNewRandomnessAndCommitment(header *types.Header, state vm.StateDB, db *ethdb.Database, seed []byte) (common.Hash, error)
- func GetLastRandomness(coinbase common.Address, db *ethdb.Database, header *types.Header, ...) (common.Hash, error)
- func IsRunning() bool
- func Random(header *types.Header, state vm.StateDB) (common.Hash, error)
- func RevealAndCommit(randomness, newCommitment common.Hash, proposer common.Address, ...) error
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 Random ¶
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.