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(); }
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; }