Java Code Examples for com.btchip.utils.BufferUtils#writeUint64LE()

The following examples show how to use com.btchip.utils.BufferUtils#writeUint64LE() . 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: BTChipHWWallet.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
private byte[] outputBytes(final List<InputOutputData> outputs) {
    final ByteArrayOutputStream os = new ByteArrayOutputStream(outputs.size() * (8 + 256));
    putVarInt(os, outputs.size());
    for (final InputOutputData out : outputs) {
        BufferUtils.writeUint64LE(os, out.getSatoshi()); // int64ToByteStreamLE in bitcoinj
        final byte[] script = Wally.hex_to_bytes(out.getScript());
        putVarInt(os, script.length).write(script, 0, script.length);
    }
    return os.toByteArray();
}
 
Example 2
Source File: BTChipHWWallet.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
private byte[] inputBytes(final InputOutputData in, final boolean isSegwit) {
    final ByteArrayOutputStream os = new ByteArrayOutputStream(32 + (isSegwit ? 12 : 4));
    final byte[] txid = in.getTxid();
    os.write(txid, 0, txid.length);
    BufferUtils.writeUint32LE(os, in.getPtIdx());
    if (isSegwit)
        BufferUtils.writeUint64LE(os, in.getSatoshi());
    return os.toByteArray();
}