public static async Task Main(string[] args) { try { string chain = args .DefaultIfEmpty("--chain=BTC") .Where(arg => arg.StartsWith("--chain", ignoreCase: true, CultureInfo.InvariantCulture)) .Select(arg => arg.Replace("--chain=", string.Empty, ignoreCase: true, CultureInfo.InvariantCulture)) .FirstOrDefault(); NodeSettings nodeSettings = NetworkSelector.Create(chain, args); IFullNodeBuilder nodeBuilder = NodeBuilder.Create(chain, nodeSettings); IFullNode node = nodeBuilder.Build(); if (node != null) { await node.RunAsync(); } } catch (Exception ex) { Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex); } }
public static async Task Main(string[] args) { try { string chain = args .DefaultIfEmpty("--chain=BTC") .Where(arg => arg.StartsWith("--chain", ignoreCase: true, CultureInfo.InvariantCulture)) .Select(arg => arg.Replace("--chain=", string.Empty, ignoreCase: true, CultureInfo.InvariantCulture)) .FirstOrDefault(); NodeSettings nodeSettings = NetworkSelector.Create(chain, args); IFullNodeBuilder nodeBuilder = NodeBuilder.Create(chain, nodeSettings); if (nodeSettings.EnableSignalR) { nodeBuilder.AddSignalR(options => { options.EventsToHandle = new[] { (IClientEvent) new BlockConnectedClientEvent(), new TransactionReceivedClientEvent() }; options.ClientEventBroadcasters = new[] { (Broadcaster: typeof(StakingBroadcaster), ClientEventBroadcasterSettings: new ClientEventBroadcasterSettings { BroadcastFrequencySeconds = 5 }), (Broadcaster: typeof(WalletInfoBroadcaster), ClientEventBroadcasterSettings: new ClientEventBroadcasterSettings { BroadcastFrequencySeconds = 5 }) }; }); }
public static async Task Main(string[] args) { try { List <string> arguments = new List <string>(args); // If now override of dbtype is specified, we'll default to rocksdb and not the normal leveldb. if (!arguments.Any(a => a.ToLower().StartsWith("-dbtype"))) { arguments.Add("-dbtype=rocksdb"); } string chain = arguments .DefaultIfEmpty("--chain=BTC") .Where(arg => arg.StartsWith("--chain", ignoreCase: true, CultureInfo.InvariantCulture)) .Select(arg => arg.Replace("--chain=", string.Empty, ignoreCase: true, CultureInfo.InvariantCulture)) .FirstOrDefault(); if (string.IsNullOrWhiteSpace(chain)) { chain = "BTC"; } NodeSettings nodeSettings = NetworkSelector.Create(chain, arguments.ToArray()); if (nodeSettings == null) { Console.WriteLine($"Please check your specified chain argument, it is currently not supported: {chain}. Exiting..."); return; } IFullNodeBuilder nodeBuilder = NodeBuilder.Create(chain, nodeSettings); IFullNode node = nodeBuilder.Build(); if (node != null) { await node.RunAsync(); } } catch (Exception ex) { Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex); } }