public class Address extends VersionedChecksummedBytes
A Bitcoin address looks like 1MsScoe2fTJoq4ZPdQgqyhgWeoNamYPevy and is derived from an elliptic curve public key
plus a set of network parameters. Not to be confused with a
which are about network (TCP) addresses.
A standard address is built by taking the RIPE-MD160 hash of the public key bytes, with a version prefix and a
checksum suffix, then encoding it textually as base58. The version prefix is used to both denote the network for
which the address is valid (see
NetworkParameters, and also to indicate how the bytes inside the address
should be interpreted. Whilst almost all addresses today are hashes of public keys, another (currently unsupported
type) can contain a hash of a script instead.
|Modifier and Type||Field and Description|
An address is a RIPEMD160 hash of a public key, therefore is always 160 bits or 20 bytes.
|Constructor and Description|
Construct an address from parameters and the hash160 form.
Construct an address from parameters and the standard "human readable" form.
|Modifier and Type||Method and Description|
The (big endian) 20 byte hash that is the core of a Bitcoin address.
Examines the version byte of the address and attempts to find a matching NetworkParameters.
Given an address, examines the version byte and attempts to find a matching NetworkParameters.
equals, getVersion, hashCode, toString
public Address(NetworkParameters params, byte hash160)
new Address(NetworkParameters.prodNet(), Hex.decode("4a22c3c4cbb31e4d03b15550636762bda0baf85a"));
public Address(NetworkParameters params, java.lang.String address) throws AddressFormatException, WrongNetworkException
new Address(NetworkParameters.prodNet(), "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL");
params- The expected NetworkParameters or null if you don't want validation.
address- The textual form of the address, such as "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL"
AddressFormatException- if the given address doesn't parse or the checksum is invalid
WrongNetworkException- if the given address is valid but for a different chain (eg testnet vs prodnet)
public byte getHash160()
public NetworkParameters getParameters()
public static NetworkParameters getParametersFromAddress(java.lang.String address) throws AddressFormatException