public class ScriptHash extends java.lang.Object implements java.lang.Comparable<ScriptHash>
| Constructor and Description |
|---|
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) |
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[] publicKey)
Creates a script hash from the given public key.
|
static ScriptHash |
fromPublicKeys(int signingThreshold,
byte[]... publicKeys)
Creates a script hash from the given public keys and signing threshold.
|
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 |
length()
Gets the length of the script hash byte array.
|
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.
|
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 int length()
public byte[] toArray()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toAddress()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic static ScriptHash fromAddress(java.lang.String address)
address - The address from which to derive the script hash.public static ScriptHash fromPublicKey(byte[] publicKey)
TODO 29.07.19 claude: What form does the public key need to have?
publicKey - The key to calculate the script hash for.public static ScriptHash fromPublicKeys(int signingThreshold, byte[]... publicKeys)
Creates a script hash from the given public keys and signing threshold.
The signing threshold is the number of signatures needed for a valid transaction created with the public keys. It is needed to create the proper verification script.
signingThreshold - The signing threshold.publicKeys - The public keys.public static ScriptHash fromScript(byte[] script)
script - The script to calculate the script hash for.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>