Java Code Examples for net.bither.bitherj.crypto.TransactionSignature#calcSigHashValue()
The following examples show how to use
net.bither.bitherj.crypto.TransactionSignature#calcSigHashValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Tx.java From bitherj with Apache License 2.0 | 5 votes |
public List<byte[]> getUnsignedInHashes() { List<byte[]> result = new ArrayList<byte[]>(); for (In in : this.getIns()) { byte sigHashType = (byte) TransactionSignature.calcSigHashValue(TransactionSignature .SigHash.ALL, false); result.add(this.hashForSignature(in.getInSn(), in.getPrevOutScript(), sigHashType)); } return result; }
Example 2
Source File: Tx.java From bitherj with Apache License 2.0 | 5 votes |
public List<byte[]> getUnsignedInHashesForHDM(byte[] pubs) { List<byte[]> result = new ArrayList<byte[]>(); for (In in : this.getIns()) { byte sigHashType = (byte) TransactionSignature.calcSigHashValue(TransactionSignature .SigHash.ALL, false); result.add(this.hashForSignature(in.getInSn(), pubs, sigHashType)); } return result; }
Example 3
Source File: Tx.java From bitherj with Apache License 2.0 | 5 votes |
public List<byte[]> getUnsignedInHashesForDesktpHDM(byte[] pubs, int index) { List<byte[]> result = new ArrayList<byte[]>(); In in = this.getIns().get(index); byte sigHashType = (byte) TransactionSignature.calcSigHashValue(TransactionSignature .SigHash.ALL, false); result.add(this.hashForSignature(in.getInSn(), pubs, sigHashType)); return result; }
Example 4
Source File: Tx.java From bitherj with Apache License 2.0 | 3 votes |
/** * <p>Calculates a signature hash, that is, a hash of a simplified form of the transaction. * How exactly the transaction * is simplified is specified by the type and anyoneCanPay parameters.</p> * <p/> * <p>You don't normally ever need to call this yourself. It will become more useful in * future as the contracts * features of Bitcoin are developed.</p> * * @param inputIndex input the signature is being calculated for. Tx signatures are * always relative to an input. * @param connectedScript the bytes that should be in the given input during signing. * @param type Should be SigHash.ALL * @param anyoneCanPay should be false. */ public synchronized byte[] hashForSignature(int inputIndex, byte[] connectedScript, TransactionSignature.SigHash type, boolean anyoneCanPay) { byte sigHashType = (byte) TransactionSignature.calcSigHashValue(type, anyoneCanPay); return hashForSignature(inputIndex, connectedScript, sigHashType); }
Example 5
Source File: Tx.java From bitherj with Apache License 2.0 | 3 votes |
/** * <p>Calculates a signature hash, that is, a hash of a simplified form of the transaction. * How exactly the transaction * is simplified is specified by the type and anyoneCanPay parameters.</p> * <p/> * <p>You don't normally ever need to call this yourself. It will become more useful in * future as the contracts * features of Bitcoin are developed.</p> * * @param inputIndex input the signature is being calculated for. Tx signatures are * always relative to an input. * @param connectedScript the script that should be in the given input during signing. * @param type Should be SigHash.ALL * @param anyoneCanPay should be false. */ public synchronized byte[] hashForSignature(int inputIndex, Script connectedScript, TransactionSignature.SigHash type, boolean anyoneCanPay) { int sigHash = TransactionSignature.calcSigHashValue(type, anyoneCanPay); return hashForSignature(inputIndex, connectedScript.getProgram(), (byte) sigHash); }