Address class

This class abstracts away the internals of address encoding and provides a convenient means to both encode and decode information from a bitcoin address.

Bitcoin addresses are a construct which facilitates interoperability between different wallets. I.e. an agreement amongst wallet providers to have a common means of sharing the hashed public key value needed to send someone bitcoin using one of the standard public-key-based transaction types.

The Address does not contain a public key, only a hashed value of a public key which is derived as explained below.

Bitcoin addresses are not part of the consensus rules of bitcoin.

Bitcoin addresses are encoded as follows

  • 1st byte - indicates the network type which is either MAINNET or TESTNET
  • next 20 bytes - the hash value computed by taking the ripemd160(sha256(PUBLIC_KEY))
  • last 4 bytes - a checksum value taken from the first four bytes of sha256(sha256(previous_21_bytes))

Constructors

Address(String address)
Constructs a new Address object
Address.fromBase58(String base58Address)
Constructs a new Address object from a base58-encoded string.
Address.fromCompressedPubKey(List<int> pubkeyBytes, NetworkType networkType)
Constructs a new Address object from a compressed public key value
Address.fromHex(String hexPubKey, NetworkType networkType)
Constructs a new Address object from a public key.
Address.fromPublicKey(SVPublicKey pubKey, NetworkType networkType)
Constructs a new Address object from the public key
Address.fromScript(SVScript script, NetworkType networkType)
Constructs a new P2SH Address object from a script

Properties

address String
Returns a hash of the Public Key
no setter
addressType AddressType
Returns the type of "standard transaction" this Address is meant to be used for.
no setter
hashCode int
The hash code for this object.
no setterinherited
networkType NetworkType
Returns the specific Network Type that this Address is compatible with
no setter
networkTypes List<NetworkType>
Returns a list of network types supported by this address
no setter
pubkeyHash160 String
An alias for the address property
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBase58() String
Serialise this address object to a base58-encoded string
toHex() String
Returns the public key hash ripemd160(sha256(public_key)) encoded as a hexadecimal string
toString() String
Serialise this address object to a base58-encoded string. This method is an alias for the toBase58() method
override

Operators

operator ==(Object other) bool
The equality operator.
inherited