<p>The glib answer would be, "Because then users would come on the forums and complain that changing nTargetSpacing causes their client to stop syncronizing."</p>

<p>The other issue is that a lot of the really interesting parameters aren't in chainparams at all. For example, the function that determines block rewards is in <a href="https://github.com/bitcoin/bitcoin/blob/de8b9ab75718ef7663d5e8cc2f2135b8118730e7/src/main.cpp#L1228" rel="nofollow">main.cpp</a>.</p>

<p>But I don't think there's a technical issue preventing you from making those things config options.</p>

CC BY-SA 3.0
2015-02-01T03:44:39.343Z
2015-02-01T07:51:40.497Z
2015-02-01T07:51:40.497Z
Nick ODell
<p>I don't think there's really any better reason than "Satoshi Nakamoto chose to write the code that way, and nobody ever changed it".</p>

<p>There's no inherent reason why these values couldn't be loaded from a configuration file, but there's a general principle that config files are intended for parameters that are <em>user</em> configurable.  A Bitcoin user couldn't change anything in that config file or their client would quit working with the rest of the network.  Developers might want to, but they are expected to be comfortable with recompiling.  So presumably nobody thought it was worthwhile to write the code to parse a config file for these values.</p>

<p>So if you want to be able to modify those values by editing a config file, you'll first have to write the code to parse and load the config file.  Which, of course, also involves recompiling (and a lot more work besides).  Perhaps now you can see why nobody has wanted to do it so far.  But if you do, you can offer the code back to the main Bitcoin Core development line, and maybe it will be incorporated, thus saving someone in the future from this quandary.</p>

<p>Recompiling Bitcoin Core is not all that much work, once you have a development environment and necessary dependencies installed.  And when you have compiled it once, changes to the chain parameters should only require you to recompile one file and relink (which Make will do automatically).</p>

CC BY-SA 3.0
2015-02-01T02:56:11.890Z
2015-02-01T02:56:11.890Z
Nate Eldredge
<p>I'm interested in running a private test network to experiment with various chain parameters. These are hardcoded in chainparams.cpp.</p>

<p><a href="https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp" rel="nofollow">https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp</a></p>

<p>Unfortunately, this means that to run any experiments, I need to recompile Bitcoin Core.</p>

<p>What I'd like to do instead is simply edit a configuration file, then restart Bitcoin Core.</p>

<p>Why are chain parameters hard coded this way? Is there any way to inject my own chain parameters through a configuration file without recompiling Bitcoin Core?</p>

CC BY-SA 3.0
2015-02-01T04:24:11.683Z
You would have to empty your datadir before restarting, as the chain stored might not be compatible with the new values set in the config file. Also, this might be a useful feature for testing, but making configurable parameters like this would likely confuse most users.
morsecoder
<bitcoin-core-development>
Why are chain parameters hardcoded rather than defined in a configuration file?
Rich Apodaca
# Why are chain parameters hardcoded rather than defined in a configuration file?

(Asked by: username_0 on 2015-01-31)

I'm interested in running a private test network to experiment with various chain parameters. These are hardcoded in chainparams.cpp.

<https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp>

Unfortunately, this means that to run any experiments, I need to recompile Bitcoin Core.

What I'd like to do instead is simply edit a configuration file, then restart Bitcoin Core.

Why are chain parameters hard coded this way? Is there any way to inject my own chain parameters through a configuration file without recompiling Bitcoin Core?

**Tags:** bitcoin-core-development

> **Comments:**
> **username_1**: You would have to empty your datadir before restarting, as the chain stored might not be compatible with the new values set in the config file. Also, this might be a useful feature for testing, but making configurable parameters like this would likely confuse most users.  

---

## 2 answers

### Answer by username_3 on 2015-02-01. Score: 6 | Accepted answer

I don't think there's really any better reason than "Satoshi Nakamoto chose to write the code that way, and nobody ever changed it".

There's no inherent reason why these values couldn't be loaded from a configuration file, but there's a general principle that config files are intended for parameters that are *user* configurable. A Bitcoin user couldn't change anything in that config file or their client would quit working with the rest of the network. Developers might want to, but they are expected to be comfortable with recompiling. So presumably nobody thought it was worthwhile to write the code to parse a config file for these values.

So if you want to be able to modify those values by editing a config file, you'll first have to write the code to parse and load the config file. Which, of course, also involves recompiling (and a lot more work besides). Perhaps now you can see why nobody has wanted to do it so far. But if you do, you can offer the code back to the main Bitcoin Core development line, and maybe it will be incorporated, thus saving someone in the future from this quandary.

Recompiling Bitcoin Core is not all that much work, once you have a development environment and necessary dependencies installed. And when you have compiled it once, changes to the chain parameters should only require you to recompile one file and relink (which Make will do automatically).


---

### Answer by username_2 on 2015-02-01. Score: 2

The glib answer would be, "Because then users would come on the forums and complain that changing nTargetSpacing causes their client to stop syncronizing."

The other issue is that a lot of the really interesting parameters aren't in chainparams at all. For example, the function that determines block rewards is in [main.cpp](https://github.com/bitcoin/bitcoin/blob/de8b9ab75718ef7663d5e8cc2f2135b8118730e7/src/main.cpp#L1228).

But I don't think there's a technical issue preventing you from making those things config options.


---

