public void Start_node()
        {
            using (var loggerFactory = CreateLoggerFactory())
            {
                var cfg  = new NodeOptions("Nodo 1", "1234", 1, 2000, "http://localhost:8000");
                var node = new Node(cfg, new BlockBuilder(), loggerFactory, new PeerChannelInProc());

                try
                {
                    node.Start();
                    int count = 20;
                    while (node.State != NodeState.Running && count-- > 0)
                    {
                        Thread.Sleep(500);
                    }
                    Assert.AreEqual(NodeState.Running, node.State);
                }
                finally
                {
                    node.Stop();
                    int count = 20;
                    while (node.State != NodeState.Stoped && count-- > 0)
                    {
                        Thread.Sleep(500);
                    }
                }
            }
        }
        public void Copiar_blockchain_de_otros_nodos_en_ejecucion_x3_con_5_bloques()
        {
            using (var loggerFactory = CreateLoggerFactory())
            {
                var owner         = CryptoService.Instance.GeneratePair();
                var communityKeys = CryptoService.Instance.GeneratePair();

                var channel = new PeerChannelInProc();
                var node1   = new Node(new NodeOptions("Nodo 1", "1111", 1, 2000, "http://localhost:8001"), new BlockBuilder(), loggerFactory, channel);
                var node2   = new Node(new NodeOptions("Nodo 2", "2222", 1, 2000, "http://localhost:8002"), new BlockBuilder(), loggerFactory, channel);
                var node3   = new Node(new NodeOptions("Mi Nodo", "3333", 1, 2000, "http://localhost:8003"), new BlockBuilder(), loggerFactory, channel);
                channel.Add(node1);
                channel.Add(node2);
                channel.Add(node3);

                node1.Start();

                node2.Start();
                node2.Connect($"http://{host1}:{port1}");
                node2.Syncronize();

                Assert.AreEqual(1, node1.ChainLength);
                Assert.AreEqual(1, node2.ChainLength);

                var community = new Community {
                    Id = Guid.NewGuid(), Name = "My Company", Address = new byte[] { 1, 2, 3 }
                };
                community.SetAddress(communityKeys.PublicKey);

                signer.Sign(community, owner);

                node1.Add(community);
                node1.MinePendingTransactions();

                Assert.AreEqual(2, node1.ChainLength);

                var question = new Question {
                    CommunityId = community.Id, Name = "My Question"
                };
                signer.Sign(question, communityKeys);
                node1.Add(question);
                node1.MinePendingTransactions();

                Assert.AreEqual(3, node1.ChainLength);
                Assert.AreEqual(1, node3.ChainLength);

                node3.Start();
                node3.Connect($"http://{host1}:{port1}");
                Assert.AreEqual(1, node3.Peers.Count);
                node3.Connect($"http://{host2}:{port2}");
                Assert.AreEqual(2, node3.Peers.Count);

                node3.Syncronize();
                Assert.AreEqual(3, node3.ChainLength);
            }
        }