pub enum Network {
Mainnet,
Testnet3,
Testnet4,
Signet,
Regtest,
}Expand description
A supported Bitcoin network.
Variants§
Mainnet
Bitcoin mainnet.
Testnet3
Bitcoin public testnet version 3.
Testnet4
Bitcoin public testnet version 4.
Signet
Bitcoin default signet.
Regtest
Local regression-test network.
Implementations§
Source§impl Network
impl Network
Sourcepub const fn default_p2p_port(self) -> u16
pub const fn default_p2p_port(self) -> u16
Returns the default P2P port.
Sourcepub const fn bip34_activation_height(self) -> u32
pub const fn bip34_activation_height(self) -> u32
Returns the network’s BIP34 coinbase-height activation height.
Per Bitcoin Core’s chainparams.cpp for fixed public networks:
- Mainnet activates at height 227,931
- Testnet3 activates at height 21,111
- Testnet4 / Signet activate at height 1
- This crate’s deterministic regtest default activates at height 500.
Sourcepub const fn bip34_activation_hash(self) -> Option<Hash256>
pub const fn bip34_activation_hash(self) -> Option<Hash256>
Returns the fixed BIP34 activation block hash when Core uses one to prove that BIP34 implies BIP30 on a known chain.
Sourcepub const fn is_bip34_active(self, height: u32) -> bool
pub const fn is_bip34_active(self, height: u32) -> bool
Returns true when BIP34 coinbase-height encoding is enforced at height.
Sourcepub const fn is_bip65_active(self, height: u32) -> bool
pub const fn is_bip65_active(self, height: u32) -> bool
Returns true when BIP65 (OP_CHECKLOCKTIMEVERIFY) is enforced at height.
Per Bitcoin Core’s chainparams.cpp:
- Mainnet activates at height 388,381
- Testnet3 activates at height 581,885
- Testnet4 / Signet activate at height 1
- Regtest activates at height 1,351
Sourcepub const fn is_bip66_active(self, height: u32) -> bool
pub const fn is_bip66_active(self, height: u32) -> bool
Returns true when BIP66 (strict DER signatures) is enforced at height.
Sourcepub const fn is_csv_active(self, height: u32) -> bool
pub const fn is_csv_active(self, height: u32) -> bool
Returns true when CSV (BIP68/112/113 relative locktime + MTP) is enforced at height.
Sourcepub const fn is_segwit_active(self, height: u32) -> bool
pub const fn is_segwit_active(self, height: u32) -> bool
Returns true when Segwit (BIP141/143/147) is enforced at height.
Sourcepub const fn is_taproot_active(self, height: u32) -> bool
pub const fn is_taproot_active(self, height: u32) -> bool
Returns true when Taproot (BIP341/342) is enforced at height.
Sourcepub const fn default_rpc_port(self) -> u16
pub const fn default_rpc_port(self) -> u16
Returns the default JSON-RPC port used by Bitcoin Core.
Sourcepub const fn dns_seeds(self) -> &'static [&'static str]
pub const fn dns_seeds(self) -> &'static [&'static str]
Returns DNS seeds from Bitcoin Core chain parameters.
Sourcepub const fn max_target(self) -> Uint<256, 4>
pub const fn max_target(self) -> Uint<256, 4>
Returns the proof-of-work limit target.
Sourcepub const fn retarget_interval(self) -> u32
pub const fn retarget_interval(self) -> u32
Returns the main retarget interval in blocks.
Sourcepub const fn target_spacing_seconds(self) -> u32
pub const fn target_spacing_seconds(self) -> u32
Returns the proof-of-work target spacing in seconds.
Sourcepub const fn target_timespan_seconds(self) -> u32
pub const fn target_timespan_seconds(self) -> u32
Returns the proof-of-work retarget timespan in seconds.
Sourcepub const fn allow_min_difficulty_blocks(self) -> bool
pub const fn allow_min_difficulty_blocks(self) -> bool
Returns whether non-retarget blocks may use the test-network minimum-difficulty rule.
Sourcepub const fn pow_no_retargeting(self) -> bool
pub const fn pow_no_retargeting(self) -> bool
Returns whether retarget heights keep the previous difficulty unchanged.
Sourcepub const fn enforce_bip94(self) -> bool
pub const fn enforce_bip94(self) -> bool
Returns whether retargeting uses the first block of the period as the base difficulty.
Sourcepub fn genesis_block_hash(self) -> Hash256
pub fn genesis_block_hash(self) -> Hash256
Returns the genesis block hash.
Trait Implementations§
impl Copy for Network
impl Eq for Network
impl StructuralPartialEq for Network
Auto Trait Implementations§
impl Freeze for Network
impl RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl UnsafeUnpin for Network
impl UnwindSafe for Network
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more