public abstract class Address extends PrefixedChecksummedBytes
Base class for addresses, e.g. native segwit addresses (SegwitAddress) or legacy addresses (LegacyAddress).
Use fromString(NetworkParameters, String) to conveniently construct any kind of address from its textual
form.
bytes, params| Constructor and Description |
|---|
Address(NetworkParameters params,
byte[] bytes) |
| Modifier and Type | Method and Description |
|---|---|
static Address |
fromKey(NetworkParameters params,
ECKey key,
Script.ScriptType outputScriptType)
|
static Address |
fromString(NetworkParameters params,
java.lang.String str)
Construct an address from its textual form.
|
abstract byte[] |
getHash()
Get either the public key hash or script hash that is encoded in the address.
|
abstract Script.ScriptType |
getOutputScriptType()
Get the type of output script that will be used for sending to the address.
|
clone, compareTo, equals, getParameters, hashCodepublic Address(NetworkParameters params, byte[] bytes)
public static Address fromString(@Nullable NetworkParameters params, java.lang.String str) throws AddressFormatException
params - the expected network this address is valid for, or null if the network should be derived from the
textual formstr - the textual form of the address, such as "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL" or
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"AddressFormatException - if the given string doesn't parse or the checksum is invalidAddressFormatException.WrongNetwork - if the given string is valid but not for the expected network (eg testnet vs mainnet)public static Address fromKey(NetworkParameters params, ECKey key, Script.ScriptType outputScriptType)
params - network this address is valid forkey - only the public part is usedoutputScriptType - script type the address should usepublic abstract byte[] getHash()
public abstract Script.ScriptType getOutputScriptType()