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 keeps each network in its own folder with its own irondivi.conf, and the network normally comes from the command line (--testnet). Since version 0.2.6 it also obeys testnet = true in the file: with that line in ~/.irondivi/irondivi.conf and no --testnet, our node started on testnet, kept reading that same file and put its data in ~/.irondivi/testnet. Version 0.2.5 ignored the line. 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. Since 0.2.6 the divi.conf form works too. |
| Text values | No quotes | Double quotes in TOML |
| 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"], or (since 0.2.6) the line repeated |
| 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 0.2.6 reads a file as TOML when the whole file is valid TOML. If it is not, it reads it line by line the way the C++ node does: one key=value per line, the line repeated for several values, and quotes around a value dropped. So each of these started our 0.2.6 node with a working password, where 0.2.5 refused to start:
# a divi.conf-style file rpcuser=tutf rpcpassword=the-random-password addnode=127.0.0.1:1 addnode=127.0.0.1:2 # TOML with the quotes forgotten rpcuser = tutf rpcpassword = the-random-password # TOML with a setting written twice addnode = "127.0.0.1:1" addnode = "127.0.0.1:2"
With the first and last file the node tried both addnode peers. IronDivi 0.2.5 stopped at once on each of them, with TOML parse error … invalid string, or duplicate key `addnode` in document root.
The C++ node is stricter about quotes: it starts happily with them, 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 = "app.irondivi.com: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 rpcuser or rpcpassword, IronDivi 0.2.6 writes a random name and password into a file called .cookie in the data folder when it starts, and deletes it when it stops. irondivi-cli reads that file, as long as you give it the same --datadir and network as the node. The log says which you have:
INFO irondivid: RPC cookie authentication: "/home/you/.irondivi/testnet/.cookie" WARN irondivid: Only one of rpcuser/rpcpassword is set; using cookie authentication
The second line means you set one of the two and forgot the other. IronDivi 0.2.5 had no such fallback: it opened the command port with no check at all and logged RPC authentication disabled: set both rpcuser and rpcpassword. If you see that line, you are on 0.2.5; upgrade, or 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.6 acts on the settings below. Anything else gets the "Unknown configuration key" warning. The rows marked new did not exist in 0.2.5.
| 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 |
| testnet = true regtest = true | Which network, when the command line does not say | The real network |
| daemon = true | Run in the background, as --daemon does | Stays in the terminal |
| printtoconsole = true | Write the log to the screen instead of debug.log | Writes debug.log |
| txindex = false spentindex = true addressindex = true | Turn the indexes off or on | Transaction index on, the other two off |
| maxlogsize = 3 maxlogfiles = 9 | Size of one log file in MB, and how many to keep | 1 MB, 5 files |
| debug = 1 | Extra detail in the log | Normal logging |
| proxy = "127.0.0.1:9050" | New. Make outgoing connections through Tor or another SOCKS5 proxy. See Run your node over Tor. | Direct connections |
| checkblocks = 100 | New. How many of the newest blocks to check at start; 0 checks all | 100 |
| stakesplitthreshold = 20000 | New. The split size in DIVI that getstakingstatus reports | 20000 |
| expire = "30d" | New. Throw away block data older than this, to stake without the whole chain | Keep everything |
| fullnode = "…" | New. A node with the whole chain to stay connected to, so a node that throws data away can fetch old blocks | None |
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 0.2.5 ignored in the file
IronDivi 0.2.5 read some settings from the file but did nothing with them: the network, daemon, printtoconsole, the indexes and the log size. Only the command line worked. Version 0.2.6 obeys all of them. We tried each one on 0.2.6, with nothing for it on the command line:
- The network. With
regtest = truein the file the node reported"chain": "regtest", and withtestnet = trueit reported"chain": "test". 0.2.5 still said"chain": "main". - Running in the background and logging to the screen. With
daemon = truethe node went to the background and gave the terminal back. Withprinttoconsole = truethe log came to the screen and nodebug.logwas written. - The indexes. With
txindex = falsethe log had noTransaction index enabledline. Withspentindex = trueit saidSpent index enabled. In 0.2.5 the command line's values always won, even when it gave none. - Log size. With
maxlogsize = 3andmaxlogfiles = 9the log saidmax 3145728 bytes per file, 9 files kept. 0.2.5 saidmax 1048576 bytes per file, 5 files keptwhatever the file held.
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.6 with irondivi-cli stop, or with a signal as Install IronDivi shows. (The stop command of IronDivi 0.2.5 answers but does not exit; on 0.2.5 use the signal.)
If something goes wrong
| What you see | What to do |
|---|---|
TOML parse error … invalid string | You are on IronDivi 0.2.5, and a text value in irondivi.conf has no quotes. Write rpcuser = "name", or upgrade: 0.2.6 reads it. |
duplicate key | You are on IronDivi 0.2.5, and a setting appears twice in irondivi.conf. For several nodes use a list: addnode = ["a:51474", "b:51474"], or upgrade. |
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 | That is IronDivi 0.2.5 with no password: anyone on the computer can use the wallet. Add both rpcuser and rpcpassword and restart, or upgrade. |
Only one of rpcuser/rpcpassword is set in IronDivi's log | Add the missing one and restart. Until then the node uses its .cookie login. |
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 | On 0.2.5 the network comes only from the command line: start it with --testnet. On 0.2.6, check the Loaded config from line at the top of the log: the node read a different file. |
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.