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); } }