Esempio n. 1
0
        public NodeBuilder(string root, string bitcoindPath)
        {
            this.last             = 0;
            this.Nodes            = new List <CoreNode>();
            this.ConfigParameters = new NodeConfigParameters();

            this.root     = root;
            this.BitcoinD = bitcoindPath;
        }
Esempio n. 2
0
        public NodeBuilder(string rootFolder, string bitcoindPath)
        {
            this.lastDataFolderIndex = 0;
            this.Nodes            = new List <CoreNode>();
            this.ConfigParameters = new NodeConfigParameters();

            this.rootFolder = rootFolder;
            this.BitcoinD   = bitcoindPath;
        }
Esempio n. 3
0
 public void Import(NodeConfigParameters configParameters)
 {
     foreach (var kv in configParameters)
     {
         if (!this.ContainsKey(kv.Key))
         {
             this.Add(kv.Key, kv.Value);
         }
     }
 }
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");
            config.Add("rpcuser", this.creds.UserName);
            config.Add("rpcpassword", this.creds.Password);
            config.Add("port", this.ports[0].ToString());
            config.Add("rpcport", this.ports[1].ToString());
            config.Add("printtoconsole", "1");
            config.Add("keypool", "10");
            config.Add("agentprefix", "node" + this.ports[0].ToString());
            config.Import(this.ConfigParameters);
            File.WriteAllText(this.Config, config.ToString());
            lock (this.lockObject)
            {
                this.runner.Start(this.DataFolder);
                this.State = CoreNodeState.Starting;
            }
            while (true)
            {
                try
                {
                    await this.CreateRPCClient().GetBlockHashAsync(0);

                    this.State = CoreNodeState.Running;
                    break;
                }
                catch
                {
                }
                if (this.runner.IsDisposed)
                {
                    break;
                }
            }
        }
        public void Start()
        {
            NodeBuilder.CreateDataFolder(this.runner.DataFolder);

            var config = new NodeConfigParameters();

            config.Add("regtest", "1");
            config.Add("rest", "1");
            config.Add("server", "1");
            config.Add("txindex", "1");
            config.Add("rpcuser", this.creds.UserName);
            config.Add("rpcpassword", this.creds.Password);
            config.Add("port", this.ports[0].ToString());
            config.Add("rpcport", this.ports[1].ToString());
            config.Add("printtoconsole", "1");
            config.Add("keypool", "10");
            config.Add("agentprefix", "node" + this.ports[0].ToString());
            config.Import(this.ConfigParameters);
            File.WriteAllText(this.Config, config.ToString());

            lock (this.lockObject)
            {
                this.runner.Start();
                this.State = CoreNodeState.Starting;
            }

            if (this.runner is BitcoinCoreRunner)
            {
                StartBitcoinCoreRunner();
            }
            else
            {
                StartStratisRunner();
            }

            this.State = CoreNodeState.Running;
        }