Пример #1
0
        static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddCore();
            serviceCollection.AddInMemory();
            var serviceProvider     = serviceCollection.BuildServiceProvider();
            var nodeLauncherFactory = serviceProvider.GetService <INodeLauncherFactory>();

            Console.Title = "FULL NODE / MINER";
            Console.WriteLine("==== Welcome to SimpleBlockChain (FULL NODE) ====");
            _ipBytes = IPAddress.Parse("192.168.76.131").MapToIPv6().GetAddressBytes();
            var network = MenuHelper.ChooseNetwork();

            _nodeLauncher = nodeLauncherFactory.Build(network, ServiceFlags.NODE_NETWORK);
            var p2pNode = _nodeLauncher.GetP2PNode();

            p2pNode.StartNodeEvent           += StartP2PNodeEvent;
            p2pNode.StopNodeEvent            += StopP2PNodeEvent;
            p2pNode.NewMessageEvent          += NewMessageP2PEvent;
            _nodeLauncher.ConnectP2PEvent    += ConnectP2PEvent;
            _nodeLauncher.DisconnectP2PEvent += DisconnectP2PEvent;
            _nodeLauncher.LaunchP2PNode(_ipBytes);
            _nodeLauncher.LaunchRPCNode();
            ExecuteFullNodeMenu();
        }
Пример #2
0
        static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddCore();
            serviceCollection.AddInMemory();
            var serviceProvider     = serviceCollection.BuildServiceProvider();
            var nodeLauncherFactory = serviceProvider.GetService <INodeLauncherFactory>();

            // https://bitcoin.org/en/developer-guide#full-service-wallets
            Console.Title = "WALLET NODE";
            Console.WriteLine("==== Welcome to SimpleBlockChain (WALLET) ====");
            var network = MenuHelper.ChooseNetwork();

            _rpcClient = new RpcClient(network);
            var ipBytes = IPAddress.Parse("192.168.76.132").MapToIPv6().GetAddressBytes(); // VIRTUAL NETWORK.

            _nodeLauncher = nodeLauncherFactory.Build(network, ServiceFlags.NODE_NONE);
            var p2pNode = _nodeLauncher.GetP2PNode();

            p2pNode.StartNodeEvent           += StartP2PNodeEvent;
            p2pNode.NewMessageEvent          += NewP2PMessageEvent;
            _nodeLauncher.ConnectP2PEvent    += ConnectP2PEvent;
            _nodeLauncher.DisconnectP2PEvent += DisconnectP2PEvent;
            _nodeLauncher.LaunchP2PNode(ipBytes);
            ExecuteMenu();
        }
Пример #3
0
        private void OpenNetwork(Networks network)
        {
            Disconnect();
            var ipBytes = IPAddress.Parse(ADR).MapToIPv6().GetAddressBytes();

            _nodeLauncher = _nodeLauncherFactory.Build(network, ServiceFlags.NODE_NONE);
            _nodeLauncher.LaunchP2PNode(ipBytes);
            _nodeLauncher.LaunchRPCNode();
            _nodeLauncher.ConnectP2PNetwork();
            _nodeLauncher.ConnectP2PEvent    += ConnectP2PNetwork;
            _nodeLauncher.DisconnectP2PEvent += DisconnectP2PNetwork;
        }
Пример #4
0
        private static void ExecuteP2PNetworkNotRunningMenu(int number)
        {
            if (number < 0 || number > 1)
            {
                MenuHelper.DisplayError("Enter a number between [1-1]");
                ExecuteFullNodeMenu();
                return;
            }

            switch (number)
            {
            case 1:
                _nodeLauncher.LaunchP2PNode(_ipBytes);
                break;
            }

            ExecuteFullNodeMenu();
        }
Пример #5
0
        static void Main(string[] args)
        {
            // https://bitcoin.org/en/developer-guide#full-service-wallets
            Console.Title = "PROTOCOL TESTER NODE";
            Console.WriteLine("==== Welcome to SimpleBlockChain (PROTOCOL TESTER) ====");
            var network = MenuHelper.ChooseNetwork();

            _rpcClient = new RpcClient(network);
            var ipBytes = IPAddress.Parse("192.168.76.133").MapToIPv6().GetAddressBytes(); // VIRTUAL NETWORK.

            _nodeLauncher = new NodeLauncher(network, ServiceFlags.NODE_NONE);
            var p2pNode = _nodeLauncher.GetP2PNode();

            p2pNode.StartNodeEvent           += StartP2PNodeEvent;
            p2pNode.NewMessageEvent          += NewP2PMessageEvent;
            _nodeLauncher.ConnectP2PEvent    += ConnectP2PEvent;
            _nodeLauncher.DisconnectP2PEvent += DisconnectP2PEvent;
            _nodeLauncher.LaunchP2PNode(ipBytes);
            ExecuteMenu();
        }
Пример #6
0
        static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddCore();
            serviceCollection.AddInMemory();
            var serviceProvider     = serviceCollection.BuildServiceProvider();
            var nodeLauncherFactory = serviceProvider.GetService <INodeLauncherFactory>();

            Console.WriteLine("==== Welcome to SimpleBlockChain (SEED NODE) ====");
            var network = MenuHelper.ChooseNetwork();
            var ipBytes = IPAddress.Parse(Constants.DNS_IP_ADDRESS).MapToIPv6().GetAddressBytes();

            _nodeLauncher = nodeLauncherFactory.Build(network, ServiceFlags.NODE_NETWORK);
            var p2pNode = _nodeLauncher.GetP2PNode();

            p2pNode.StartNodeEvent           += StartP2PNodeEvent;
            p2pNode.NewMessageEvent          += NewP2PMessageEvent;
            _nodeLauncher.ConnectP2PEvent    += ConnectP2PEvent;
            _nodeLauncher.DisconnectP2PEvent += DisconnectP2PEvent;
            _nodeLauncher.LaunchP2PNode(ipBytes);
            Console.ReadLine();
        }