public class TransactionSignature extends ECKey.ECDSASignature
ECKey.ECDSASignature
and adds methods for handling
the additional SIGHASH mode byte that is used.Modifier and Type | Field and Description |
---|---|
int |
sighashFlags
A byte that controls which parts of a transaction are signed.
|
r, s
Constructor and Description |
---|
TransactionSignature(BigInteger r,
BigInteger s)
Constructs a signature with the given components and SIGHASH_ALL.
|
TransactionSignature(ECKey.ECDSASignature signature,
Transaction.SigHash mode,
boolean anyoneCanPay)
Constructs a transaction signature based on the ECDSA signature.
|
Modifier and Type | Method and Description |
---|---|
boolean |
anyoneCanPay() |
static int |
calcSigHashValue(Transaction.SigHash mode,
boolean anyoneCanPay)
Calculates the byte used in the protocol to represent the combination of mode and anyoneCanPay.
|
static TransactionSignature |
decodeFromBitcoin(byte[] bytes,
boolean requireCanonical)
Returns a decoded signature.
|
static TransactionSignature |
dummy()
Returns a dummy invalid signature whose R/S values are set such that they will take up the same number of
encoded bytes as a real signature.
|
byte[] |
encodeToBitcoin()
What we get back from the signer are the two components of a signature, r and s.
|
static boolean |
isEncodingCanonical(byte[] signature)
Returns true if the given signature is has canonical encoding, and will thus be accepted as standard by
the reference client.
|
void |
setSigHash(Transaction.SigHash mode,
boolean anyoneCanPay)
Configures the sighashFlags field as appropriate.
|
Transaction.SigHash |
sigHashMode() |
decodeFromDER, derByteStream, encodeToDER, ensureCanonical
public int sighashFlags
public TransactionSignature(BigInteger r, BigInteger s)
public TransactionSignature(ECKey.ECDSASignature signature, Transaction.SigHash mode, boolean anyoneCanPay)
public static TransactionSignature dummy()
public static int calcSigHashValue(Transaction.SigHash mode, boolean anyoneCanPay)
public static boolean isEncodingCanonical(byte[] signature)
public void setSigHash(Transaction.SigHash mode, boolean anyoneCanPay)
public boolean anyoneCanPay()
public Transaction.SigHash sigHashMode()
public byte[] encodeToBitcoin()
public static TransactionSignature decodeFromBitcoin(byte[] bytes, boolean requireCanonical) throws VerificationException
RuntimeException
- if the signature is invalid or unparseable in some way.VerificationException
Copyright © 2014. All rights reserved.