class PrivateTransaction {

  public void writeTo(final RLPOutput out) {
    out.startList();

    out.writeLongScalar(getNonce());
    out.writeUInt256Scalar(getGasPrice());
    out.writeLongScalar(getGasLimit());
    out.writeBytes(getTo().isPresent() ? getTo().get() : Bytes.EMPTY);
    out.writeUInt256Scalar(getValue());
    out.writeBytes(getPayload());
    writeSignature(out);
    out.writeBytes(getPrivateFrom());
    getPrivateFor()
        .ifPresent(privateFor -> out.writeList(privateFor, (bv, rlpO) -> rlpO.writeBytes(bv)));
    getPrivacyGroupId().ifPresent(out::writeBytes);
    out.writeBytes(getRestriction().getBytes());

    out.endList();
  }

  protected  PrivateTransaction(
      final long nonce,
      final Wei gasPrice,
      final long gasLimit,
      final Optional<Address> to,
      final Wei value,
      final SECP256K1.Signature signature,
      final Bytes payload,
      final Address sender,
      final Optional<BigInteger> chainId,
      final Bytes privateFrom,
      final Optional<List<Bytes>> privateFor,
      final Optional<Bytes> privacyGroupId,
      final Restriction restriction);
  protected  PrivateTransaction(final PrivateTransaction privateTransaction);

}