pub type ChainSpec = GenericChainSpec<RuntimeGenesisConfig>;
Expand description

Specialized ChainSpec. This is a specialization of the general Substrate ChainSpec type.

Aliased Type§

struct ChainSpec {
    client_spec: ClientSpec<Option<()>>,
    genesis: GenesisSource<RuntimeGenesisConfig>,
    _host_functions: PhantomData<()>,
}

Fields§

§client_spec: ClientSpec<Option<()>>§genesis: GenesisSource<RuntimeGenesisConfig>§_host_functions: PhantomData<()>

Implementations

§

impl<G, E, EHF> ChainSpec<G, E, EHF>

pub fn boot_nodes(&self) -> &[MultiaddrWithPeerId]

A list of bootnode addresses.

pub fn name(&self) -> &str

Spec name.

pub fn id(&self) -> &str

Spec id.

pub fn telemetry_endpoints(&self) -> &Option<TelemetryEndpoints>

Telemetry endpoints (if any)

pub fn protocol_id(&self) -> Option<&str>

Network protocol id.

pub fn fork_id(&self) -> Option<&str>

Optional network fork identifier.

pub fn properties(&self) -> Map<String, Value>

Additional loosly-typed properties of the chain.

Returns an empty JSON object if ‘properties’ not defined in config

pub fn add_boot_node(&mut self, addr: MultiaddrWithPeerId)

Add a bootnode to the list.

pub fn extensions(&self) -> &E

Returns a reference to the defined chain spec extensions.

pub fn extensions_mut(&mut self) -> &mut E

Returns a mutable reference to the defined chain spec extensions.

pub fn from_genesis<F>( name: &str, id: &str, chain_type: ChainType, constructor: F, boot_nodes: Vec<MultiaddrWithPeerId>, telemetry_endpoints: Option<TelemetryEndpoints>, protocol_id: Option<&str>, fork_id: Option<&str>, properties: Option<Map<String, Value>>, extensions: E, code: &[u8] ) -> ChainSpec<G, E, EHF>
where F: Fn() -> G + 'static + Send + Sync,

👎Deprecated: from_genesis is planned to be removed in May 2024. Use builder() instead.

Create hardcoded spec.

pub fn builder(code: &[u8], extensions: E) -> ChainSpecBuilder<G, E, EHF>

Provides a ChainSpec builder.

§

impl<G, E, EHF> ChainSpec<G, E, EHF>

pub fn from_json_bytes( json: impl Into<Cow<'static, [u8]>> ) -> Result<ChainSpec<G, E, EHF>, String>

Parse json content into a ChainSpec

pub fn from_json_file(path: PathBuf) -> Result<ChainSpec<G, E, EHF>, String>

Parse json file into a ChainSpec

§

impl<G, E, EHF> ChainSpec<G, E, EHF>
where G: RuntimeGenesis, E: Serialize + Clone + 'static, EHF: HostFunctions,

pub fn as_json(&self, raw: bool) -> Result<String, String>

Dump the chain specification to JSON string.

Trait Implementations

§

impl<G, E, EHF> Clone for ChainSpec<G, E, EHF>
where E: Clone,

§

fn clone(&self) -> ChainSpec<G, E, EHF>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<G, E, EHF> BuildStorage for ChainSpec<G, E, EHF>
where G: RuntimeGenesis, EHF: HostFunctions,

§

fn assimilate_storage(&self, storage: &mut Storage) -> Result<(), String>

Assimilate the storage for this module into pre-existing overlays.
§

fn build_storage(&self) -> Result<Storage, String>

Build the storage out of this builder.
§

impl<G, E, EHF> ChainSpec for ChainSpec<G, E, EHF>
where G: RuntimeGenesis + 'static, E: GetExtension + Serialize + Clone + Send + Sync + 'static, EHF: HostFunctions,

§

fn boot_nodes(&self) -> &[MultiaddrWithPeerId]

A list of bootnode addresses.
§

fn name(&self) -> &str

Spec name.
§

fn id(&self) -> &str

Spec id.
§

fn chain_type(&self) -> ChainType

Type of the chain.
§

fn telemetry_endpoints(&self) -> &Option<TelemetryEndpoints>

Telemetry endpoints (if any)
§

fn protocol_id(&self) -> Option<&str>

Network protocol id.
§

fn fork_id(&self) -> Option<&str>

Optional network fork identifier. None by default.
§

fn properties(&self) -> Map<String, Value>

Additional loosly-typed properties of the chain. Read more
§

fn add_boot_node(&mut self, addr: MultiaddrWithPeerId)

Add a bootnode to the list.
§

fn extensions(&self) -> &dyn GetExtension

Returns a reference to the defined chain spec extensions.
§

fn extensions_mut(&mut self) -> &mut dyn GetExtension

Returns a mutable reference to the defined chain spec extensions.
§

fn as_json(&self, raw: bool) -> Result<String, String>

Return spec as JSON.
§

fn as_storage_builder(&self) -> &dyn BuildStorage

Return StorageBuilder for this spec.
§

fn cloned_box(&self) -> Box<dyn ChainSpec>

Returns a cloned Box<dyn ChainSpec>.
§

fn set_storage(&mut self, storage: Storage)

Set the storage that should be used by this chain spec. Read more
§

fn code_substitutes(&self) -> BTreeMap<String, Vec<u8>>

Returns code substitutes that should be used for the on chain wasm.