class TransactionResource {

    @ApiOperation(value = "Send private transaction payload")
    @ApiResponses({
        @ApiResponse(code = 200, message = "Encoded Key", response = String.class),
        @ApiResponse(code = 500, message = "Unknown server error")
    })
    @POST
    @Path("sendraw")
    @Consumes(APPLICATION_OCTET_STREAM)
    @Produces(TEXT_PLAIN)
    public Response sendRaw(
            @HeaderParam("c11n-from") final String sender,
            @HeaderParam("c11n-to") final String recipientKeys,
            @NotNull @Size(min = 1) final byte[] payload)
            throws UnsupportedEncodingException {

        PublicKey senderKey = Optional.ofNullable(sender)
            .filter(Predicate.not(String::isEmpty))
            .map(Base64.getDecoder()::decode)
            .map(PublicKey::from)
            .orElseGet(transactionManager::defaultPublicKey);

        List<PublicKey> receipents =
            Stream.of(recipientKeys)
            .filter(Objects::nonNull)
            .filter(s -> !Objects.equals("", s))
            .map(v -> v.split(","))
            .flatMap(Arrays::stream)
            .map(Base64.getDecoder()::decode)
            .map(PublicKey::from).collect(Collectors.toList());

        com.quorum.tessera.transaction.SendRequest request = com.quorum.tessera.transaction.SendRequest.Builder.create()
            .withSender(senderKey)
            .withRecipients(receipents)
            .withPayload(payload)
            .build();

        final com.quorum.tessera.transaction.SendResponse sendResponse = transactionManager.send(request);

        final String encodedTransactionHash =
            Optional.of(sendResponse)
                .map(com.quorum.tessera.transaction.SendResponse::getTransactionHash)
                .map(MessageHash::getHashBytes)
                .map(Base64.getEncoder()::encodeToString).get();

        LOGGER.debug("Encoded key: {}", encodedTransactionHash);

        URI location =
                UriBuilder.fromPath("transaction")
                        .path(URLEncoder.encode(encodedTransactionHash, StandardCharsets.UTF_8.toString()))
                        .build();

        // TODO: Quorum expects only 200 responses. When Quorum can handle a 201, change to CREATED
        return Response.status(Status.OK).entity(encodedTransactionHash).location(location).build();
    }

    public  TransactionResource(TransactionManager transactionManager);

}