Example #1
0
        public void StartFullNode(string[] startParameters)
        {
            PosBlockHeader.CustomPoWHash = ObsidianHash.GetObsidianPoWHash;

            try
            {
                var nodeSettings = new NodeSettings(networksSelector: ObsidianNetworksSelector.Obsidian,
                                                    protocolVersion: ProtocolVersion.PROVEN_HEADER_VERSION, agent: $"{GetName()}, StratisNode", args: startParameters)
                {
                    MinProtocolVersion = ProtocolVersion.ALT_PROTOCOL_VERSION
                };

                IFullNodeBuilder builder = new FullNodeBuilder();

                builder = builder.UseNodeSettings(nodeSettings);
                builder = builder.UseBlockStore();
                builder = builder.UsePosConsensus();
                builder = builder.UseMempool();
                builder = builder.UseColdStakingWallet();
                builder = builder.AddPowPosMining();
                //.UseApi()
                builder   = builder.AddRPC();
                _fullNode = (FullNode)builder.Build();

                LogQueue = XamarinLogger.Queue;

                if (_fullNode != null)
                {
                    Task.Run(async() => await RunAsync(_fullNode));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(@"There was a problem initializing or running the node. Details: '{0}'", ex.Message);
                NodeCrashed?.Invoke(this, EventArgs.Empty);
            }
        }