public void writeTo(final RLPOutput out) {
    rawRlp.ifPresentOrElse(
        out::writeRLPBytes,
        () -> {
          out.startList();

          out.writeBytes(parentHash);
          out.writeBytes(ommersHash);
          out.writeBytes(coinbase);
          out.writeBytes(stateRoot);
          out.writeBytes(transactionsRoot);
          out.writeBytes(receiptsRoot);
          out.writeBytes(logsBloom);
          out.writeUInt256Scalar(difficulty);
          out.writeLongScalar(number);
          out.writeLongScalar(gasLimit);
          out.writeLongScalar(gasUsed);
          out.writeLongScalar(timestamp);
          out.writeBytes(extraData);
          out.writeBytes(mixHashOrPrevRandao);
          out.writeLong(nonce);
          do {
            if (baseFee == null) break;
            out.writeUInt256Scalar(baseFee);

            if (withdrawalsRoot == null) break;
            out.writeBytes(withdrawalsRoot);

            if (excessBlobGas == null || blobGasUsed == null) break;
            out.writeLongScalar(blobGasUsed);
            out.writeUInt64Scalar(excessBlobGas);

            if (parentBeaconBlockRoot == null) break;
            out.writeBytes(parentBeaconBlockRoot);

            if (requestsHash == null) break;
            out.writeBytes(requestsHash);
          } while (false);
          out.endList();
        });
  }
Write an RLP representation.

@param out The RLP output to write to
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java