示例#1
0
        private static int Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += OnProcessExit;

            _configuration = new Configuration();
            try
            {
                _configuration.ValidateParams(args);
            }
            catch (Exception e)
            {
                Log.Error(e);
                return(-1);
            }


            Log.Info($"Welcome to {MainnetName} {Version}");

            _iota = new Iota(_configuration);
            _ixi  = new IXI(_iota);
            _api  = new API(_iota, _ixi);

            try
            {
                Log.Info("Process Start");

                _iota.Init();
                _api.Init();


                var apiPort = 14265;
                //Log.Debug($"Binding JSON-REST API Kestrel server on {IPAddress.Loopback}:{apiPort}");

                _webHost = new WebHostBuilder()
                           .UseUrls($"http://*:{apiPort}")
                           .UseStartup <Program>()
                           .UseKestrel(options =>
                {
                    //options.Listen(IPAddress.Loopback, apiPort);
                    //TODO(gjc): add limit
                }).Build();

                _webHost.Run();
            }
            catch (Exception e)
            {
                Log.Error(e, "Exception during IOTA node initialisation");
                return(-1);
            }

            return(0);
        }
示例#2
0
 public IXI(Iota iota)
 {
     _iota = iota;
 }