Addresses#
Address#
- class defichain.transactions.address.Address#
- static get_addressType(address: str) -> (<class 'defichain.networks.networks.Network'>, <class 'str'>)#
Analyses the given address and returns the network and the address type
- Parameters:
address – (required) address
- Returns:
(Network, AddressType)
- static from_address(address: str) BaseAddress #
Creates the matching address object for the given address
- Parameters:
address – (requires) address
- Returns:
BaseAddress - returns one of these objects: P2PKH, P2SH, P2WPKH
- static from_scriptPublicKey(network: Any, scriptPublicKey: str) BaseAddress #
Creates the matching address object for the given script public key.
Important: The script public key is universal. The correct network has to be specified to get the wanted address.
- Parameters:
network – (required) Network
scriptPublicKey – (required) script public key
- Returns:
BaseAddress - returns one of these objects: P2PKH, P2SH, P2WPKH
- static verify_address(address: str) bool #
Verifies if the given address is valid.
Raises exception (AddressError) if address is not valid.
- Parameters:
address – (requires) address
- Returns:
bool - returns True if address is valid