pub struct Consensus {
Show 28 fields pub id: String, pub genesis_block: BlockView, pub genesis_hash: Byte32, pub dao_type_hash: Option<Byte32>, pub secp256k1_blake160_sighash_all_type_hash: Option<Byte32>, pub secp256k1_blake160_multisig_all_type_hash: Option<Byte32>, pub initial_primary_epoch_reward: Capacity, pub secondary_epoch_reward: Capacity, pub max_uncles_num: usize, pub orphan_rate_target: RationalU256, pub epoch_duration_target: u64, pub tx_proposal_window: ProposalWindow, pub proposer_reward_ratio: Ratio, pub pow: Pow, pub cellbase_maturity: EpochNumberWithFraction, pub median_time_block_count: usize, pub max_block_cycles: Cycle, pub max_block_bytes: u64, pub block_version: Version, pub tx_version: Version, pub type_id_code_hash: H256, pub max_block_proposals_limit: u64, pub genesis_epoch_ext: EpochExt, pub satoshi_pubkey_hash: H160, pub satoshi_cell_occupied_ratio: Ratio, pub primary_epoch_reward_halving_interval: EpochNumber, pub permanent_difficulty_in_dummy: bool, pub hardfork_switch: HardForkSwitch,
}
Expand description

Struct Consensus defines various parameters that influence chain consensus

Fields

id: String

Names the network.

genesis_block: BlockView

The genesis block

genesis_hash: Byte32

The genesis block hash

dao_type_hash: Option<Byte32>

The dao type hash

nervos-dao

secp256k1_blake160_sighash_all_type_hash: Option<Byte32>

The secp256k1_blake160_sighash_all_type_hash

SECP256K1/blake160

secp256k1_blake160_multisig_all_type_hash: Option<Byte32>

The secp256k1_blake160_multisig_all_type_hash

SECP256K1/multisig

initial_primary_epoch_reward: Capacity

The initial primary_epoch_reward

token-issuance

secondary_epoch_reward: Capacity

The secondary primary_epoch_reward

token-issuance

max_uncles_num: usize

The maximum amount of uncles allowed for a block

orphan_rate_target: RationalU256

The expected orphan_rate

epoch_duration_target: u64

The expected epoch_duration

tx_proposal_window: ProposalWindow

The two-step-transaction-confirmation proposal window

proposer_reward_ratio: Ratio

The two-step-transaction-confirmation proposer reward ratio

pow: Pow

The pow parameters

cellbase_maturity: EpochNumberWithFraction

The Cellbase maturity For each input, if the referenced output transaction is cellbase, it must have at least cellbase_maturity confirmations; else reject this transaction.

median_time_block_count: usize

This parameter indicates the count of past blocks used in the median time calculation

max_block_cycles: Cycle

Maximum cycles that all the scripts in all the commit transactions can take

max_block_bytes: u64

Maximum number of bytes to use for the entire block

block_version: Version

The block version number supported

tx_version: Version

The tx version number supported

type_id_code_hash: H256

The “TYPE_ID” in hex

max_block_proposals_limit: u64

The Limit to the number of proposals per block

genesis_epoch_ext: EpochExt

The genesis epoch information

satoshi_pubkey_hash: H160

Satoshi’s pubkey hash in Bitcoin genesis.

satoshi_cell_occupied_ratio: Ratio

Ratio of satoshi cell occupied of capacity, only affects genesis cellbase’s satoshi lock cells.

primary_epoch_reward_halving_interval: EpochNumber

Primary reward is cut in half every halving_interval epoch which will occur approximately every 4 years.

permanent_difficulty_in_dummy: bool

Keep difficulty be permanent if the pow is dummy

hardfork_switch: HardForkSwitch

A switch to select hard fork features base on the epoch number.

Implementations

The genesis block

The two-step-transaction-confirmation proposer reward ratio

The two-step-transaction-confirmation block reward delay length

Get block reward finalize number from specified block number

The genesis block hash

The dao type hash

nervos-dao

The secp256k1_blake160_sighash_all_type_hash

SECP256K1/blake160

The secp256k1_blake160_multisig_all_type_hash

SECP256K1/multisig

The maximum amount of uncles allowed for a block

The minimum difficulty (genesis_block difficulty)

The minimum difficulty (genesis_block difficulty)

The initial primary_epoch_reward

token-issuance

Primary reward is cut in half every halving_interval epoch which will occur approximately every 4 years.

The expected epoch_duration

The genesis epoch information

The maximum epoch length

The minimum epoch length

The secondary primary_epoch_reward

token-issuance

The expected orphan_rate

The pow_engine

The permanent_difficulty mode

The cellbase_maturity

This parameter indicates the count of past blocks used in the median time calculation

Maximum cycles that all the scripts in all the commit transactions can take

Maximum number of bytes to use for the entire block

The Limit to the number of proposals per block

The current block version

The current transaction version

The “TYPE_ID” in hex

The two-step-transaction-confirmation proposal window

The network identify name, used for network identify protocol

The secp256k1_blake160_sighash_all code hash

Returns the hardfork switch.

If the CKB block chain specification is for an public chain.

Return true if specifies epoch is between delay window.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

TODO(doc): @quake

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.