Package ch.bitagent.bitcoin.lib.script
Class Script
- java.lang.Object
-
- ch.bitagent.bitcoin.lib.script.Script
-
public class Script extends Object
Script class.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Scriptadd(Script other)add.Stringaddress(Boolean testnet)Returns the address corresponding to the scriptbooleanevaluate(Int z, Script witness)evaluate.List<ScriptCmd>getCmds()Getter for the fieldcmds.booleanisP2pkhScriptPubkey()Returns whether this follows the OP_DUP OP_HASH160 20 byte hash OP_EQUALVERIFY OP_CHECKSIG pattern.booleanisP2shScriptPubkey()Returns whether this follows the OP_HASH160 20 byte hash OP_EQUAL pattern.booleanisP2wpkhScriptPubkey()isP2wpkhScriptPubkey.booleanisP2wpkhStack(Deque<byte[]> stack)isP2wpkhStack.booleanisP2wshScriptPubkey()isP2wshScriptPubkey.booleanisP2wshStack(Deque<byte[]> stack)isP2wshStack.static Scriptp2pkhScript(byte[] h160)Takes a hash160 and returns the p2pkh ScriptPubKeystatic Scriptp2pkhScriptOp20(byte[] h160)https://learnmeabitcoin.com/technical/script/p2pkh/static Scriptp2shScript(byte[] h160)Takes a hash160 and returns the p2sh ScriptPubKeystatic Scriptp2shScriptOp20(byte[] h160)https://learnmeabitcoin.com/technical/script/p2sh/static Scriptp2wpkhScript(byte[] h160)Takes a hash160 and returns the p2wpkh ScriptPubKeystatic Scriptp2wpkhScriptOp20(byte[] h160)https://learnmeabitcoin.com/technical/script/p2wpkh/static Scriptparse(ByteArrayInputStream stream)parse.byte[]serialize()serialize.StringtoHex()toHexStringtoString()
-
-
-
Method Detail
-
p2pkhScript
public static Script p2pkhScript(byte[] h160)
Takes a hash160 and returns the p2pkh ScriptPubKey- Parameters:
h160- an array ofbyteobjects- Returns:
- a
Scriptobject
-
p2pkhScriptOp20
public static Script p2pkhScriptOp20(byte[] h160)
https://learnmeabitcoin.com/technical/script/p2pkh/- Parameters:
h160- .- Returns:
- .
-
p2shScript
public static Script p2shScript(byte[] h160)
Takes a hash160 and returns the p2sh ScriptPubKey- Parameters:
h160- an array ofbyteobjects- Returns:
- a
Scriptobject
-
p2shScriptOp20
public static Script p2shScriptOp20(byte[] h160)
https://learnmeabitcoin.com/technical/script/p2sh/- Parameters:
h160- .- Returns:
- .
-
p2wpkhScript
public static Script p2wpkhScript(byte[] h160)
Takes a hash160 and returns the p2wpkh ScriptPubKey- Parameters:
h160- an array ofbyteobjects- Returns:
- a
Scriptobject
-
p2wpkhScriptOp20
public static Script p2wpkhScriptOp20(byte[] h160)
https://learnmeabitcoin.com/technical/script/p2wpkh/- Parameters:
h160- .- Returns:
- .
-
parse
public static Script parse(ByteArrayInputStream stream)
parse.
- Parameters:
stream- aByteArrayInputStreamobject- Returns:
- a
Scriptobject
-
serialize
public byte[] serialize()
serialize.
- Returns:
- an array of
byteobjects
-
isP2pkhScriptPubkey
public boolean isP2pkhScriptPubkey()
Returns whether this follows the OP_DUP OP_HASH160 20 byte hash OP_EQUALVERIFY OP_CHECKSIG pattern.- Returns:
- a boolean
-
isP2shScriptPubkey
public boolean isP2shScriptPubkey()
Returns whether this follows the OP_HASH160 20 byte hash OP_EQUAL pattern.- Returns:
- a boolean
-
isP2wpkhScriptPubkey
public boolean isP2wpkhScriptPubkey()
isP2wpkhScriptPubkey.
- Returns:
- a boolean
-
isP2wpkhStack
public boolean isP2wpkhStack(Deque<byte[]> stack)
isP2wpkhStack.
- Parameters:
stack- aDequeobject- Returns:
- a boolean
-
isP2wshScriptPubkey
public boolean isP2wshScriptPubkey()
isP2wshScriptPubkey.
- Returns:
- a boolean
-
isP2wshStack
public boolean isP2wshStack(Deque<byte[]> stack)
isP2wshStack.
- Parameters:
stack- aDequeobject- Returns:
- a boolean
-
toHex
public String toHex()
toHex- Returns:
- .
-
-