public abstract class Address extends PrefixedChecksummedBytes implements java.lang.Comparable<Address>
SegwitAddress) or legacy addresses (LegacyAddress).
 
 Use fromString(NetworkParameters, String) to conveniently construct any kind of address from its textual
 form.
bytes, params| Modifier | Constructor and Description | 
|---|---|
protected  | 
Address(NetworkParameters params,
       byte[] bytes)
Construct an address from its binary form. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected int | 
compareAddressPartial(Address o)
Comparator for the first two comparison fields in  
Address comparisons, see compareTo(Address). | 
abstract int | 
compareTo(Address o)
Comparison field order for addresses is:
 
      
NetworkParameters.getId()
     Legacy vs. | 
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, equals, getParameters, hashCodeprotected Address(NetworkParameters params, byte[] bytes)
params - the network this address is valid forbytes - the binary address datapublic 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()
public abstract int compareTo(Address o)
NetworkParameters.getId()bytes
 Implementations may use compareAddressPartial for tests 1 and 2.
compareTo in interface java.lang.Comparable<Address>o - other Address objectprotected int compareAddressPartial(Address o)
Address comparisons, see compareTo(Address).
 Used by LegacyAddress.compareTo(Address) and SegwitAddress.compareTo(Address).o - other Address object