@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { vin.bitcoinSerialize(stream); }
/** Returns a copy of the input detached from its containing transaction, if need be. */ public TransactionInput duplicateDetached() { return new TransactionInput(params, null, bitcoinSerialize(), 0); }
/** Returns a copy of the input detached from its containing transaction, if need be. */ public TransactionInput duplicateDetached() { return new TransactionInput(params, null, bitcoinSerialize(), 0); }
/** Returns a copy of the input detached from its containing transaction, if need be. */ public TransactionInput duplicateDetached() { return new TransactionInput(params, null, bitcoinSerialize(), 0); }
/** Returns a copy of the input detached from its containing transaction, if need be. */ public TransactionInput duplicateDetached() { return new TransactionInput(params, null, bitcoinSerialize(), 0); }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { vin.bitcoinSerialize(stream); stream.write(vchSig); int64ToByteStreamLE(sigTime, stream); stream.write(new VarInt(stop ? 1 : 0).encode()); }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { uint32ToByteStreamLE(denom, stream); vin.bitcoinSerialize(stream); int64ToByteStreamLE(time, stream); byte data [] = new byte[1]; data[0] = (byte)(ready ? 1 : 0); stream.write(data); stream.write(new VarInt(vchSig.length).encode()); stream.write(vchSig); }
private void addSuppliedInputs(Transaction tx, List<TransactionInput> originalInputs) { for (TransactionInput input : originalInputs) tx.addInput(new TransactionInput(params, tx, input.bitcoinSerialize())); }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { vin.bitcoinSerialize(stream); stream.write(blockHash.getReversedBytes()); int64ToByteStreamLE(sigTime, stream); vchSig.bitcoinSerialize(stream); }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { uint32ToByteStreamLE(blockHeight, stream); int64ToByteStreamLE(score, stream); vin.bitcoinSerialize(stream); stream.write(new VarInt(vchSig.length).encode()); stream.write(vchSig); }
private void assertInputsEquals(List<TransactionInput> expected, List<TransactionInput> actual) { assertEquals(expected.size(), actual.size()); for (int i = 0; i < expected.size(); i++) { assertArrayEquals(expected.get(i).bitcoinSerialize(), actual.get(i).bitcoinSerialize()); } }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { uint32ToByteStreamLE(version, stream); stream.write(new VarInt(inputs.size()).encode()); for (TransactionInput in : inputs) in.bitcoinSerialize(stream); stream.write(new VarInt(outputs.size()).encode()); for (TransactionOutput out : outputs) out.bitcoinSerialize(stream); uint32ToByteStreamLE(lockTime, stream); }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { uint32ToByteStreamLE(version, stream); stream.write(new VarInt(inputs.size()).encode()); for (TransactionInput in : inputs) in.bitcoinSerialize(stream); stream.write(new VarInt(outputs.size()).encode()); for (TransactionOutput out : outputs) out.bitcoinSerialize(stream); uint32ToByteStreamLE(lockTime, stream); }
private void assertInputsEquals(List<TransactionInput> expected, List<TransactionInput> actual) { assertEquals(expected.size(), actual.size()); for (int i = 0; i < expected.size(); i++) { assertArrayEquals(expected.get(i).bitcoinSerialize(), actual.get(i).bitcoinSerialize()); } }
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. } } }
protected void bitcoinSerializeToStream(OutputStream stream, int transactionOptions) throws IOException { boolean witSupported = (protocolVersion >= NetworkParameters.ProtocolVersion.WITNESS_VERSION.getBitcoinProtocolVersion()) && (transactionOptions & TransactionOptions.WITNESS) != 0; boolean serializeWit = hasWitness() && witSupported; uint32ToByteStreamLE(version, stream); if (serializeWit) { stream.write(new byte[]{0, 1}); } stream.write(new VarInt(inputs.size()).encode()); for (TransactionInput in : inputs) in.bitcoinSerialize(stream); stream.write(new VarInt(outputs.size()).encode()); for (TransactionOutput out : outputs) out.bitcoinSerialize(stream); if (serializeWit) { for (int i = 0; i < inputs.size(); i++) { TransactionWitness witness = getWitness(i); stream.write(new VarInt(witness.getPushCount()).encode()); for (int y = 0; y < witness.getPushCount(); y++) { byte[] push = witness.getPush(y); stream.write(new VarInt(push.length).encode()); stream.write(push); } } } uint32ToByteStreamLE(lockTime, stream); }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { vin.bitcoinSerialize(stream); pubkey.bitcoinSerialize(stream); pubkey2.bitcoinSerialize(stream); stream.write(new VarInt(vchSig.length).encode()); stream.write(vchSig); Utils.int64ToByteStreamLE(sigTime, stream); Utils.uint32ToByteStreamLE(count, stream); Utils.uint32ToByteStreamLE(current, stream); Utils.int64ToByteStreamLE(lastUpdated, stream); Utils.uint32ToByteStreamLE(protocolVersion, stream); }
protected void bitcoinSerializeToStream(OutputStream stream, int transactionOptions) throws IOException { boolean witSupported = (transactionOptions & TransactionOptions.WITNESS) != 0; boolean serializeWit = hasWitness() && witSupported; uint32ToByteStreamLE(version, stream); if (serializeWit) { stream.write(new byte[]{0, 1}); } stream.write(new VarInt(inputs.size()).encode()); for (TransactionInput in : inputs) in.bitcoinSerialize(stream); stream.write(new VarInt(outputs.size()).encode()); for (TransactionOutput out : outputs) out.bitcoinSerialize(stream); if (serializeWit) { for (int i = 0; i < inputs.size(); i++) { TransactionWitness witness = getWitness(i); stream.write(new VarInt(witness.getPushCount()).encode()); for (int y = 0; y < witness.getPushCount(); y++) { byte[] push = witness.getPush(y); stream.write(new VarInt(push.length).encode()); stream.write(push); } } } uint32ToByteStreamLE(lockTime, stream); }
public Sha256Hash getHash() { byte [] dataToHash = new byte[pubKeyCollateralAddress.getBytes().length+8]; Utils.uint32ToByteArrayLE(sigTime, dataToHash, 0); System.arraycopy(pubKeyCollateralAddress.getBytes(), 0, dataToHash, 8, pubKeyCollateralAddress.getBytes().length); try { UnsafeByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(8 + vin.getMessageSize() + pubKeyCollateralAddress.calculateMessageSizeInBytes()); vin.bitcoinSerialize(bos); Utils.int64ToByteStreamLE(sigTime, bos); pubKeyCollateralAddress.bitcoinSerialize(bos); return Sha256Hash.wrapReversed(Sha256Hash.hashTwice((bos.toByteArray()))); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
@Override protected void bitcoinSerializeToStream(OutputStream stream) throws IOException { vin.bitcoinSerialize(stream); address.bitcoinSerialize(stream); pubKeyCollateralAddress.bitcoinSerialize(stream); pubKeyMasternode.bitcoinSerialize(stream); sig.bitcoinSerialize(stream); Utils.int64ToByteStreamLE(sigTime, stream); Utils.uint32ToByteStreamLE(protocolVersion, stream); lastPing.bitcoinSerialize(stream); Utils.int64ToByteStreamLE(nLastDsq, stream); }