Skip to content

Address (Class)

A Kaspa blockchain address.

In string form, the Kaspa addresses are represented by a bech32-encoded address string combined with a network type prefix. The bech32 string encoding is comprised of a public key, the public key version and the resulting checksum.

payload property

payload: str

The bech32 encoded payload of the address.

RETURNS DESCRIPTION
str

The payload portion of the address.

TYPE: str

prefix property writable

prefix: str

The network prefix of the address. Prefix is based on the network type (mainnet, testnet, etc..)

RETURNS DESCRIPTION
str

The network prefix string.

TYPE: str

Note
  • Mainnet prefix is kaspa
  • Testnet prefix is kaspatest
  • Simnet prefix is kaspasim
  • Devnet prefix is kaspadev

version property

version: str

The string representation of the address version. Versions are PubKey, PubKeyECDSA, or ScriptHash.

RETURNS DESCRIPTION
str

The address version.

TYPE: str

__eq__

__eq__(other: object) -> bool

__new__

__new__(address: str) -> Address

Create a new Address from a string.

PARAMETER DESCRIPTION
address

A valid Kaspa address string.

TYPE: str

RETURNS DESCRIPTION
Address

A new Address instance.

TYPE: Address

RAISES DESCRIPTION
Exception

If the address string is invalid.

__str__

__str__() -> str

The string representation.

RETURNS DESCRIPTION
str

The address as a string

TYPE: str

short

short(n: int) -> str

Get a shortened representation of the address.

PARAMETER DESCRIPTION
n

The number of characters to show at the start and end of the payload.

TYPE: int

RETURNS DESCRIPTION
str

A shortened address string in the format prefix:start....end.

TYPE: str

to_string

to_string() -> str

The string representation of the Address.

RETURNS DESCRIPTION
str

A bech32 encoded Kaspa address string.

TYPE: str

validate staticmethod

validate(address: str) -> bool

Check if an address string is valid.

PARAMETER DESCRIPTION
address

A Kaspa address string to validate.

TYPE: str

RETURNS DESCRIPTION
bool

True if the address is valid, False otherwise.

TYPE: bool