Esempio n. 1
0
        public async Task StartAsync()
        {
            NodeConfigParameters config    = new NodeConfigParameters();
            StringBuilder        configStr = new StringBuilder();

            configStr.AppendLine("regtest=1");
            if (NodeImplementation.UseSectionInConfigFile)
            {
                configStr.AppendLine("[regtest]");
            }
            config.Add("rest", "1");
            config.Add("server", "1");
            config.Add("txindex", "1");
            if (!CookieAuth)
            {
                config.Add("rpcuser", creds.UserName);
                config.Add("rpcpassword", creds.Password);
            }
            if (!WhiteBind)
            {
                config.Add("port", ports[0].ToString());
            }
            else
            {
                config.Add("whitebind", "127.0.0.1:" + ports[0].ToString());
            }
            config.Add("rpcport", ports[1].ToString());
            config.Add("printtoconsole", "1");
            config.Add("keypool", "10");
            config.Import(ConfigParameters, true);
            configStr.Append(config.ToString());
            File.WriteAllText(_Config, configStr.ToString());
            await Run();
        }
Esempio n. 2
0
		public async Task StartAsync()
		{
			NodeConfigParameters config = new NodeConfigParameters();
			config.Add("regtest", "1");
			config.Add("rest", "1");
			config.Add("server", "1");
			config.Add("txindex", "1");
			config.Add("rpcuser", creds.UserName);
			config.Add("rpcpassword", creds.Password);
			config.Add("port", ports[0].ToString());
			config.Add("rpcport", ports[1].ToString());
			config.Add("printtoconsole", "1");
			config.Add("keypool", "10");
			config.Import(ConfigParameters);
			File.WriteAllText(_Config, config.ToString());
			lock(l)
			{
				_Process = Process.Start(new FileInfo(this._Builder.BitcoinD).FullName, "-conf=bitcoin.conf" + " -datadir=" + dataDir + " -debug=net");
				_State = CoreNodeState.Starting;
			}
			while(true)
			{
				try
				{
					await CreateRPCClient().GetBlockHashAsync(0).ConfigureAwait(false);
					_State = CoreNodeState.Running;
					break;
				}
				catch { }
				if(_Process == null || _Process.HasExited)
					break;
			}
		}
Esempio n. 3
0
        public async Task StartAsync()
        {
            NodeConfigParameters config    = new NodeConfigParameters();
            StringBuilder        configStr = new StringBuilder();

            if (String.IsNullOrEmpty(NodeImplementation.Chain))
            {
                configStr.AppendLine("regtest=1");
            }
            else
            {
                configStr.AppendLine($"chain={NodeImplementation.Chain}");
            }
            if (NodeImplementation.UseSectionInConfigFile)
            {
                if (String.IsNullOrEmpty(NodeImplementation.Chain))
                {
                    configStr.AppendLine("[regtest]");
                }
                else
                {
                    configStr.AppendLine($"[{NodeImplementation.Chain}]");
                }
            }
            config.Add("rest", "1");
            config.Add("server", "1");
            config.Add("txindex", "1");
            config.Add("peerbloomfilters", "1");
            config.Add("blockfilterindex", "1");
            if (!CookieAuth)
            {
                config.Add("rpcuser", creds.UserName);
                config.Add("rpcpassword", creds.Password);
            }
            if (!WhiteBind)
            {
                config.Add("port", ports[0].ToString());
            }
            else
            {
                config.Add("whitebind", "127.0.0.1:" + ports[0].ToString());
            }
            config.Add("rpcport", ports[1].ToString());
            config.Add("printtoconsole", _Builder.ShowNodeConsole ? "1" : "0");
            config.Add("keypool", "10");
            config.Add("fallbackfee", "0.0002");             // https://github.com/bitcoin/bitcoin/pull/16524
            config.Import(ConfigParameters, true);
            configStr.AppendLine(config.ToString());
            if (NodeImplementation.AdditionalRegtestConfig != null)
            {
                configStr.AppendLine(NodeImplementation.AdditionalRegtestConfig);
            }
            File.WriteAllText(_Config, configStr.ToString());
            await Run();
        }
Esempio n. 4
0
        public async Task StartAsync()
        {
            NodeConfigParameters config = new NodeConfigParameters();

            config.Add("regtest", "1");
            config.Add("rest", "1");
            config.Add("server", "1");
            config.Add("txindex", "1");
            if (!CookieAuth)
            {
                config.Add("rpcuser", creds.UserName);
                config.Add("rpcpassword", creds.Password);
            }
            if (!WhiteBind)
            {
                config.Add("port", ports[0].ToString());
            }
            else
            {
                config.Add("whitebind", "127.0.0.1:" + ports[0].ToString());
            }
            config.Add("rpcport", ports[1].ToString());
            config.Add("printtoconsole", "1");
            config.Add("keypool", "10");
            config.Import(ConfigParameters, true);
            File.WriteAllText(_Config, config.ToString());
            await Run();
        }
Esempio n. 5
0
        public async Task StartAsync()
        {
            NodeConfigParameters config = new NodeConfigParameters();

            config.Add("regtest", "1");
            config.Add("rest", "1");
            config.Add("server", "1");
            config.Add("txindex", "1");
            if (!CookieAuth)
            {
                config.Add("rpcuser", creds.UserName);
                config.Add("rpcpassword", creds.Password);
                _RPCAuth = creds.UserName + ":" + creds.Password;
            }
            else
            {
                _RPCAuth = "cookiefile=" + Path.Combine(dataDir, "elementsregtest", ".cookie");
            }
            config.Add("port", ports[0].ToString());
            config.Add("rpcport", ports[1].ToString());
            config.Add("printtoconsole", "1");
            config.Add("keypool", "10");
            config.Add("whitebind", "127.0.0.1:" + ports[0].ToString());
            config.Import(ConfigParameters);
            File.WriteAllText(_Config, config.ToString());
            await Run();
        }