コード例 #1
0
        public async Task <Head> GetLatestHead(string url)
        {
            var heads = new List <Head>();

            Console.WriteLine("Start1");


            Parallel.ForEach(urls, item =>
            {
                СlassBlockchainNode classBlockchain = new СlassBlockchainNode(item);

                //_ = classBlockchain.GetHead(item + url);
                Task taskBLockchain = Task.Run(async() => heads.Add(await classBlockchain.GetHead(item + url)));
                taskBLockchain.Wait();
            });

            Console.WriteLine("Hello");

            var latest_node = new Head();

            latest_node = await Task.Run(() => latest_node.ReturnLatestHead(heads));

            //Task.WaitAll();

            return(latest_node);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            string base_url = "https://rpc.tzkt.io/mainnet/";
            string url      = "chains/main/blocks/head/header";
            СlassBlockchainNode classBlockchain = new СlassBlockchainNode(base_url);

            Console.WriteLine("Hello World!");

            _ = new Head();
            Head head = classBlockchain.GetHead(url);

            Console.WriteLine(head.Chain_id);
            Console.ReadKey();
        }