# Struct ethcore::spec::spec::Spec [−] [src]

    pub struct Spec {
        pub name: String,
        pub engine: Arc<Engine>,
        pub data_dir: String,
        pub nodes: Vec<String>,
        pub params: CommonParams,
        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,
        // 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<Engine>`

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.

`params: CommonParams`

Parameters common to all engines.

`parent_hash: H256`

The genesis block's parent hash field.

`author: Address`

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 SHA3_NULL_RLP.

`receipts_root: H256`

Receipts root of the genesis block. Should be SHA3_NULL_RLP.

`extra_data: Bytes`

The genesis block's extra data field.

`seal_rlp: Bytes`

Each seal field, expressed as RLP, concatenated.

## Methods

### `impl Spec`
[src]

#### `fn state_root(&self) -> H256`

Return the state root for the genesis state, memoising accordingly.

#### `fn nodes(&self) -> &[String]`

Get the known knodes of the network in enode format.

#### `fn network_id(&self) -> u64`

Get the configured Network ID.

#### `fn subprotocol_name(&self) -> String`

Get the configured subprotocol name.

#### `fn fork_block(&self) -> Option<(BlockNumber, H256)>`

Get the configured network fork block.

#### `fn genesis_header(&self) -> Header`

Get the header of the genesis block.

#### `fn genesis_block(&self) -> Bytes`

Compose the genesis block for this chain.

#### `fn overwrite_genesis_params(&mut self, g: Genesis)`

Overwrite the genesis components.

#### `fn set_genesis_state(&mut self, s: PodState)`

Alter the value of the genesis state.

#### `fn is_state_root_valid(&self) -> bool`

Returns `false` if the memoized state root is invalid. `true` otherwise.

#### `fn ensure_db_good(&self,
db: StateDB,
factories: &Factories)
-> Result<StateDB, Box<TrieError>>`

Ensure that the given state DB has the trie nodes in for the genesis state.

#### `fn load<R>(reader: R) -> Result<Self, String> where R: Read`

Loads spec from json file.

#### `fn new_test() -> Spec`

Create a new Spec which conforms to the Frontier-era Morden chain except that it's a NullEngine consensus.

#### `fn new_null() -> Spec`

Create a new Spec which is a NullEngine consensus with a premine of address whose secret is sha3('').

#### `fn new_test_constructor() -> Spec`

Create a new Spec which constructs a contract at address 5 with storage at 0 equal to 1.

#### `fn new_instant() -> Spec`

Create a new Spec with InstantSeal consensus which does internal sealing (not requiring work).

#### `fn new_test_round() -> Self`

Create a new Spec with AuthorityRound consensus which does internal sealing (not requiring work). Accounts with secrets "0".sha3() and "1".sha3() are the validators.

#### `fn new_test_tendermint() -> Self`

Create a new Spec with Tendermint consensus which does internal sealing (not requiring work). Account "0".sha3() and "1".sha3() are a authorities.

#### `fn new_validator_safe_contract() -> Self`

TestList.sol used in both specs: https://github.com/ethcore/contracts/pull/30/files Accounts with secrets "0".sha3() and "1".sha3() 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".

#### `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`.

## Trait Implementations

### `impl From<Spec> for Spec`
[src]

#### `fn from(s: Spec) -> Self`

Performs the conversion.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)