pub struct Spec {Show 16 fields
pub name: String,
pub engine: Arc<dyn 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 base_fee: Option<U256>,
pub hard_forks: BTreeSet<BlockNumber>,
/* private fields */
}
Expand description
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<dyn 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.
base_fee: Option<U256>
Base fee,
hard_forks: BTreeSet<BlockNumber>
List of hard forks in the network.
Implementations
sourceimpl Spec
impl Spec
sourcepub fn state_root(&self) -> H256
pub fn state_root(&self) -> H256
Return the state root for the genesis state, memoising accordingly.
sourcepub fn params(&self) -> &CommonParams
pub fn params(&self) -> &CommonParams
Get common blockchain parameters.
sourcepub fn network_id(&self) -> u64
pub fn network_id(&self) -> u64
Get the configured Network ID.
sourcepub fn subprotocol_name(&self) -> String
pub fn subprotocol_name(&self) -> String
Get the configured subprotocol name.
sourcepub fn fork_block(&self) -> Option<(BlockNumber, H256)>
pub fn fork_block(&self) -> Option<(BlockNumber, H256)>
Get the configured network fork block.
sourcepub fn genesis_header(&self) -> Header
pub fn genesis_header(&self) -> Header
Get the header of the genesis block.
sourcepub fn genesis_block(&self) -> Bytes
pub fn genesis_block(&self) -> Bytes
Compose the genesis block for this chain.
sourcepub fn overwrite_genesis_params(&mut self, g: Genesis)
pub fn overwrite_genesis_params(&mut self, g: Genesis)
Overwrite the genesis components.
sourcepub fn set_genesis_state(&mut self, s: PodState) -> Result<(), Error>
pub fn set_genesis_state(&mut self, s: PodState) -> Result<(), Error>
Alter the value of the genesis state.
sourcepub fn genesis_state(&self) -> &PodState
pub fn genesis_state(&self) -> &PodState
Return genesis state as Plain old data.
sourcepub fn is_state_root_valid(&self) -> bool
pub fn is_state_root_valid(&self) -> bool
Returns false
if the memoized state root is invalid. true
otherwise.
sourcepub fn ensure_db_good<T: Backend>(
&self,
db: T,
factories: &Factories
) -> Result<T, Error>
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.
sourcepub fn load_machine<R: Read>(reader: R) -> Result<EthereumMachine, String>
pub fn load_machine<R: Read>(reader: R) -> Result<EthereumMachine, String>
Loads just the state machine from a json file.
sourcepub fn load<'a, T: Into<SpecParams<'a>>, R>(
params: T,
reader: R
) -> Result<Self, String> where
R: Read,
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.
sourcepub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String>
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String>
initialize genesis epoch data, using in-memory database for constructor.
sourcepub fn new_instant() -> Spec
pub fn new_instant() -> Spec
Create a new Spec with InstantSeal consensus which does internal sealing (not requiring work).
pub fn new_test_round_rewrite_bytecode_transitions() -> Self
Auto Trait Implementations
impl !RefUnwindSafe for Spec
impl Send for Spec
impl Sync for Spec
impl Unpin for Spec
impl !UnwindSafe for Spec
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more