Struct ethcore::spec::Spec
[−]
[src]
pub struct Spec { pub name: String, pub engine: Arc<EthEngine>, pub data_dir: String, pub nodes: Vec<String>, pub parent_hash: H256, pub author: Address, pub difficulty: U256, pub gas_limit: U256, pub gas_used: U256, pub timestamp: u64, pub transactions_root: H256, pub receipts_root: H256, pub extra_data: Bytes, pub seal_rlp: Bytes, pub hardcoded_sync: Option<SpecHardcodedSync>, // some fields omitted }
Parameters for a block chain; includes both those intrinsic to the design of the chain and those to be interpreted by the active chain engine.
Fields
name: String
User friendly spec name
engine: Arc<EthEngine>
What engine are we using for this?
data_dir: String
Name of the subdir inside the main data dir to use for chain data and settings.
nodes: Vec<String>
Known nodes on the network in enode format.
parent_hash: H256
The genesis block's parent hash field.
The genesis block's author field.
difficulty: U256
The genesis block's difficulty field.
gas_limit: U256
The genesis block's gas limit field.
gas_used: U256
The genesis block's gas used field.
timestamp: u64
The genesis block's timestamp field.
transactions_root: H256
Transactions root of the genesis block. Should be KECCAK_NULL_RLP.
receipts_root: H256
Receipts root of the genesis block. Should be KECCAK_NULL_RLP.
extra_data: Bytes
The genesis block's extra data field.
seal_rlp: Bytes
Each seal field, expressed as RLP, concatenated.
hardcoded_sync: Option<SpecHardcodedSync>
Hardcoded synchronization. Allows the light client to immediately jump to a specific block.
Methods
impl Spec
[src]
impl Spec
pub fn state_root(&self) -> H256
[src]
pub fn state_root(&self) -> H256
Return the state root for the genesis state, memoising accordingly.
pub fn params(&self) -> &CommonParams
[src]
pub fn params(&self) -> &CommonParams
Get common blockchain parameters.
pub fn nodes(&self) -> &[String]
[src]
pub fn nodes(&self) -> &[String]
Get the known knodes of the network in enode format.
pub fn network_id(&self) -> u64
[src]
pub fn network_id(&self) -> u64
Get the configured Network ID.
pub fn chain_id(&self) -> u64
[src]
pub fn chain_id(&self) -> u64
Get the chain ID used for signing.
pub fn subprotocol_name(&self) -> String
[src]
pub fn subprotocol_name(&self) -> String
Get the configured subprotocol name.
pub fn fork_block(&self) -> Option<(BlockNumber, H256)>
[src]
pub fn fork_block(&self) -> Option<(BlockNumber, H256)>
Get the configured network fork block.
pub fn genesis_header(&self) -> Header
[src]
pub fn genesis_header(&self) -> Header
Get the header of the genesis block.
pub fn genesis_block(&self) -> Bytes
[src]
pub fn genesis_block(&self) -> Bytes
Compose the genesis block for this chain.
pub fn overwrite_genesis_params(&mut self, g: Genesis)
[src]
pub fn overwrite_genesis_params(&mut self, g: Genesis)
Overwrite the genesis components.
pub fn set_genesis_state(&mut self, s: PodState) -> Result<(), Error>
[src]
pub fn set_genesis_state(&mut self, s: PodState) -> Result<(), Error>
Alter the value of the genesis state.
pub fn is_state_root_valid(&self) -> bool
[src]
pub fn is_state_root_valid(&self) -> bool
Returns false
if the memoized state root is invalid. true
otherwise.
pub fn ensure_db_good<T: Backend>(
&self,
db: T,
factories: &Factories
) -> Result<T, Error>
[src]
pub fn ensure_db_good<T: Backend>(
&self,
db: T,
factories: &Factories
) -> Result<T, Error>
Ensure that the given state DB has the trie nodes in for the genesis state.
pub fn load_machine<R: Read>(reader: R) -> Result<EthereumMachine, String>
[src]
pub fn load_machine<R: Read>(reader: R) -> Result<EthereumMachine, String>
Loads just the state machine from a json file.
pub fn load<'a, T: Into<SpecParams<'a>>, R>(
params: T,
reader: R
) -> Result<Self, String> where
R: Read,
[src]
pub fn load<'a, T: Into<SpecParams<'a>>, R>(
params: T,
reader: R
) -> Result<Self, String> where
R: Read,
Loads spec from json file. Provide factories for executing contracts and ensuring storage goes to the right place.
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String>
[src]
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String>
initialize genesis epoch data, using in-memory database for constructor.
pub fn new_instant() -> Spec
[src]
pub fn new_instant() -> Spec
Create a new Spec with InstantSeal consensus which does internal sealing (not requiring work).
pub fn new_test() -> Spec
[src]
pub fn new_test() -> Spec
Create a new Spec which conforms to the Frontier-era Morden chain except that it's a NullEngine consensus.
pub fn new_test_machine() -> EthereumMachine
[src]
pub fn new_test_machine() -> EthereumMachine
Create the EthereumMachine corresponding to Spec::new_test.
pub fn new_test_with_reward() -> Spec
[src]
pub fn new_test_with_reward() -> Spec
Create a new Spec which conforms to the Frontier-era Morden chain except that it's a NullEngine consensus with applying reward on block close.
pub fn new_null() -> Spec
[src]
pub fn new_null() -> Spec
Create a new Spec which is a NullEngine consensus with a premine of address whose secret is keccak('').
pub fn new_test_constructor() -> Spec
[src]
pub fn new_test_constructor() -> Spec
Create a new Spec which constructs a contract at address 5 with storage at 0 equal to 1.
pub fn new_test_round() -> Self
[src]
pub fn new_test_round() -> Self
Create a new Spec with AuthorityRound consensus which does internal sealing (not requiring work). Accounts with secrets keccak("0") and keccak("1") are the validators.
pub fn new_test_round_empty_steps() -> Self
[src]
pub fn new_test_round_empty_steps() -> Self
Create a new Spec with AuthorityRound consensus which does internal sealing (not requiring work) with empty step messages enabled. Accounts with secrets keccak("0") and keccak("1") are the validators.
pub fn new_test_round_block_reward_contract() -> Self
[src]
pub fn new_test_round_block_reward_contract() -> Self
Create a new Spec with AuthorityRound consensus (with empty steps) using a block reward contract. The contract source code can be found at: https://github.com/parity-contracts/block-reward/blob/daf7d44383b6cdb11cb6b953b018648e2b027cfb/contracts/ExampleBlockReward.sol
pub fn new_test_tendermint() -> Self
[src]
pub fn new_test_tendermint() -> Self
Create a new Spec with Tendermint consensus which does internal sealing (not requiring work). Account keccak("0") and keccak("1") are a authorities.
pub fn new_validator_safe_contract() -> Self
[src]
pub fn new_validator_safe_contract() -> Self
TestList.sol used in both specs: https://github.com/paritytech/contracts/pull/30/files
Accounts with secrets keccak("0") and keccak("1") are initially the validators.
Create a new Spec with BasicAuthority which uses a contract at address 5 to determine
the current validators using getValidators
.
Second validator can be removed with
"0xbfc708a000000000000000000000000082a978b3f5962a5b0957d9ee9eef472ee55b42f1" and added
back in using
"0x4d238c8e00000000000000000000000082a978b3f5962a5b0957d9ee9eef472ee55b42f1".
pub fn new_validator_contract() -> Self
[src]
pub fn new_validator_contract() -> Self
The same as the safeContract
, but allows reporting and uses AuthorityRound.
Account is marked with reportBenign
it can be checked as disliked with "0xd8f2e0bf".
Validator can be removed with reportMalicious
.
pub fn new_validator_multi() -> Self
[src]
pub fn new_validator_multi() -> Self
Create a new Spec with BasicAuthority which uses multiple validator sets changing with height. Account with secrets keccak("0") is the validator for block 1 and with keccak("1") onwards.