Jump to: navigation, search

How to Speed-up the Initial Program Start

Revision as of 03:43, 11 July 2016 by SnakeJG (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Starting ("synchronizing") a newly installed Namecoin-Qt or namecoind on a standard harddisk can take up to 50 hours, mostly depending on the access time of the harddisk. A slow internet connection or a slow CPU can also contribute to a long synchronization time, but to a much smaller extent. There are a few things you can do to reduce the start-up time substantially, though.

Caveat: If you already own a wallet.dat file, make sure your wallet.dat is saved to an external memory device (USB stick, external harddisk, SD card, CD, or similar).

First of all you should deactivate the Energy Saver, Screen Saver and Auto-Logout options as they can throttle some of the hardware components or (when using Namecoin-Qt) interfere with the internal Qt status during the synchronization phase.

Example 1, MS-Windows 8:
... t.b.a. ...

Example 2, Mac OS X:
System Preferences → Energy Saver → Power Adapter (assuming the Power Adapter is connected to your Mac) → Computer Sleep: Never
System Preferences → Desktop & Screen Saver → Screen Saver → Start Screen Saver: Never
System Preferences → Security → General, deactivate Logout after xx minutes of inactivity

Start with -printtoconsole and/or -dbcache=400

Pro: Each one reduces the synchronization time by 10 to 20 percent. Both arguments combined, the time saving can be up to 30 percent.
Con: The file debug.log will not contain any relevant information if ‑printtoconsole is used. This is only a small disadvantage as for debugging purposes the debug.log file is of limited use.
If you later want to keep track of your activities or experiment with the name_debug commands you can stop and restart the namecoin client without ‑printtoconsole. This creates a debug.log file without the unwanted data from the initialization process.

Example 1, namecoind on Linux or Mac OS X:

./namecoind -printtoconsole -dbcache=400

Example 2, Namecoin-Qt on Mac OS X:

cd /Users/<most likely your username>/<folder containing Namecoin-Qt.app> 
Namecoin-Qt.app/Contents/MacOS/Namecoin-Qt -printtoconsole -dbcache=400

If -printtoconsole is used you can watch the synchronization process in detail. Synchronization is completed as soon as a line starting with SetBestChain contains a height= field that reflects the current block number[1], e.g.
SetBestChain: new best=d41abf35f2564f3f4e60 height=215963 work=490408062529939314692460

Redirecting the output a command running -printtoconsole to /dev/null for Linux/Mac OS X or to NUL for Windows can result in an additional time savings, but will not display any information. To check your progress, monitor the CPU and network usage or restart without redirecting the output to see where you are.

Re-use already downloaded blockchain data: run the old and the new client versions simultaneously on the same machine

If you already have a synchronized old namecoin client and you want to upgrade to completely different version (e.g. from Namecoin-Qt to Namecoin Core) you can re-use the already downloaded blockchain data. This can be done by connecting the new client to the old client locally on the same machine. The new client then fetches the blockchain data from the old client.
Pro: This alone can reduce start-up time from 50 hours down to a few hours, or even less on an SSD.
Con: If you confuse directory names, port numbers or config files you may cause unwanted effects. Furthermore, the blockchain data exists on your computer twice, i.e. you need harddisk space for two fully downloaded blockchains during this synchronization setup.

(1) Stop all cryptocurrency clients including the old Namecoin client and any Bitcoin/Litecoin/etc. clients,
(2) backup wallet.dat to an external storage medium,
(3) move (or rename) the old datadir and the old executable to a different directory,
(4) install the new client to Namecoin's standard directories,
(5) start the old client with the relevant -datadir= and -conf= arguments, and add -port=8335 and -rpcport=8337,
(6) start the new client with -connect= and -printtoconsole and -dbcache=400,
(7) as soon as the new client has finished synchronizing, stop both clients,
(8) copy wallet.dat to your new client's data directory,
(9) restart the new client. If it doesn't recognize the names or coins of the old wallet, then stop again and restart with -upgradewallet -rescan -reindex

By the way, if you want to downgrade (e.g. connect an old client software to the new Namecoin Core client) you may need to use the
-externalip and the -listen argument. Refer to http://en.bitcoin.it/wiki/Running_Bitcoin accordingly.

Run your namecoin client on an SSD

Pro: On an SSD the initial synchronization takes only 4 to 5 hours. Combined with using the ‑printtoconsole and ‑dbcache parameters (see above), synchronization may finish within less than 2 hours.
Con: The lifetime of your SSD can be reduced substantially if you run namecoin or bitcoin software on a low-cost SSD ("multi-level cell SSD", sometimes refered to as ECO or EVO model). This risk is much lower if you use ‑printtoconsole and ‑dbcache (see above).

If you own a computer with both an SSD and a harddisk, make sure you know where your namecoin datadir is. This is not necessarily the directory containing the program. However, you can specify where you want to keep your datadir. In this case use the -datadir= argument. From then on, always use the ‑datadir parameter, otherwise you inadvertently create several namecoin data directories. Even worse, you may end up with several wallet.dat files (containing your Namecoins and your reserved names) scattered all over the different directories.