Esempio n. 1
0
        // retrieve blockchain, can throw if the RPC server is unreachable or RPC credentials are incorrect
        static List <GetBlockResponse> GetBlocks(ICryptocoinService cryptoService)
        {
            List <GetBlockResponse> blocks = new List <GetBlockResponse>();

            try
            {
                string hash = cryptoService.GetBlockHash(0);
                while (!String.IsNullOrEmpty(hash))
                {
                    GetBlockResponse block = cryptoService.GetBlock(hash);
                    blocks.Add(block);
                    hash = block.NextBlockHash;
                }
            }
            catch (Exception e)
            {
                do
                {
                    Console.Error.WriteLine("ERROR -> " + e.Message);
                } while ((e = e.InnerException) != null);

                Environment.Exit(1);
            }

            return(blocks);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public DogecoinClientService()
        {
            if (_useTestNet)
            {
                _daemonUrl = ConfigurationManager.AppSettings.Get("Dogecoin_DaemonUrl_Testnet");
            }
            else
            {
                _daemonUrl = ConfigurationManager.AppSettings.Get("Dogecoin_DaemonUrl");
            }
            _dogecoinClientService = new CryptocoinService(_daemonUrl, _username, _password, _walletPassword);

            StartTimer();
            Log.Debug(string.Format("Dogecoin Timer Started"));
        }