<p>The first thing Bitcoin-QT does is verify that the data stored on the disk is valid. Among other checks this includes verifying the last 288 blocks (the past two days in expectation). This task involves a large number of signature checks and will take some time to complete. Only after the startup checks have successfully completed will the connections to the Bitcoin Network be established and only then the client will start listening for incoming JSON-RPC requests.</p>

CC BY-SA 3.0
2016-10-01T15:04:43.937Z
@PeterMunnings: Good one, thanks. I had the same problem -- although I'm about 90% sure that it used to work without it before.
Priidu Neemre
CC BY-SA 3.0
2016-10-02T13:02:39.930Z
If you add `testnet=1` to your main `bitcoin.conf` then the `bitcoin-cli` will work with testnet without having to specify it on the command line. Add `-testnet=0` on the command line to bypass that for mainnet.
cdecker
CC BY-SA 3.0
2015-09-14T08:05:13.427Z
another gotcha - I was running the testnet.  couldn't get bitcoin-cli to work until I added -testnet (i.e. bitcoin-cli -testnet getinfo)
Peter Munnings
CC BY-SA 3.0
2014-01-10T10:21:12.787Z
2014-01-10T10:21:12.787Z
cdecker
<p>After starting bitcoin from the command line, with:</p>

<pre><code>./bitcoind -daemon
</code></pre>

<p>I immediately run the followup command:</p>

<pre><code>./bitcoind getinfo
</code></pre>

<p>which gives me the following error:</p>

<blockquote>
  <p><code>error: couldn't connect to server</code></p>
</blockquote>

<p>This error lasts from a few seconds to a few minutes depending on the machine.</p>

<p>Two questions:</p>

<ol>
<li>What is Bitcoin doing during this time, that causes this error (i.e. prevents the client from returning the results of <code>getinfo</code>)?</li>
<li>Are there any steps I can take that will minimize this start-up time?</li>
</ol>

<bitcoind><server><error>
Why does bitcoind say "error: couldn't connect to server" for the first few minutes of boot-up?
schulwitz
# Why does bitcoind say "error: couldn't connect to server" for the first few minutes of boot-up?

(Asked by: username_0 on 2014-01-10)

After starting bitcoin from the command line, with:

```
./bitcoind -daemon

```

I immediately run the followup command:

```
./bitcoind getinfo

```

which gives me the following error:

> `error: couldn't connect to server`

This error lasts from a few seconds to a few minutes depending on the machine.

Two questions:

1. What is Bitcoin doing during this time, that causes this error (i.e. prevents the client from returning the results of `getinfo`)?
2. Are there any steps I can take that will minimize this start-up time?

**Tags:** bitcoind, server, error


---

## 1 answers

### Answer by username_1 on 2014-01-10. Score: 11 | Accepted answer

The first thing Bitcoin-QT does is verify that the data stored on the disk is valid. Among other checks this includes verifying the last 288 blocks (the past two days in expectation). This task involves a large number of signature checks and will take some time to complete. Only after the startup checks have successfully completed will the connections to the Bitcoin Network be established and only then the client will start listening for incoming JSON-RPC requests.

> **Comments:**
> **username_3**: another gotcha - I was running the testnet.  couldn't get bitcoin-cli to work until I added -testnet (i.e. bitcoin-cli -testnet getinfo)  
> **username_2**: @username_3: Good one, thanks. I had the same problem -- although I'm about 90% sure that it used to work without it before.  
> **username_1**: If you add `testnet=1` to your main `bitcoin.conf` then the `bitcoin-cli` will work with testnet without having to specify it on the command line. Add `-testnet=0` on the command line to bypass that for mainnet.  

---

