protected Sha256Hash readHash() throws ProtocolException { // We have to flip it around, as it's been read off the wire in little endian. // Not the most efficient way to do this but the clearest. return Sha256Hash.wrapReversed(readBytes(32)); }
protected Sha256Hash readHash() throws ProtocolException { // We have to flip it around, as it's been read off the wire in little endian. // Not the most efficient way to do this but the clearest. return Sha256Hash.wrapReversed(readBytes(32)); }
protected Sha256Hash readHash() throws ProtocolException { // We have to flip it around, as it's been read off the wire in little endian. // Not the most efficient way to do this but the clearest. return Sha256Hash.wrapReversed(readBytes(32)); }
protected Sha256Hash readHash() throws ProtocolException { // We have to flip it around, as it's been read off the wire in little endian. // Not the most efficient way to do this but the clearest. return Sha256Hash.wrapReversed(readBytes(32)); }
/** * Returns the transaction hash as you see them in the block explorer. */ @Override public Sha256Hash getHash() { if (hash == null) { hash = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(unsafeBitcoinSerialize())); } return hash; }
/** * Make a transaction from the payload. Extension point for alternative * serialization format support. */ @Override public Transaction makeTransaction(byte[] payloadBytes, int offset, int length, byte[] hash) throws ProtocolException { Transaction tx = new Transaction(params, payloadBytes, offset, null, this, length); if (hash != null) tx.setHash(Sha256Hash.wrapReversed(hash)); return tx; }
/** * Make a transaction from the payload. Extension point for alternative * serialization format support. */ @Override public Transaction makeTransaction(byte[] payloadBytes, int offset, int length, byte[] hash) throws ProtocolException { Transaction tx = new Transaction(params, payloadBytes, offset, null, this, length); if (hash != null) tx.setHash(Sha256Hash.wrapReversed(hash)); return tx; }
/** * Returns the transaction hash as you see them in the block explorer. */ @Override public Sha256Hash getHash() { if (hash == null) { hash = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(unsafeBitcoinSerialize())); } return hash; }
/** * Make a transaction from the payload. Extension point for alternative * serialization format support. */ @Override public Transaction makeTransaction(byte[] payloadBytes, int offset, int length, byte[] hash) throws ProtocolException { Transaction tx = new Transaction(params, payloadBytes, offset, null, this, length); if (hash != null) tx.setHash(Sha256Hash.wrapReversed(hash)); return tx; }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */ private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */ private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */ private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */ private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return Sha256Hash.wrapReversed(X11.x11Digest(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
private static Sha256Hash combineLeftRight(byte[] left, byte[] right) { return Sha256Hash.wrapReversed(Sha256Hash.hashTwice( reverseBytes(left), 0, 32, reverseBytes(right), 0, 32)); }
private static Sha256Hash combineLeftRight(byte[] left, byte[] right) { return Sha256Hash.wrapReversed(Sha256Hash.hashTwice( reverseBytes(left), 0, 32, reverseBytes(right), 0, 32)); }
private static Sha256Hash combineLeftRight(byte[] left, byte[] right) { return Sha256Hash.wrapReversed(Sha256Hash.hashTwice( reverseBytes(left), 0, 32, reverseBytes(right), 0, 32)); }
private static Sha256Hash combineLeftRight(byte[] left, byte[] right) { return Sha256Hash.wrapReversed(Sha256Hash.hashTwice( reverseBytes(left), 0, 32, reverseBytes(right), 0, 32)); }
@Override public Sha256Hash getHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HASH_SIZE); Utils.uint32ToByteStreamLE(nSporkID, bos); Utils.int64ToByteStreamLE(nValue, bos); Utils.int64ToByteStreamLE(nTimeSigned, bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
public Sha256Hash getHash(){ try { UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(vchSig.calculateMessageSizeInBytes()+8); vin.bitcoinSerialize(bos); Utils.int64ToByteStreamLE(sigTime, bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice(bos.toByteArray())); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } } }
@Override protected void parse() throws ProtocolException { // header cursor = offset; version = readUint32(); prevBlockHash = readHash(); merkleRoot = readHash(); time = readUint32(); difficultyTarget = readUint32(); nonce = readUint32(); hash = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(payload, offset, cursor - offset)); headerBytesValid = serializer.isParseRetainMode(); // transactions parseTransactions(offset + HEADER_SIZE); length = cursor - offset; }