com.google.bitcoin.core
Class Address

java.lang.Object
  extended by com.google.bitcoin.core.VersionedChecksummedBytes
      extended by com.google.bitcoin.core.Address

public class Address
extends VersionedChecksummedBytes

A BitCoin address is fundamentally derived from an elliptic curve public key and a set of network parameters. It has several possible representations:

  1. The raw public key bytes themselves.
  2. RIPEMD160 hash of the public key bytes.
  3. A base58 encoded "human form" that includes a version and check code, to guard against typos.

One may question whether the base58 form is really an improvement over the hash160 form, given they are both very unfriendly for typists. More useful representations might include qrcodes and identicons.

Note that an address is specific to a network because the first byte is a discriminator value.


Field Summary
 
Fields inherited from class com.google.bitcoin.core.VersionedChecksummedBytes
bytes, version
 
Constructor Summary
Address(NetworkParameters params, byte[] hash160)
          Construct an address from parameters and the hash160 form.
Address(NetworkParameters params, String address)
          Construct an address from parameters and the standard "human readable" form.
 
Method Summary
 byte[] getHash160()
          The (big endian) 20 byte hash that is the core of a BitCoin address.
 
Methods inherited from class com.google.bitcoin.core.VersionedChecksummedBytes
equals, getVersion, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Address

public Address(NetworkParameters params,
               byte[] hash160)
Construct an address from parameters and the hash160 form. Example:

new Address(NetworkParameters.prodNet(), Hex.decode("4a22c3c4cbb31e4d03b15550636762bda0baf85a"));


Address

public Address(NetworkParameters params,
               String address)
        throws AddressFormatException
Construct an address from parameters and the standard "human readable" form. Example:

new Address(NetworkParameters.prodNet(), "17kzeh4N8g49GFvdDzSf8PjaPfyoD1MndL");

Throws:
AddressFormatException
Method Detail

getHash160

public byte[] getHash160()
The (big endian) 20 byte hash that is the core of a BitCoin address.



Copyright © 2011. All Rights Reserved.