public class ScriptHash extends NeoSerializable implements java.lang.Comparable<ScriptHash>
| Modifier and Type | Field and Description |
|---|---|
static ScriptHash |
ZERO
A zero address script hash.
|
| Constructor and Description |
|---|
ScriptHash()
Constructs a new script hash with 20 zero bytes.
|
ScriptHash(byte[] scriptHash)
Constructs a new script hash from the given byte array.
|
ScriptHash(java.lang.String scriptHash)
Constructs a new script hash from the given hexadecimal string.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(ScriptHash o) |
void |
deserialize(BinaryReader reader) |
boolean |
equals(java.lang.Object o) |
static ScriptHash |
fromAddress(java.lang.String address)
Creates a script hash from the given address.
|
static ScriptHash |
fromPublicKey(byte[] encodedPublicKey) |
static ScriptHash |
fromPublicKeys(java.util.List<byte[]> encodedPublicKeys,
int signingThreshold) |
static ScriptHash |
fromScript(byte[] script)
Creates a script hash from the given script in byte array form.
|
static ScriptHash |
fromScript(java.lang.String script)
Creates a script hash from the given script in hexadecimal string form.
|
int |
getSize()
Gets the byte size of this serializable in serialized form.
|
int |
hashCode() |
void |
serialize(BinaryWriter writer) |
java.lang.String |
toAddress()
Derives the address corresponding to this script hash.
|
byte[] |
toArray()
Gets the script hash as a byte array in little-endian order.
|
java.lang.String |
toString()
Gets the script hash as a hexadecimal string in big-endian order without the '0x' prefix.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitfrom, fromAsListpublic static final ScriptHash ZERO
public ScriptHash()
public ScriptHash(byte[] scriptHash)
scriptHash - The script hash in little-endian order.public ScriptHash(java.lang.String scriptHash)
scriptHash - The script hash in big-endian order.public void deserialize(BinaryReader reader) throws DeserializationException
deserialize in interface NeoSerializableInterfaceDeserializationExceptionpublic void serialize(BinaryWriter writer) throws java.io.IOException
serialize in interface NeoSerializableInterfacejava.io.IOExceptionpublic int getSize()
NeoSerializableInterfacegetSize in interface NeoSerializableInterfacepublic byte[] toArray()
toArray in interface NeoSerializableInterfacepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toAddress()
public static ScriptHash fromAddress(java.lang.String address)
address - The address from which to derive the script hash.public static ScriptHash fromScript(byte[] script)
script - The script to calculate the script hash for.public static ScriptHash fromPublicKey(byte[] encodedPublicKey)
public static ScriptHash fromPublicKeys(java.util.List<byte[]> encodedPublicKeys, int signingThreshold)
public static ScriptHash fromScript(java.lang.String script)
script - The script to calculate the script hash for.public int compareTo(ScriptHash o)
compareTo in interface java.lang.Comparable<ScriptHash>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object