docs: protected void bitcoinSerializeToStream(OutputStream stream, boolean useSegwit) throws IOException {
          // version
          uint32ToByteStreamLE(version, stream);
          // marker, flag
          if (useSegwit) {
              stream.write(0);
              stream.write(1);
          }
          // txin_count, txins
          stream.write(new VarInt(inputs.size()).encode());
          for (TransactionInput in : inputs)
              in.bitcoinSerialize(stream);
          // txout_count, txouts
          stream.write(new VarInt(outputs.size()).encode());
          for (TransactionOutput out : outputs)
              out.bitcoinSerialize(stream);
          // script_witnisses
          if (useSegwit) {
              for (TransactionInput in : inputs) {
                  in.getWitness().bitcoinSerializeToStream(stream);
              }
          }
          // lock_time
          uint32ToByteStreamLE(lockTime, stream);
      }