Class Address

java.lang.Object
com.norswap.nanoeth.data.Address
All Implemented Interfaces:
RLPLayoutable

@Wrapper
public final class Address
extends Object
implements RLPLayoutable
Represents a 160-bit (20 bytes) Ethereum address.
  • Field Details

    • EMPTY

      public static Address EMPTY
      The address the yellow paper denotes as "∅" and is represent by a zero-length byte sequence, unlike all other addresses which are 20-bytes long.

      Not to be confused with ZERO.

      Used as destination for contract creation.

    • ZERO

      public static Address ZERO
      An address composed of 20 zero bytes.

      Not to be confused with EMPTY.

      Used as coinbase for the genesis block.

    • bytes

      public final byte[] bytes
      The big-endian representation of the address. Usually 20-bytes long, zero-length if EMPTY.
  • Constructor Details

    • Address

      public Address​(@Retained byte[] bytes)
    • Address

      public Address​(String hexString)
  • Method Details

    • from

      public static Address from​(String hexString)
      Creates a natural from a hex-string (e.g. "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce").

      If the hex string is empty or simply "0x", then the EMPTY address is returned.

      If the post-0x part of the hex string is not 40 characters long, the address will be padded with zeroes at the start so that it is 20 bytes long.

    • parse

      public static Address parse​(RLP rlp) throws RLPParsingException
      Throws:
      RLPParsingException
    • rlpLayout

      public RLP rlpLayout()
      Description copied from interface: RLPLayoutable
      Returns the RLP layout for the object.
      Specified by:
      rlpLayout in interface RLPLayoutable
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object