NetworkId (Class)¶
Network identifier with optional suffix.
Represents a specific Kaspa network, optionally with a numeric suffix for testnets (e.g., "testnet-10", "testnet-11").
network_type
property
¶
network_type: NetworkType
The base network type (Mainnet, Testnet, Devnet, Simnet).
suffix
property
¶
The optional numeric suffix (e.g., 10 for testnet-10), or None if not set.
__new__
¶
__new__(network_id: Any) -> NetworkId
Create a new NetworkId.
| PARAMETER | DESCRIPTION |
|---|---|
network_id
|
A network string ("mainnet", "testnet-10") or NetworkType.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NetworkId
|
A new NetworkId instance.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
Exception
|
If the network_id format is invalid. |
__str__
¶
The string representation.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The NetworkId as a string
TYPE:
|
address_prefix
¶
Get the address prefix for this network.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The prefix string ("kaspa", "kaspatest", "kaspadev", or "kaspasim").
TYPE:
|
is_mainnet
¶
Check if this is the mainnet.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if this is mainnet, False otherwise.
TYPE:
|
to_prefixed
¶
Get the prefixed string representation (e.g., "kaspa-mainnet").
| RETURNS | DESCRIPTION |
|---|---|
str
|
The prefixed network identifier.
TYPE:
|
to_string
¶
Get the string representation (e.g., "mainnet", "testnet-10").
| RETURNS | DESCRIPTION |
|---|---|
str
|
The network identifier string.
TYPE:
|
with_suffix
staticmethod
¶
with_suffix(network_type: str | NetworkType, suffix: int) -> NetworkId
Create a NetworkId with a specific suffix.
| PARAMETER | DESCRIPTION |
|---|---|
network_type
|
The base network type.
TYPE:
|
suffix
|
The numeric suffix (e.g., 10 for testnet-10).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NetworkId
|
A new NetworkId with the specified suffix.
TYPE:
|