public ByteBuffer write(ByteBuffer buf) throws BufferOverflowException {
        Coin.valueOf(value).write(buf);
        Buffers.writeLengthPrefixedBytes(buf, scriptBytes);
        return buf;
    }
@Test
    @Parameters(method = "randomOutputs")
    public void write(TransactionOutput output) {
        ByteBuffer buf = ByteBuffer.allocate(output.messageSize());
        output.write(buf);
        assertFalse(buf.hasRemaining());
    }