1Two nodes, two files
Each node reads one settings file when it starts. It looks for it in its data folder unless you name another file with -conf (C++ node) or --conf (IronDivi).
| Node | File | Linux | Mac |
|---|---|---|---|
Original Divi node (divid) | divi.conf | ~/.divi/ | ~/Library/Application Support/DIVI/ |
| IronDivi, real network | irondivi.conf | ~/.irondivi/ | ~/Library/Application Support/IronDivi/ |
| IronDivi, testnet | irondivi.conf | ~/.irondivi/testnet/ | ~/Library/Application Support/IronDivi/testnet/ |
On Windows the C++ node uses %APPDATA%\DIVI\divi.conf. IronDivi has no Windows build.
The C++ node keeps one divi.conf for both networks: testnet=1 inside it sends the node to testnet and its data to a testnet3 folder next to the file. IronDivi is the other way round. The network comes from the command line, and each network has its own folder with its own irondivi.conf. If you pass --datadir, IronDivi uses that folder exactly as given and looks for the file inside it.
2The format is different
This is the slip people make most when they have used both nodes.
divi.conf | irondivi.conf | |
|---|---|---|
| Form | key=value, one per line | TOML: key = "text" or key = 5 |
| Text values | No quotes | Double quotes, always |
| Yes and no | 1 and 0 | true and false (1 and 0 also work) |
| Several values | Repeat the line | One line with a list: ["a", "b"] |
| Comments | Lines starting with # | Lines starting with # |
| Unknown setting | Silently ignored | A warning in the log, then ignored |
Here is what each node does with the other one's habits. IronDivi with a divi.conf-style line refuses to start:
# irondivi.conf containing rpcuser=tutf
Error: Failed to parse config file: "/home/you/.irondivi/testnet/irondivi.conf"
Caused by:
TOML parse error at line 1, column 9
|
1 | rpcuser=tutf
| ^
invalid string
expected `"`, `'`
A setting written twice stops it too, with duplicate key `addnode` in document root. The C++ node does the opposite: it starts happily with quotes, but keeps them as part of the value. With rpcuser="tutf" in divi.conf, our node turned down the name tutf and accepted only "tutf", quotes included:
divi-cli -rpcuser=tutf getblockcount error: incorrect rpcuser or rpcpassword (authorization failed)
An unknown or misspelt setting is the quiet failure. The C++ node ignores a line like foo=bar without a word. IronDivi logs one line and carries on:
WARN irondivid: Unknown configuration key in config file: maxconnections
If a setting seems to do nothing, check the spelling and then check the log.
3A safe starter file for each
Both files hold the name and password that protect the node's command port. divi-cli and irondivi-cli read the same file, so you never type the password. Make it long and random, from letters and digits only:
openssl rand -hex 24
Paste the result in as the password. Then make the file readable by you alone, because anyone who can read it can spend from the node's wallet:
chmod 600 ~/.divi/divi.conf chmod 600 ~/.irondivi/testnet/irondivi.conf
A testnet divi.conf:
# ~/.divi/divi.conf testnet=1 rpcuser=pick-a-name rpcpassword=the-random-password daemon=1 staking=0
A testnet irondivi.conf:
# ~/.irondivi/testnet/irondivi.conf rpcuser = "pick-a-name" rpcpassword = "the-random-password" addnode = "services.divi.domains:51474" staking = false
For the real network, drop testnet=1 from divi.conf, and put IronDivi's file in ~/.irondivi/ instead. Leave staking out, or set it to on, once the wallet holds coins you mean to stake.
If irondivi.conf is missing either rpcuser or rpcpassword, IronDivi does not refuse to start. It opens the command port with no check. Any program on the same computer can then use the wallet. The log says so:
WARN divi_rpc::server: RPC authentication disabled: set both rpcuser and rpcpassword
If you see that line, add both settings and restart.
# out of the password
irondivi-cli reads the file with its own simple reader, which cuts every line at the first #. A password with a # in it works for the node and fails for the command line. A hex password from openssl rand -hex avoids that and the quote problems above.
4Every divi.conf line
Any option the C++ node takes on its command line can also go in the file, without the leading dash. These are the ones worth knowing. Defaults come from divid -help for version 3.0.0.
| Line | What it does | If you leave it out |
|---|---|---|
| testnet=1 | Use the test network. Data goes to testnet3/. | The real network |
| rpcuser= rpcpassword= | Name and password for divi-cli and any program using the command port | Set them. Without them divi-cli cannot talk to the node. |
| rpcport= | The command port | 51473, or 51475 on testnet |
| rpcallowip= | Lets other machines use the command port | This computer only. Keep it that way. |
| rpcbind= | Which address the command port listens on | Ignored unless rpcallowip is also set |
| server=1 | Accept commands | divid turns it on by itself. The desktop wallet needs it to accept commands. |
| daemon=1 | Run in the background and give the terminal back | Stays in the terminal window |
| port= | The port other nodes connect to | 51472, or 51474 on testnet |
| listen=0 | Do not accept connections from other nodes | Accepts them, unless proxy or connect is set |
| addnode= | A node to connect to and stay connected to. Repeat the line for more. | Finds nodes by itself |
| connect= | Connect only to these nodes and no others | Finds nodes by itself |
| maxconnections= | Most peers at once | 125 |
| staking=0 | Do not stake | Stakes (1) |
| txindex=1 | Keep an index of every transaction, so getrawtransaction finds any of them | Off |
| addressindex=1 | Keep an index by address, for balance and history lookups | Off |
| dbcache= | Memory for the chain database, in MB (4 to 4096) | 100 |
| debug= | Extra detail in debug.log, for example debug=net or debug=tor | Normal logging |
| printtoconsole=1 | Write the log to the screen instead of debug.log | Writes debug.log |
| proxy= listenonion= torcontrol= | Route through Tor. See Run your node over Tor. | Direct connections |
On testnet the C++ node's command port is 51475 while IronDivi's is 51473. The peer port is 51474 for both. Running both on one computer works once you give one of them its own port and rpcport.
5Every irondivi.conf line
IronDivi version 0.2.5 acts on only the settings below. The ones in the next section are read but change nothing, and anything else gets the "Unknown configuration key" warning.
| Line | What it does | If you leave it out |
|---|---|---|
| rpcuser = "…" rpcpassword = "…" | Name and password for the command port | No password at all. Set both. |
| rpcport = 51473 | The command port | 51471, or 51473 on testnet |
| rpcbind = "…" | Which address the command port listens on | 127.0.0.1, this computer only |
| port = 51474 | The port other nodes connect to | 51472, or 51474 on testnet |
| bind = "…" | Which address that port listens on | 0.0.0.0, every address |
| listen = false | Do not accept connections from other nodes | Accepts them |
| addnode = "…" | Nodes to connect to. A single "host:port" or a list ["a:51474", "b:51474"]. | Finds nodes by itself |
| connect = "…" | Connect only to these nodes. Also turns off looking for others. | Finds nodes by itself |
| staking = false | Do not start staking at startup | Stakes |
| stakeonstaletip = true | Stake even when the newest block is more than a day old. Only for restarting a stalled test network. | Off |
| utxocachesize = 10000000 | Keep this many coin records in memory to sync faster. Ten million is about 500 MB. | 0, no cache |
With staking = false the log says Staking disabled at startup (staking=false); use RPC setstaking true to start it. You can turn it on later without a restart, as shown in A tour of irondivi-cli.
6What IronDivi's file cannot set
Some settings you would expect in the file are command-line only in IronDivi 0.2.5. They give no error in the file; they simply have no effect. We tried each one.
- The network.
testnet = trueorregtest = truein the file did nothing: the node still reported"chain": "main". Start it with--testnetor--regtest. - Running in the background and logging to the screen.
daemonandprinttoconsolein the file are ignored. Use--daemonand--printtoconsole. - The indexes.
txindex,spentindexandaddressindexin the file are overwritten by the command line's values. Withtxindex = falsein the file, the log still saidTransaction index enabled, because it is on by default. Withspentindex = truein the file, the spent index stayed off until we added--spentindex. - Log size.
maxlogsizeandmaxlogfilesin the file are read too late to matter. With 3 and 9 in the file, the log saidmax 1048576 bytes per file, 5 files kept. With--maxlogsize 3 --maxlogfiles 9it saidmax 3145728 bytes per file, 9 files kept.
7The command line wins
When the same setting is in the file and on the command line, both nodes use the command line. We put rpcport in each file and a different one on the command line. Each node listened only on the command-line port, and the port from the file gave couldn't connect to server.
That makes the command line handy for a one-off change, such as a different port for a test, without editing the file. There is one exception: IronDivi adds an --addnode from the command line to the file's list instead of replacing it.
The command-line tools follow the same rule. If you start a node with --rpcport on its command line, pass the same --rpcport to irondivi-cli or divi-cli, because the file still has the old one.
Changes to either file take effect only when the node restarts. Stop the C++ node with divi-cli stop. Stop IronDivi 0.2.5 with a signal, as Install IronDivi shows, because its stop command answers but does not exit.
If something goes wrong
| What you see | What to do |
|---|---|
TOML parse error … invalid string | A text value in irondivi.conf has no quotes. Write rpcuser = "name". |
duplicate key | A setting appears twice in irondivi.conf. For several nodes use a list: addnode = ["a:51474", "b:51474"]. |
incorrect rpcuser or rpcpassword from divi-cli | Remove any quotes around values in divi.conf, then restart the node. |
HTTP 401 Unauthorized from irondivi-cli | The tool read a different file or password from the node. Pass the same --datadir and --testnet to both, and keep # out of the password. |
RPC authentication disabled in IronDivi's log | Add both rpcuser and rpcpassword and restart. |
Unknown configuration key | IronDivi does not know that setting. Check the spelling against the table above, or use the command-line flag. |
| IronDivi is on the real network although the file says testnet | The network comes only from the command line. Start it with --testnet. |
A setting in divi.conf has no effect | Check the spelling: the C++ node ignores unknown lines silently. Check that no command-line option overrides it, and that the file is in the data folder, not inside testnet3. |
Next: run your node as a service so it restarts by itself, or compare the two nodes in full.