예제 #1
0
        // TODO:
        // * Genesis time + timestamp + deadline * 60 - check for deposits
        // * Migrate sqlite wallet to EF7
        // * Encrypt wallet.
        // * Make NxtConnector thread safe (if needed?)
        //   Need to decide whether to use DataProtection (new dotnet core stuff) described here: https://docs.asp.net/en/latest/security/data-protection/index.html
        //   or just to use AES-256-CBC encryption and let user provide a key.

        public static void Main(string[] args)
        {
            var configSettings   = ReadConfig();
            var walletFile       = configSettings.Single(c => c.Key == "walletFile").Value;
            var nxtServerAddress = configSettings.Single(c => c.Key == "nxtServerAddress").Value;
            var confirmations    = int.Parse(configSettings.Single(c => c.Key == "confirmations").Value);

            var connector = new NxtConnector(new ServiceFactory(nxtServerAddress), walletFile, confirmations);
            var exchange  = new ConsoleExchange(connector);

            Task.Run(() => exchange.Run()).Wait();
        }
예제 #2
0
        static void Main()
        {
            var nxtService = new NxtConnector(SecretPhrase, new AccountService(NxtUri), new BlockService(NxtUri),
                                              new MessageService(NxtUri), new ServerInfoService(NxtUri), new TransactionService(NxtUri));
            var controller = new ExchangeController(nxtService, new NxtRepository());

            controller.IncomingTransaction      += OnIncomingTransaction;
            controller.UpdatedTransactionStatus += OnUpdatedTransactionStatus;

            var cts = new CancellationTokenSource();

            Task.Factory.StartNew(() => controller.Start(cts.Token), TaskCreationOptions.LongRunning);

            Console.WriteLine("Press enter to exit");
            Console.ReadLine();
            Console.WriteLine("Shutting down executing tasks... ");
            cts.Cancel();
        }
예제 #3
0
 public ConsoleExchange(NxtConnector connector)
 {
     this.connector = connector;
 }