public MiningBlockInfo GetMiningBlockInfo(string address)
        {
            lock (dbService.GetTransactionsLockObject())
            {
                var transactions = new List <Transaction>(dbService.GetTransactions().ToArray());//shallow copy, so we can keep a snapshot
                var lbi          = dbService.GetLastBlock().Index + 1;

                //reward for the miner
                var t = new Transaction()
                {
                    DateCreated        = DateTime.UtcNow,
                    Fee                = 0,
                    To                 = address,
                    Value              = appSettings.MinerReward + transactions.Aggregate(0, (sum, tr) => sum + tr.Fee),
                    From               = ZERO_HASH,
                    MinedInBlockIndex  = lbi,
                    TransferSuccessful = true
                };

                t.TransactionHashHex = t.CalculateTransactionHashHex();

                transactions.Insert(0, t);

                var info = new MiningBlockInfo
                {
                    Difficulty        = appSettings.Difficulty,
                    Index             = lbi,
                    MinedBy           = address,
                    PreviousBlockHash = dbService.GetLastBlock().BlockHash,
                    Transactions      = transactions
                };

                dbService.AddMiningInfo(info);

                return(MiningBlockInfoResponse.FromMiningBlockInfo(info));
            }
        }