Ejemplo n.º 1
0
        private static IFullNode GetSideChainFullNode(NodeSettings nodeSettings)
        {
            DbType dbType = nodeSettings.GetDbType();

            IFullNodeBuilder nodeBuilder = new FullNodeBuilder()
                                           .UseNodeSettings(nodeSettings, dbType)
                                           .UseBlockStore(dbType)
                                           .UseMempool()
                                           .AddSmartContracts(options =>
            {
                options.UseReflectionExecutor();
                options.UsePoAWhitelistedContracts();
            })
                                           .AddPoAFeature()
                                           .UsePoAConsensus(dbType)
                                           .CheckCollateralCommitment()

                                           // This needs to be set so that we can check the magic bytes during the Strat to Strax changeover.
                                           // Perhaps we can introduce a block height check rather?
                                           .SetCounterChainNetwork(StraxNetwork.MainChainNetworks[nodeSettings.Network.NetworkType]())

                                           .UseSmartContractWallet()
                                           .AddSQLiteWalletRepository()
                                           .UseApi()
                                           .UseUnity3dApi()
                                           .AddRPC()
                                           .AddSignalR(options =>
            {
                DaemonConfiguration.ConfigureSignalRForCirrus(options);
            })
                                           .UseDiagnosticFeature();

            return(nodeBuilder.Build());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a standard Stratis node. Just like StratisD.
        /// </summary>
        private static IFullNode BuildStraxNode(string[] args)
        {
            // TODO: Hardcode -addressindex for better user experience

            var nodeSettings = new NodeSettings(networksSelector: Networks.Strax, protocolVersion: ProtocolVersion.PROVEN_HEADER_VERSION, args: args)
            {
                MinProtocolVersion = ProtocolVersion.ALT_PROTOCOL_VERSION
            };

            DbType dbType = nodeSettings.GetDbType();

            IFullNode node = new FullNodeBuilder()
                             .UseNodeSettings(nodeSettings, dbType)
                             .UseBlockStore(dbType)
                             .UseTransactionNotification()
                             .UseBlockNotification()
                             .UseApi()
                             .UseMempool()
                             .AddRPC()
                             .UsePosConsensus(dbType)
                             .UseWallet()
                             .AddSQLiteWalletRepository()
                             .AddPowPosMining(true)
                             .Build();

            return(node);
        }
Ejemplo n.º 3
0
        private static IFullNode BuildCirrusMiningNode(string[] args)
        {
            var nodeSettings = new NodeSettings(networksSelector: CirrusNetwork.NetworksSelector, protocolVersion: ProtocolVersion.CIRRUS_VERSION, args: args)
            {
                MinProtocolVersion = ProtocolVersion.ALT_PROTOCOL_VERSION
            };

            DbType dbType = nodeSettings.GetDbType();

            IFullNode node = new FullNodeBuilder()
                             .UseNodeSettings(nodeSettings, dbType)
                             .UseBlockStore(dbType)
                             .AddPoAFeature()
                             .UsePoAConsensus(dbType)
                             .AddPoACollateralMiningCapability <SmartContractPoABlockDefinition>()
                             .CheckCollateralCommitment()
                             .AddDynamicMemberhip()
                             .SetCounterChainNetwork(StraxNetwork.MainChainNetworks[nodeSettings.Network.NetworkType]())
                             .UseTransactionNotification()
                             .UseBlockNotification()
                             .UseApi()
                             .UseMempool()
                             .AddRPC()
                             .AddSmartContracts(options =>
            {
                options.UseReflectionExecutor();
                options.UsePoAWhitelistedContracts();
            })
                             .UseSmartContractWallet()
                             .AddSQLiteWalletRepository()
                             .Build();

            return(node);
        }
Ejemplo n.º 4
0
        private static IFullNode BuildDevCirrusMiningNode(string[] args)
        {
            string[] devModeArgs = new[] { "-bootstrap=1", "-dbtype=rocksdb", "-defaultwalletname=cirrusdev", "-defaultwalletpassword=password" }.Concat(args).ToArray();
            var      network = new CirrusDev();

            var nodeSettings = new NodeSettings(network, protocolVersion: ProtocolVersion.CIRRUS_VERSION, args: devModeArgs)
            {
                MinProtocolVersion = ProtocolVersion.ALT_PROTOCOL_VERSION
            };

            DbType dbType = nodeSettings.GetDbType();

            IFullNode node = new FullNodeBuilder()
                             .UseNodeSettings(nodeSettings, dbType)
                             .UseBlockStore(dbType)
                             .AddPoAFeature()
                             .UsePoAConsensus(dbType)
                             .AddPoAMiningCapability <SmartContractPoABlockDefinition>()
                             .UseTransactionNotification()
                             .UseBlockNotification()
                             .UseApi()
                             .UseMempool()
                             .AddRPC()
                             .AddSmartContracts(options =>
            {
                options.UseReflectionExecutor();
                options.UsePoAWhitelistedContracts(true);
            })
                             .UseSmartContractWallet()
                             .AddSQLiteWalletRepository()
                             .Build();

            return(node);
        }
Ejemplo n.º 5
0
        private static IFullNode GetMainchainFullNode(string[] args)
        {
            // TODO: Hardcode -addressindex

            var nodeSettings = new NodeSettings(networksSelector: Networks.Strax, protocolVersion: ProtocolVersion.PROVEN_HEADER_VERSION, args: args)
            {
                MinProtocolVersion = ProtocolVersion.ALT_PROTOCOL_VERSION
            };

            NetworkType networkType = nodeSettings.Network.NetworkType;

            DbType dbType = nodeSettings.GetDbType();

            IFullNode node = new FullNodeBuilder()
                             .UseNodeSettings(nodeSettings, dbType)
                             .UseBlockStore(dbType)
                             .SetCounterChainNetwork(SidechainNetworks[nodeSettings.Network.NetworkType]())
                             .AddFederatedPeg(isMainChain: true)
                             .UseTransactionNotification()
                             .UseBlockNotification()
                             .UseApi()
                             .UseMempool()
                             .AddRPC()
                             .UsePosConsensus(dbType)
                             .UseWallet()
                             .AddSQLiteWalletRepository()
                             .AddPowPosMining(true)
                             .Build();

            return(node);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// The async entry point for the Strax Dns process.
        /// </summary>
        /// <param name="args">Command line arguments.</param>
        /// <returns>A task used to await the operation.</returns>
        public static async Task Main(string[] args)
        {
            try
            {
                var nodeSettings = new NodeSettings(networksSelector: Networks.Strax, protocolVersion: ProtocolVersion.PROVEN_HEADER_VERSION, args: args)
                {
                    MinProtocolVersion = ProtocolVersion.PROVEN_HEADER_VERSION
                };

                DbType dbType = nodeSettings.GetDbType();

                var dnsSettings = new DnsSettings(nodeSettings);

                if (string.IsNullOrWhiteSpace(dnsSettings.DnsHostName) || string.IsNullOrWhiteSpace(dnsSettings.DnsNameServer) || string.IsNullOrWhiteSpace(dnsSettings.DnsMailBox))
                {
                    throw new ConfigurationException("When running as a DNS Seed service, the -dnshostname, -dnsnameserver and -dnsmailbox arguments must be specified on the command line.");
                }

                // Run as a full node with DNS or just a DNS service?
                IFullNode node;
                if (dnsSettings.DnsFullNode)
                {
                    // Build the Dns full node.
                    node = new FullNodeBuilder()
                           .UseNodeSettings(nodeSettings, dbType)
                           .UseBlockStore(dbType)
                           .UsePosConsensus(dbType)
                           .UseMempool()
                           .UseWallet()
                           .AddSQLiteWalletRepository()
                           .AddPowPosMining(true)
                           .UseApi()
                           .AddRPC()
                           .UseDns()
                           .Build();
                }
                else
                {
                    // Build the Dns node.
                    node = new FullNodeBuilder()
                           .UseNodeSettings(nodeSettings, dbType)
                           .UsePosConsensus(dbType)
                           .UseApi()
                           .AddRPC()
                           .UseDns()
                           .Build();
                }

                // Run node.
                if (node != null)
                {
                    await node.RunAsync();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("There was a problem initializing the node. Details: '{0}'", ex.ToString());
            }
        }
Ejemplo n.º 7
0
        public static async Task Main(string[] args)
        {
            try
            {
                var nodeSettings = new NodeSettings(networksSelector: Networks.Strax, protocolVersion: ProtocolVersion.PROVEN_HEADER_VERSION, args: args)
                {
                    MinProtocolVersion = ProtocolVersion.PROVEN_HEADER_VERSION
                };

                // Set the console window title to identify this as a Strax full node (for clarity when running Strax and Cirrus on the same machine).
                Console.Title = $"Strax Full Node {nodeSettings.Network.NetworkType}";

                DbType dbType = nodeSettings.GetDbType();

                IFullNodeBuilder nodeBuilder = new FullNodeBuilder()
                                               .UseNodeSettings(nodeSettings, dbType)
                                               .UseBlockStore(dbType)
                                               .UsePosConsensus(dbType)
                                               .UseMempool()
                                               .UseColdStakingWallet()
                                               .AddSQLiteWalletRepository()
                                               .AddPowPosMining(true)
                                               .UseApi()
                                               .UseUnity3dApi()
                                               .AddRPC()
                                               .AddSignalR(options =>
                {
                    DaemonConfiguration.ConfigureSignalRForStrax(options);
                })
                                               .UseDiagnosticFeature()
                                               .AddExternalApi();

                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);
            }
        }
Ejemplo n.º 8
0
        private static IFullNode BuildCirrusLiveNode(string[] args)
        {
            var nodeSettings = new NodeSettings(networksSelector: CirrusNetwork.NetworksSelector, protocolVersion: ProtocolVersion.CIRRUS_VERSION, args: args)
            {
                MinProtocolVersion = ProtocolVersion.ALT_PROTOCOL_VERSION
            };

            Console.Title = $"Cirrus Full Node {nodeSettings.Network.NetworkType}";

            DbType dbType = nodeSettings.GetDbType();

            IFullNodeBuilder nodeBuilder = new FullNodeBuilder()
                                           .UseNodeSettings(nodeSettings, dbType)
                                           .UseBlockStore(dbType)
                                           .UseMempool()
                                           .AddSmartContracts(options =>
            {
                options.UseReflectionExecutor();
                options.UsePoAWhitelistedContracts();
            })
                                           .AddPoAFeature()
                                           .UsePoAConsensus(dbType)
                                           .CheckCollateralCommitment()
                                           .SetCounterChainNetwork(StraxNetwork.MainChainNetworks[nodeSettings.Network.NetworkType]())
                                           .UseSmartContractWallet()
                                           .AddSQLiteWalletRepository()
                                           .UseTransactionNotification()
                                           .UseBlockNotification()
                                           .UseApi()
                                           .UseIndexerApi()
                                           .AddRPC()
                                           .UseKubernetesProbes()
                                           .AddDynamicMemberhip()
                                           .AddBlockcoreRegistrations();

            // .AddSignalR(options =>
            // {
            //     DaemonConfiguration.ConfigureSignalRForCirrus(options);
            // })
            // .UseDiagnosticFeature();

            return(nodeBuilder.Build());
        }