public async Task <Decimal> CalculateTotalBalanceAccountsInFolderAsync(string rpcAddress, string folder)
        {
            var addresses = new List <string>();

            foreach (var file in Directory.GetFiles(folder))
            {
                var service = new KeyStore.KeyStoreService();
                using (var jsonFile = File.OpenText(file))
                {
                    var json    = jsonFile.ReadToEnd();
                    var address = service.GetAddressFromKeyStore(json);
                    addresses.Add(address);
                }
            }

            return(await CalculateTotalBalanceAccountsAsync(rpcAddress, addresses).ConfigureAwait(false));
        }
        private int RunCommand()
        {
            var sourceFolder = _sourceFolder.Value();

            if (string.IsNullOrWhiteSpace(sourceFolder))
            {
                System.Console.WriteLine("The source folder was not specified");
                return(1);
            }

            var rpcAddress = _rpcAddress.Value();

            if (string.IsNullOrWhiteSpace(rpcAddress))
            {
                System.Console.WriteLine("The rpcAddress was not specified");
                return(1);
            }

            BigInteger balance = 0;

            Web3.Web3 web3 = new Web3.Web3(rpcAddress);
            foreach (var file in Directory.GetFiles(sourceFolder))
            {
                var service = new KeyStore.KeyStoreService();
                using (var jsonFile = File.OpenText(file))
                {
                    var json    = jsonFile.ReadToEnd();
                    var address = service.GetAddressFromKeyStore(json);
                    balance = balance + web3.Eth.GetBalance.SendRequestAsync(address).Result;
                }
            }

            System.Console.WriteLine("Total Balance: " + Web3.Web3.Convert.FromWei(balance));

            return(1);
        }