public async Task <GetWalletBlockResponse> GetBlock(GetWalletBlockRequest request)
        {
            using (var currencyRepo = new Repository <Currency>())
            {
                var currency = await currencyRepo.GetOrDefaultAsync(x => x.Id == request.CurrencyId);

                if (currency == null)
                {
                    Log.Message(LogLevel.Error, "[GetTransaction] - Currency '{0}' not found.", request.CurrencyId);
                    return(null);
                }

                try
                {
                    // var wallet = new WalletConnector("127.0.0.1", 33113, "sa_ddam213.3", "213bit");
                    var wallet    = new WalletConnector(currency.WalletHost, currency.WalletPort, currency.WalletUser, currency.WalletPass);
                    var blockHash = request.BlockHash;
                    if (string.IsNullOrEmpty(blockHash))
                    {
                        blockHash = await wallet.GetBlockHashAsync(request.BlockHeight);
                    }
                    return(new GetWalletBlockResponse {
                        BlockData = await wallet.GetBlockAsync(blockHash.Trim())
                    });
                }
                catch (Exception ex)
                {
                    Log.Exception("[GetBlock] - An exception occured during GetBlock, CurrencyId: {0}.", ex, request.CurrencyId);
                }
                return(null);
            }
        }
        public async Task <List <WalletTransaction> > GetWalletTransactionsSince(TransactionDataType transactionDataType, int currencyId, int walletTimeoutMinutes, int searchBlockLength)
        {
            try
            {
                using (var context = _exchangeDataContextFactory.CreateReadOnlyContext())
                {
                    var currency = await context.Currency.FirstOrDefaultNoLockAsync(c => c.Id == currencyId);

                    var walletConnection = new WalletConnector(currency.WalletHost, currency.WalletPort, currency.WalletUser, currency.WalletPass, Math.Max(walletTimeoutMinutes, 1) * 60000);
                    var blockHash        = await walletConnection.GetBlockHashAsync(searchBlockLength);

                    var walletTransactions = await walletConnection.GetTransactionsAsync(blockHash, transactionDataType);

                    return(walletTransactions.Select(x => new WalletTransaction
                    {
                        Timestamp = x.Time.ToDateTime(),
                        Account = x.Account,
                        Amount = Math.Abs(x.Amount),
                        Txid = x.Txid,
                        Type = Extensions.ToTransactionType(x.Category),
                        Address = x.Address,
                        Confirmations = x.Confirmations
                    })
                           .OrderByDescending(x => x.Timestamp).ToList());
                }
            }
            catch (Exception e)
            {
                _log.Exception("[GetWalletTransactions] - An exception occured while Loading Wallet Transactions", e);
            }

            return(new List <WalletTransaction>());
        }