public async Task <ActionResult> BroadcastTransaction([FromBody] RawTxRequest request)
        {
            Utils.CheckIfChainIsFresh(chain_, config_.AcceptStaleRequests);

            if (string.IsNullOrWhiteSpace(request?.rawtx))
            {
                return(BadRequest("Invalid post body: check structure, or payload size"));
            }

            Transaction tx;

            try
            {
                tx = new Transaction(Constants.TRANSACTION_VERSION_PROTOCOL, request.rawtx);
            }
            catch (Exception e) //TODO Use a BitprimException from bitprim-cs to avoid this
            {
                return(BadRequest("Invalid transaction: " + e.Message));
            }

            try
            {
                var ec = await chain_.OrganizeTransactionAsync(tx);

                if (ec != ErrorCode.Success)
                {
                    return(BadRequest(ec.ToString()));
                }

                return(Json
                       (
                           new BroadcastTransactionResponse
                {
                    txid = new BroadCastTransactionResult
                    {
                        //TODO Check if this should be returned by organize call
                        result = Binary.ByteArrayToHexString(tx.Hash),
                        error = null,
                        id = 0
                    }
                }
                       ));
            }
            catch (Exception e)
            {
                return(StatusCode((int)System.Net.HttpStatusCode.InternalServerError, "Error broadcasting transaction: " + e.Message));
            }
            finally
            {
                tx?.Dispose();
            }
        }