Struct ethcore::ethereum::ethash::Ethash
[−]
[src]
pub struct Ethash { /* fields omitted */ }
Engine using Ethash proof-of-work consensus algorithm, suitable for Ethereum mainnet chains in the Olympic, Frontier and Homestead eras.
Methods
impl Ethash
[src]
fn new(params: CommonParams,
ethash_params: EthashParams,
builtins: BTreeMap<Address, Builtin>)
-> Self
ethash_params: EthashParams,
builtins: BTreeMap<Address, Builtin>)
-> Self
Create a new instance of Ethash engine
impl Ethash
[src]
fn boundary_to_difficulty(boundary: &H256) -> U256
Convert an Ethash boundary to its original difficulty. Basically just f(x) = 2^256 / x
.
fn difficulty_to_boundary(difficulty: &U256) -> H256
Convert an Ethash difficulty to the target boundary. Basically just f(x) = 2^256 / x
.
Trait Implementations
impl Engine for Ethash
[src]
fn name(&self) -> &str
The name of this engine.
fn version(&self) -> SemanticVersion
The version of this engine. Should be of the form
fn seal_fields(&self) -> usize
The number of additional header fields required for this engine.
fn params(&self) -> &CommonParams
Get the general parameters of the chain.
fn additional_params(&self) -> HashMap<String, String>
Additional information.
fn builtins(&self) -> &BTreeMap<Address, Builtin>
Builtin-contracts we would like to see in the chain. (In principle these are just hints for the engine since that has the last word on them.) Read more
fn extra_info(&self, header: &Header) -> BTreeMap<String, String>
Additional engine-specific information for the user/developer concerning header
.
fn schedule(&self, env_info: &EnvInfo) -> Schedule
Get the EVM schedule for the given env_info
.
fn signing_network_id(&self, env_info: &EnvInfo) -> Option<u64>
The network ID that transactions should be signed with.
fn populate_from_parent(&self,
header: &mut Header,
parent: &Header,
gas_floor_target: U256,
gas_ceil_target: U256)
header: &mut Header,
parent: &Header,
gas_floor_target: U256,
gas_ceil_target: U256)
Populate a header's fields based on its parent's header. Usually implements the chain scoring rule based on weight. The gas floor target must not be lower than the engine's minimum gas limit. Read more
fn on_new_block(&self, block: &mut ExecutedBlock)
Block transformation functions, before the transactions.
fn on_close_block(&self, block: &mut ExecutedBlock)
Apply the block reward on finalisation of the block. This assumes that all uncles are valid uncles (i.e. of at least one generation before the current).
fn verify_block_basic(&self,
header: &Header,
_block: Option<&[u8]>)
-> Result<(), Error>
header: &Header,
_block: Option<&[u8]>)
-> Result<(), Error>
Phase 1 quick block verification. Only does checks that are cheap. block
(the header's full block) may be provided for additional checks. Returns either a null Ok
or a general error detailing the problem with import. Read more
fn verify_block_unordered(&self,
header: &Header,
_block: Option<&[u8]>)
-> Result<(), Error>
header: &Header,
_block: Option<&[u8]>)
-> Result<(), Error>
Phase 2 verification. Perform costly checks such as transaction signatures. block
(the header's full block) may be provided for additional checks. Returns either a null Ok
or a general error detailing the problem with import. Read more
fn verify_block_family(&self,
header: &Header,
parent: &Header,
_block: Option<&[u8]>)
-> Result<(), Error>
header: &Header,
parent: &Header,
_block: Option<&[u8]>)
-> Result<(), Error>
Phase 3 verification. Check block information against parent and uncles. block
(the header's full block) may be provided for additional checks. Returns either a null Ok
or a general error detailing the problem with import. Read more
fn verify_transaction_basic(&self,
t: &UnverifiedTransaction,
header: &Header)
-> Result<(), Error>
t: &UnverifiedTransaction,
header: &Header)
-> Result<(), Error>
Additional verification for transactions in blocks.
fn maximum_extra_data_size(&self) -> usize
Some intrinsic operation parameters; by default they take their value from the spec()
's engine_params
.
fn maximum_uncle_count(&self) -> usize
Maximum number of uncles a block is allowed to declare.
fn maximum_uncle_age(&self) -> usize
The number of generations back that uncles can be.
fn account_start_nonce(&self) -> U256
The nonce with which accounts begin.
fn is_sealer(&self, _author: &Address) -> Option<bool>
If Some(true) this author is able to generate seals, generate_seal has to be implemented. None indicates that this Engine never seals internally regardless of author (e.g. PoW). Read more
fn is_default_sealer(&self) -> Option<bool>
Checks if default address is able to seal.
fn generate_seal(&self, _block: &ExecutedBlock) -> Seal
Attempt to seal the block internally. Read more
fn verify_transaction(&self,
t: UnverifiedTransaction,
_header: &Header)
-> Result<SignedTransaction, Error>
t: UnverifiedTransaction,
_header: &Header)
-> Result<SignedTransaction, Error>
Verify a particular transaction is valid.
fn verify_block_seal(&self, header: &Header) -> Result<(), Error>
Verify the seal of a block. This is an auxilliary method that actually just calls other verify_
methods to get the job done. By default it must pass verify_basic
and verify_block_unordered
. If more or fewer methods are needed for an Engine, this may be overridden. Read more
fn handle_message(&self, _message: &[u8]) -> Result<(), Error>
Handle any potential consensus messages; updating consensus state and potentially issuing a new one. Read more
fn is_builtin(&self, a: &Address) -> bool
Determine whether a particular address is a builtin contract.
fn cost_of_builtin(&self, a: &Address, input: &[u8]) -> U256
Determine the code execution cost of the builtin contract with address a
. Panics if is_builtin(a)
is not true. Read more
fn execute_builtin(&self, a: &Address, input: &[u8], output: &mut BytesRef)
Execution the builtin contract a
on input
and return output
. Panics if is_builtin(a)
is not true. Read more
fn is_proposal(&self, _verified_header: &Header) -> bool
Find out if the block is a proposal block and should not be inserted into the DB. Takes a header of a fully verified block. Read more
fn set_signer(&self,
_account_provider: Arc<AccountProvider>,
_address: Address,
_password: String)
_account_provider: Arc<AccountProvider>,
_address: Address,
_password: String)
Register an account which signs consensus messages.
fn sign(&self, _hash: H256) -> Result<Signature, Error>
Sign using the EngineSigner, to be used for consensus tx signing.
fn register_client(&self, _client: Weak<Client>)
Add Client which can be used for sealing, querying the state and sending messages.
fn step(&self)
Trigger next step of the consensus engine.
fn stop(&self)
Stops any services that the may hold the Engine and makes it safe to drop.