Ejemplo n.º 1
0
        public override decimal GetAmount(IAddressBasedTransaction tx)
        {
            if (!(tx is EthereumTransaction ethTx))
            {
                throw new ArgumentException(nameof(tx));
            }

            var gas = ethTx.GasUsed != 0 ? ethTx.GasUsed : ethTx.GasLimit;

            switch (ethTx.Type)
            {
            case EthereumTransaction.UnknownTransaction:
                return(Ethereum.WeiToEth(ethTx.Amount + ethTx.GasPrice * gas));

            case EthereumTransaction.OutputTransaction:
                return(-Ethereum.WeiToEth(ethTx.Amount + ethTx.GasPrice * gas));

            case EthereumTransaction.InputTransaction:
                return(Ethereum.WeiToEth(ethTx.Amount));

            case EthereumTransaction.SelfTransaction:
                return(-Ethereum.WeiToEth(ethTx.GasPrice * gas));

            default:
                return(0);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Print("*Blockchain Parser* version 0.1.2.2");

            if (processPastBlocks(args))
            {
                Ethereum.StartListenNewBlocks((new_block) => {
                    Print("processing block " + new_block.hash);
                    var block_processor = new BlockProcessor();
                    block_processor.onTransactionsTo = processTransactionsTo;
                    block_processor.processBlock(new_block);
                });
                Print("Started service for " + AppConfig.WebsocketNodeUrl + " node listening...");
            }
            while (true)
            {
                Thread.Sleep(1000);
                if (args.Length > 0)
                {
                    break;
                }
            }

            Thread.Sleep(15000);
            Print("Service ended");
        }
Ejemplo n.º 3
0
        public ActionResult Buyer(BuyerViewModel model)
        {
            if (ModelState.IsValid)
            {
                var db         = new ApplicationDbContext();
                var accessCode = db.AccessCodes.SingleOrDefault(AccessCode => AccessCode.BuyerEmail == model.Email);
                ViewBag.AccountNumber = "Not Available";
                ViewBag.AccountName   = "Not Available";

                if (accessCode != null)
                {
                    if (accessCode.UniqueCode == model.AccessCode)
                    {
                        var invoiceAccount = db.InvoiceAccounts.Single(InvoiceAccount => InvoiceAccount.InvoiceAccountId == accessCode.InvoiceAccountId);

                        Task.Run(async() =>
                        {
                            var userId  = User.Identity.GetUserId();
                            var address = db.Companies.Where(a => a.ApplicationUserId == userId).Select(a => a.Address).ToList <string>();
                            var eth     = new Ethereum(address[0]);
                            var result  = await eth.ExecuteContractView("h@ck3r00", accessCode.BuyerEmail, invoiceAccount.AccountNumber);

                            if (result == "Valid account")
                            {
                                ViewBag.AccountNumber = invoiceAccount.AccountNumber;
                                ViewBag.AccountName   = invoiceAccount.AccountName;
                            }
                        }).Wait();
                    }
                }
            }

            return(View());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// The BenchmarkCreateCommandLine
        /// </summary>
        /// <param name="algorithm">The <see cref="Algorithm"/></param>
        /// <param name="time">The <see cref="int"/></param>
        /// <returns>The <see cref="string"/></returns>
        protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int time)
        {
            string CommandLine = GetBenchmarkCommandStringPart(algorithm) + GetDevicesCommandString();

            Ethereum.GetCurrentBlock(CurrentBlockString);
            CommandLine += " --benchmark " + Ethereum.CurrentBlockNum;

            return(CommandLine);
        }
Ejemplo n.º 5
0
 public CallableMethod(string name, string _address, ArrayList _inputs)
 {
     methodName = name;
     address    = _address;
     inputs     = _inputs;
     eth        = GameObject.FindGameObjectWithTag("Eth");
     ethereum   = eth.GetComponent <Ethereum> ();
     buildSignature();
     sha = "";
 }
Ejemplo n.º 6
0
        public ActionResult Index()
        {
            var eth = new Ethereum();

            Task.Run(async() =>
            {
                var BlockNumber     = await eth.GetBlockNum();
                ViewBag.BlockNumber = BlockNumber.Value;
            }).Wait();

            return(View());
        }
        private static decimal GetFee(EthereumTransaction tx)
        {
            var result = 0m;

            if (tx.Type.HasFlag(BlockchainTransactionType.Output))
            {
                result += Ethereum.WeiToEth(tx.GasUsed * tx.GasPrice);
            }

            tx.InternalTxs?.ForEach(t => result += GetFee(t));

            return(result);
        }
 public TetherCurrencyViewModel(Currency currency)
     : base(currency)
 {
     ChainCurrency       = new Ethereum();
     Header              = Currency.Description;
     IconBrush           = new ImageBrush(GetBitmap(PathToImage("tether_90x90.png")));
     IconMaskBrush       = new ImageBrush(GetBitmap(PathToImage("tether_mask.png")));
     AccentColor         = Color.FromRgb(r: 0, g: 162, b: 122);
     AmountColor         = Color.FromRgb(r: 183, g: 208, b: 225);
     UnselectedIconBrush = Brushes.White;
     IconPath            = GetBitmap(PathToImage("tether.png"));
     LargeIconPath       = GetBitmap(PathToImage("tether_90x90.png"));
     FeeName             = Resources.SvGasLimit;
 }
 public TbtcCurrencyViewModel(Currency currency)
     : base(currency)
 {
     ChainCurrency       = new Ethereum();
     Header              = Currency.Description;
     IconBrush           = new ImageBrush(GetBitmap(PathToImage("tbtc_90x90_dark.png")));
     IconMaskBrush       = new ImageBrush(GetBitmap(PathToImage("tbtc_mask.png")));
     AccentColor         = Color.FromRgb(r: 7, g: 82, b: 192);
     AmountColor         = Color.FromRgb(r: 188, g: 212, b: 247);
     UnselectedIconBrush = Brushes.White;
     IconPath            = GetBitmap(PathToImage("tbtc_dark.png"));
     LargeIconPath       = GetBitmap(PathToImage("tbtc_90x90_dark.png"));
     FeeName             = Resources.SvGasLimit;
 }
Ejemplo n.º 10
0
 public static SendViewModel CreateViewModel(
     IAtomexApp app,
     Currency currency)
 {
     return(currency switch
     {
         BitcoinBasedCurrency _ => (SendViewModel) new BitcoinBasedSendViewModel(app, currency),
         ERC20 _ => (SendViewModel) new Erc20SendViewModel(app, currency),
         Ethereum _ => (SendViewModel) new EthereumSendViewModel(app, currency),
         NYX _ => (SendViewModel) new Fa12SendViewModel(app, currency),
         FA2 _ => (SendViewModel) new Fa12SendViewModel(app, currency),
         FA12 _ => (SendViewModel) new Fa12SendViewModel(app, currency),
         Tezos _ => (SendViewModel) new TezosSendViewModel(app, currency),
         _ => throw new NotSupportedException($"Can't create send view model for {currency.Name}. This currency is not supported."),
     });
Ejemplo n.º 11
0
 public static ReceiveViewModel CreateViewModel(
     IAtomexApp app,
     Currency currency)
 {
     return(currency switch
     {
         BitcoinBasedCurrency _ => new ReceiveViewModel(app, currency),
         ERC20 _ => new ReceiveViewModel(app, currency),
         Ethereum _ => new EthereumReceiveViewModel(app, currency),
         NYX _ => new ReceiveViewModel(app, currency),
         FA2 _ => new ReceiveViewModel(app, currency),
         FA12 _ => new ReceiveViewModel(app, currency),
         Tezos _ => new TezosReceiveViewModel(app, currency),
         _ => throw new NotSupportedException($"Can't create receive view model for {currency.Name}. This currency is not supported."),
     });
Ejemplo n.º 12
0
    /*
     *
     * Game Loop
     *
     */

    void Awake()
    {
        //Set up a rigidbody so the player doesn't fall through the world plane, etc
        playerRigidbody = GetComponent <Rigidbody> ();
        //Find and store a reference to the ethereum GameObject
        eth      = GameObject.FindGameObjectWithTag("Eth");
        ethereum = eth.GetComponent <Ethereum> ();
        //We're assuming the player hasn't already unlocked their account via Geth or some such
        accountIsUnlocked = false;
        //Setup UI components
        contractDropdown.captionText.text = "Contracts";
        methodDropdown = methodDropdownParent.GetComponent <Dropdown> ();
        methodDropdown.captionText.text = "Methods";
        //No way to begin the game with an input prompt active
        isEnteringInput = false;
    }
Ejemplo n.º 13
0
        public ActionResult Create(AccessCode model)
        {
            var db = new ApplicationDbContext();

            try
            {
                var accessCode = new AccessCode
                {
                    BuyerEmail       = model.BuyerEmail,
                    InvoiceAccountId = model.InvoiceAccountId,
                    AccessCodeId     = db.AccessCodes.Count() + 1,
                    Confirmed        = "No",
                    UniqueCode       = RandomString(8)
                };

                db.AccessCodes.Add(accessCode);
                db.SaveChanges();

                Task.Run(async() =>
                {
                    var userId        = User.Identity.GetUserId();
                    var address       = db.Companies.Where(a => a.ApplicationUserId == userId).Select(a => a.Address).ToList <string>();
                    var accountNumber = db.InvoiceAccounts.Where(a => a.InvoiceAccountId == model.InvoiceAccountId).Select(a => a.AccountNumber).ToList <string>();
                    var eth           = new Ethereum(address[0]);
                    var result        = await eth.ExecuteContractAuth("h@ck3r00", model.BuyerEmail, accountNumber[0]);

                    if (result == "Buyer Authorised")
                    {
                        accessCode.Confirmed = "Yes";
                        db.AccessCodes.Attach(accessCode);
                        var entry = db.Entry(accessCode);
                        entry.Property(e => e.Confirmed).IsModified = true;
                        db.SaveChanges();
                    }
                });

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 14
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var    eth     = new Ethereum();
                    string address = await eth.NewAccount("h@ck3r00");

                    var db      = new ApplicationDbContext();
                    var company = new Company
                    {
                        CompanyId         = db.Companies.Count() + 1,
                        CompanyName       = model.CompanyName,
                        CVRNumber         = model.CVRNumber,
                        Address           = address,
                        ApplicationUserId = user.Id
                    };
                    db.Companies.Add(company);
                    db.SaveChanges();

                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("Index", "InvoiceAccount"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Ejemplo n.º 15
0
        public ActionResult Create(FormCollection collection)
        {
            var db = new ApplicationDbContext();

            try
            {
                var invoiceAccount = new InvoiceAccount
                {
                    AccountNumber     = collection["AccountNumber"].ToString(),
                    AccountName       = collection["AccountName"].ToString(),
                    ApplicationUserId = User.Identity.GetUserId(),
                    Confirmed         = "No",
                    InvoiceAccountId  = db.InvoiceAccounts.Count() + 1
                };

                db.InvoiceAccounts.Add(invoiceAccount);
                db.SaveChanges();

                Task.Run(async() =>
                {
                    var userId  = User.Identity.GetUserId();
                    var address = db.Companies.Where(a => a.ApplicationUserId == userId).Select(a => a.Address).ToList <string>();
                    var eth     = new Ethereum(address[0]);
                    var result  = await eth.ExecuteContractStore("h@ck3r00", invoiceAccount.AccountNumber, invoiceAccount.AccountName);

                    if (result == "Account registered")
                    {
                        invoiceAccount.Confirmed = "Yes";
                        db.InvoiceAccounts.Attach(invoiceAccount);
                        var entry = db.Entry(invoiceAccount);
                        entry.Property(e => e.Confirmed).IsModified = true;
                        db.SaveChanges();
                    }
                });

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 16
0
        public EthereumERC20TransactionViewModel(EthereumTransaction tx)
            : base(tx, GetAmount(tx), 0)
        {
            From       = tx.From;
            To         = tx.To;
            GasPrice   = Ethereum.WeiToGwei((decimal)tx.GasPrice);
            GasLimit   = (decimal)tx.GasLimit;
            GasUsed    = (decimal)tx.GasUsed;
            IsInternal = tx.IsInternal;

            if (Amount <= 0)
            {
                Alias = tx.To;
            }

            if (Amount > 0)
            {
                Alias = tx.From;
            }
        }
        public async Task <HeaderViewModel> Validate([FromBody] HashDto dto)
        {
            if (_user.IsAuthenticated)
            {
                ViewBag.User = _user.User; ViewBag.Roles = _user.Roles;
            }

            HeaderModel header = SQLData.GetHeaderById(dto.hash);

            UserProfileModel validatorProfile = SQLData.GetProfileById(_user.User);

            header.ValidatorUuid = validatorProfile.Id;
            header.ValidatorName = validatorProfile.Name;

            if (String.IsNullOrEmpty(header.ValidatorLegitimationId) || String.IsNullOrEmpty(header.IssuerUuid))
            {
                header.IssuerUuid = validatorProfile.Id;
                header.IssuerName = validatorProfile.Name;
            }

            header.ValidationCounter = "1";

            string contractAddress  = _configuration["ethContractAddress"];
            string abi              = _configuration["ethAbi"];
            string senderAddress    = _configuration["ethSenderAddress"];
            string senderPrimaryKey = _configuration["ethSenderPK"];

            string ethNode = _configuration["ethNode"];

            Ethereum eth = new Ethereum(contractAddress, abi, senderAddress, senderPrimaryKey, ethNode);

            header = await eth.SendToNetwork(header);

            SQLData.UpdateHeader(header);

            header = SQLData.GetHeaderWithImageById(header.HeaderId);

            return(new HeaderViewModel(header, _configuration));
        }
Ejemplo n.º 18
0
        private static bool processPastBlocks(string[] args)
        {
            var bids_helper  = new LoanBidsHelper();
            var latest_block = bids_helper.getLatestBlock();

            PrePrint("latest block: " + ((latest_block.HasValue) ? latest_block.Value.ToString() : "none"));

            if (args.Length > 0)
            {
                foreach (var block_hash in args)
                {
                    PrePrint("recover block " + block_hash);
                    var block_details   = Ethereum.GetBlockDetails(block_hash);
                    var block_processor = new BlockProcessor();
                    block_processor.onTransactionsTo = processTransactionsTo;
                    block_processor.processBlockDetails(block_details, block_callback: false);
                }
                return(false);
            }
            else if (latest_block.HasValue)
            {
                var block_details = Ethereum.GetBlockDetails((ulong)latest_block.Value);
                while (block_details != null)
                {
                    PrePrint("recover block " + block_details.hash);
                    var block_processor = new BlockProcessor();
                    block_processor.onTransactionsTo = processTransactionsTo;
                    block_processor.processBlockDetails(block_details, block_callback: false);
                    latest_block++;
                    block_details = Ethereum.GetBlockDetails((ulong)latest_block.Value);
                }
                PrePrint("recovering finished on block " + (latest_block - 1));
            }

            return(true);
        }
Ejemplo n.º 19
0
        public async Task <ActionResult> Index()
        {
            //Trim lat and lon

            // new controller route
            var bitcoin = await Models.CryptoProxy.GetCryptoPrice("BTC");

            Bitcoin btc = new Bitcoin();

            btc.price = Convert.ToDecimal(bitcoin.data.amount);
            _context.Add(btc);
            _context.SaveChanges();
            // ViewBag.BitPrice = btc.price;
            // ViewBag.Bitcoin = bitcoin.data.@base;
            var bcash = await Models.CryptoProxy.GetCryptoPrice("BCH");

            BitCoinCash bch = new BitCoinCash();

            bch.price = Convert.ToDecimal(bcash.data.amount);
            _context.Add(bch);
            _context.SaveChanges();
            // ViewBag.BcashPrice = bch.price;
            // ViewBag.Bcash = bcash.data.@base;
            var ethereum = await Models.CryptoProxy.GetCryptoPrice("ETH");

            Ethereum eth = new Ethereum();

            eth.price = Convert.ToDecimal(ethereum.data.amount);
            _context.Add(eth);
            _context.SaveChanges();
            // ViewBag.EthPrice = eth.price;
            // ViewBag.Ethereum = ethereum.data.@base;
            var litecoin = await Models.CryptoProxy.GetCryptoPrice("LTC");

            Litecoin ltc = new Litecoin();

            ltc.price = Convert.ToDecimal(litecoin.data.amount);
            _context.Add(ltc);
            _context.SaveChanges();
            // ViewBag.LitePrice = ltc.price;
            // ViewBag.Litecoin = litecoin.data.@base;
            // return View();



            //  end new controller route

            List <Crypto> monthBt = new List <Crypto>();
            List <string> dates   = new List <string>();

            string[] coins = { "BTC", "BCH", "ETH", "LTC" };
            List <List <Crypto> > allCoins = new List <List <Crypto> >();

            foreach (var coin in coins)
            {
                for (int i = 0; i < 30; i++)
                {
                    DateTime today = DateTime.Now;
                    today = today.AddDays(-i);
                    string date = today.ToString("yyyy-MM-dd");
                    // Console.WriteLine(date);
                    if (dates.Count < 30)
                    {
                        dates.Insert(0, today.ToString("dd"));
                    }
                    var c = await Models.CryptoProxy.GetCryptoMonth(coin, date);

                    monthBt.Add(c);
                }
                allCoins.Add(monthBt);
                monthBt = new List <Crypto>();
            }

            List <List <float> > allFloatCoins = new List <List <float> >();
            List <float>         prices        = new List <float>();

            foreach (var cB in allCoins)
            {
                foreach (var coin in cB)
                {
                    prices.Add(float.Parse(coin.data.amount,
                                           System.Globalization.CultureInfo.InvariantCulture));
                }
                allFloatCoins.Add(prices);
                prices = new List <float>();
            }



            // float min = allFloatCoins[0].First();
            // float max = min;
            // foreach (var p in allFloatCoins[0])
            // {
            //     if (min > p)
            //     {
            //         min = p;
            //     }
            //     if (max < p)
            //     {
            //         max = p;
            //     }
            // }

            // ViewBag.lastWeekMin = allFloatCoins[0].Last();
            // for (int i = 23; i < 30; i++)
            // {
            //     if (ViewBag.lastWeekMin > allFloatCoins[0][i])
            //     {
            //         ViewBag.lastWeekMin = allFloatCoins[0][i];
            //     }


            // }

            // List<Crypto> hoursBt = new List<Crypto>();
            // List<string> hours = new List<string>();
            // // string[] coins = { "BTC", "BCH", "ETH", "LTC" };
            // List<List<Crypto>> hoursAllCoins = new List<List<Crypto>>();

            // for (int i = 0; i < 6; i++)
            // {
            //     int index = _context.bitcoin.Last().id;

            //     if (hours.Count < 6)
            //     {

            //         dates.Insert(0, i.ToString());
            //     }

            //     hoursBt.Add(_context.);
            // }

            int                id         = _context.ethereum.Last().id;
            List <Bitcoin>     bitRecent  = new List <Bitcoin>();
            List <BitCoinCash> cashRecent = new List <BitCoinCash>();
            List <Ethereum>    ethRecent  = new List <Ethereum>();
            List <Litecoin>    liteRecent = new List <Litecoin>();
            List <string>      hours      = new List <string>();

            for (var i = 0; i < 6; i++)
            {
                hours.Insert(0, i.ToString());
                bitRecent.Insert(0, _context.bitcoin.SingleOrDefault(choose => choose.id == id));
                cashRecent.Insert(0, _context.bcash.SingleOrDefault(choose => choose.id == id));
                ethRecent.Insert(0, _context.ethereum.SingleOrDefault(choose => choose.id == id));
                liteRecent.Insert(0, _context.litecoin.SingleOrDefault(choose => choose.id == id));
                id--;
            }



            ViewBag.bitRecent  = bitRecent;
            ViewBag.cashRecent = cashRecent;
            ViewBag.ethRecent  = ethRecent;
            ViewBag.liteRecent = liteRecent;
            ViewBag.hours      = hours;

            ViewBag.BTC = allFloatCoins[0];
            ViewBag.BCH = allFloatCoins[1];
            ViewBag.ETH = allFloatCoins[2];
            ViewBag.LTC = allFloatCoins[3];

            ViewBag.dates = dates;

            // ViewBag.max = max;
            // ViewBag.min = min;
            //ViewBag.btCoins = monthBt;
            //ViewBag.BitPrices = prices;

            ViewBag.Bitcoin = "BTC";
            ViewBag.BCHCurr = "BCH";
            ViewBag.ETHCurr = "ETH";
            ViewBag.LTCCurr = "LTC";
            return(View());
        }
Ejemplo n.º 20
0
        public async Task <ActionResult> Index()
        {
            /////////////////////////////////////////// getting the last update

            var bitcoin = await Models.CryptoProxy.GetCryptoPrice("BTC");

            var bcash = await Models.CryptoProxy.GetCryptoPrice("BCH");

            var ethereum = await Models.CryptoProxy.GetCryptoPrice("ETH");

            var litecoin = await Models.CryptoProxy.GetCryptoPrice("LTC");

            Bitcoin     btc = new Bitcoin();
            Litecoin    ltc = new Litecoin();
            Ethereum    eth = new Ethereum();
            BitCoinCash bch = new BitCoinCash();

            btc.price = Convert.ToDecimal(bitcoin.data.amount);
            bch.price = Convert.ToDecimal(bcash.data.amount);
            eth.price = Convert.ToDecimal(ethereum.data.amount);
            ltc.price = Convert.ToDecimal(litecoin.data.amount);
            _context.Add(btc);
            _context.Add(bch);
            _context.Add(eth);
            _context.Add(ltc);
            _context.SaveChanges();



            ////////////////////////////////////////////// end of getting the last update



            List <FullCoin> fullCoin = new List <FullCoin>();

            List <Crypto> monthBt = new List <Crypto>();
            List <string> dates   = new List <string>();

            string[] coins = { "BTC", "BCH", "ETH", "LTC" };
            List <List <Crypto> > allCoins = new List <List <Crypto> >();


            int                id         = _context.ethereum.Last().id - 1;
            List <Bitcoin>     bitRecent  = new List <Bitcoin>();
            List <BitCoinCash> cashRecent = new List <BitCoinCash>();
            List <Ethereum>    ethRecent  = new List <Ethereum>();
            List <Litecoin>    liteRecent = new List <Litecoin>();
            List <string>      hours      = new List <string>();

            for (var i = 0; i < 12; i++)
            {
                hours.Insert(0, i.ToString());
                bitRecent.Insert(0, _context.bitcoin.SingleOrDefault(choose => choose.id == id));
                cashRecent.Insert(0, _context.bcash.SingleOrDefault(choose => choose.id == id));
                ethRecent.Insert(0, _context.ethereum.SingleOrDefault(choose => choose.id == id));
                liteRecent.Insert(0, _context.litecoin.SingleOrDefault(choose => choose.id == id));
                id -= 60;
            }



            ViewBag.bitRecent  = bitRecent;
            ViewBag.cashRecent = cashRecent;
            ViewBag.ethRecent  = ethRecent;
            ViewBag.liteRecent = liteRecent;
            ViewBag.hours      = hours;



            List <FullCoin> BTC = _context.lastMonthAllCoins.Where(b => b.Currency == "BTC").ToList();
            List <FullCoin> BCH = _context.lastMonthAllCoins.Where(b => b.Currency == "BCH").ToList();
            List <FullCoin> ETH = _context.lastMonthAllCoins.Where(b => b.Currency == "ETH").ToList();
            List <FullCoin> LTC = _context.lastMonthAllCoins.Where(b => b.Currency == "LTC").ToList();



            List <List <FullCoin> > allFullCoinsList = new List <List <FullCoin> >();

            allFullCoinsList.Add(BTC);
            allFullCoinsList.Add(BCH);
            allFullCoinsList.Add(ETH);
            allFullCoinsList.Add(LTC);

            List <List <float> > allFloatCoins = new List <List <float> >();
            List <float>         prices        = new List <float>();


            foreach (var eachList in allFullCoinsList)
            {
                foreach (var coin in eachList)
                {
                    prices.Add(coin.price);
                }
                allFloatCoins.Add(prices);
                prices = new List <float>();
            }



            ViewBag.BTC = allFloatCoins[0];
            ViewBag.BCH = allFloatCoins[1];
            ViewBag.ETH = allFloatCoins[2];
            ViewBag.LTC = allFloatCoins[3];

            for (int i = 0; i < 30; i++)
            {
                DateTime today = DateTime.Now;
                today = today.AddDays(-i);
                string date = today.ToString("yyyy-MM-dd");
                // Console.WriteLine(date);
                if (dates.Count < 30)
                {
                    dates.Insert(0, today.ToString("dd"));
                }
            }



            ViewBag.dates = dates;


            ViewBag.Bitcoin = "BTC";
            ViewBag.BCHCurr = "BCH";
            ViewBag.ETHCurr = "ETH";
            ViewBag.LTCCurr = "LTC";
            return(View());
        }