<p>You can compare the block count from Blockexplorer with your local block count. Something like this:</p>
<pre><code>
$ wget -q -O- https://blockchain.info/q/getblockcount; echo
359721
$ bitcoin-cli -conf=/u0/bitcoin/bitcoin.conf getblockcount
359721
</pre></code>
<p>As you can see above my node is synched since the counter is equal.</p>

CC BY-SA 4.0
2015-06-06T18:50:17.717Z
2021-01-12T14:18:26.753Z
2021-01-12T14:18:26.753Z
Jonas Lejon
<p>bitcoind logs the current sync status to its <code>debug.log</code> file:</p>

<pre><code>$ tailf ~/.bitcoin/debug.log
2017-05-26 03:49:16 UpdateTip: new best=0000000000000001e0b7c8cffb8e7fa23909b8728913663decfaebffe24ca689 height=280022 version=0x00000002 log2_work=75.644236 tx=30854900 date='2014-01-12 03:50:07' **progress=0.137838** cache=312.7MiB(396972tx)
…
</code></pre>

<p>The field <code>progress=0.137838</code> means that I'm currently ~13.7838% synced.</p>

CC BY-SA 4.0
2017-05-26T03:57:00.767Z
2019-12-10T17:44:54.850Z
2019-12-10T17:44:54.850Z
dcoles
<p>test my masterpiece:</p>

<pre><code>#!/bin/bash
coin="$1";
if [ -z $coin ]; then
        /bin/echo "No coin given... using btc as default";
        coin="bitcoin";
fi
count=$(/usr/local/bin/${coin}-cli getblockcount);
/bin/echo "block count: $count";

hash=$(/usr/local/bin/${coin}-cli getblockhash $count);
/bin/echo "block hash: $hash";

t=$(/usr/local/bin/${coin}-cli getblock "$hash" | grep '"time"' | awk '{print $2}' | sed -e 's/,$//g');
/bin/echo "block timestamp is: $t";

cur_t=$(date +%s);
diff_t=$[$cur_t - $t];
/bin/echo -n "Difference is: ";
/bin/echo $diff_t | /usr/bin/awk '{printf "%d days, %d:%d:%d\n",$1/(60*60*24),$1/(60*60)%24,$1%(60*60)/60,$1%60}';
</code></pre>

<p>Usage:</p>

<pre><code>$ bash masterpiece.sh bitcoin
block count: 525432
block hash: 000000000000000000373849d360010906852493fc3f8e51c3b6063de1ac70e8
block timestamp is: 1527848948
Difference is: 0 days, 0:10:11
</code></pre>

CC BY-SA 4.0
2018-08-28T22:49:54.430Z
this is reasonably nice
tofutim
CC BY-SA 4.0
2018-06-01T10:44:22.957Z
2018-06-01T10:44:22.957Z
hiding_ninja
<p>29G doesn't look after fully synced up.</p>

<p>But you should use bitcoin-cli (RPC command line app).</p>

<p>Do <code>bitcoin-cli getinfo</code> (check the "blocks" value and compare against blockchain or another full node) or <code>bitcoin-cli getchaintips</code> (more complicated to read)</p>

<p>Example:</p>

<pre><code>:~/node/bitcoin$ ./src/bitcoin-cli getblockchaininfo
{
    "version" : 109900,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 359646,  // &lt;--------------
    "timeoffset" : 0,
    "connections" : 63,
    "proxy" : "",
    "difficulty" : 47589591153.62500763,
    "testnet" : false,
    "keypoololdest" : 1425569670,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
}
</code></pre>

CC BY-SA 4.0
2015-06-06T07:46:39.007Z
2020-02-24T13:48:13.117Z
2020-02-24T13:48:13.117Z
Jonas Schnelli
<p>Extending the work done by <em>hiding_ninja</em>, I have crafter a script that gives you a readable answer if the node is reasonably in sync. (Last block less than 30 minutes old)</p>
<p>It does some extra error checking that help debug wrong parameters or common mistakes as trying to use CLI with the node not running.</p>
<pre><code>#!/bin/bash

# Default Parameters
clis_path=/opt/bin/
configs_path=$HOME
max_allowed_last_block_age=1800 # 30 Minutes expressed in seconds


coin=&quot;$1&quot;;

if [ -z $coin ]; then
        /bin/echo &quot;ERR: No coin selected. Usage example 'syncstate bitcoin'&quot;;
        exit 1;
fi
coin_cli=&quot;${clis_path}${coin}-cli&quot;

if [ ! -f ${coin_cli} ]; then
    echo &quot;ERR: The selected coin is not available or you should modify the clis_path variable&quot;
    exit 2
fi

coin_cli=&quot;${coin_cli} -conf=${configs_path}/.${coin}/${coin}.conf&quot;

count=$(${coin_cli} getblockcount);

RESULT=$?
if [ $RESULT != 0 ]; then
  echo &quot;ERR: The cli does not seem to be available. Maybe the node is not running or rpc is not enabled?&quot;
  exit 3
fi


hash=$(${coin_cli} getblockhash $count);

t=$(${coin_cli} getblock &quot;$hash&quot; | grep '&quot;time&quot;' | awk '{print $2}' | sed -e 's/,$//g');



cur_t=$(date +%s);
diff_t=$[$cur_t - $t];
if (( $diff_t &lt;= max_allowed_last_block_age )); then
        echo &quot;&quot;
        echo &quot;${coin} is in synch. Last block is ${diff_t} seconds old.&quot;
        echo &quot;&quot;
else
        echo &quot;WARNING:&quot;
        echo &quot;${coin} node could be NOT in synch. Details:&quot;
        echo &quot;Last block hash: $hash&quot;;
        echo &quot;Last block timestamp is: $t&quot;;
        echo &quot;Last block count: $count&quot;;
        echo -n &quot;Last synched ${coin} block is: &quot;;
        echo $diff_t | /usr/bin/awk '{printf &quot;%ddays %dhours %dminutes %dseconds old\n&quot;,$1/(60*60*24),$1/(60*60)%24,$1%(60*60)/60,$1%60}';
        echo &quot;&quot;
fi
</code></pre>

CC BY-SA 4.0
2020-12-24T13:40:48.683Z
2020-12-24T13:40:48.683Z
Luca Ambrosini
<p>Run:</p>
<pre><code>bitcoin-cli getblockchaininfo
</code></pre>
<p>.. and check response. For example, this node is not synchronized yet:</p>
<pre><code>{
  &quot;chain&quot;: &quot;main&quot;,
  &quot;blocks&quot;: 624371,
  &quot;headers&quot;: 726916,
  ...
</code></pre>

CC BY-SA 4.0
2022-03-12T00:41:46.433Z
2022-03-12T00:41:46.433Z
Nulldevice
<p>I found the easiest way to do this:</p>

<pre><code>tail -n 1  ~/.bitcoin/debug.log | grep -Po 'progress=\K.*?(.*)\s'
</code></pre>

CC BY-SA 4.0
2020-04-30T08:07:23.187Z
2020-04-30T15:21:47.437Z
2020-04-30T15:21:47.437Z
iman
<p>I installed the bitcoind and started it as daemon.
After 10hours I've tried "du -h"</p>

<pre><code>ubuntu@ip-172-31-37-93:~/.bitcoin$ du -h
16K     ./database
59M     ./blocks/index
29G     ./blocks
646M    ./chainstate
30G     . 
</code></pre>

<p>How to know if it synced or not?</p>

<p>UPD found an interesting script to monitor node sync status <a href="https://bitcoin.stackexchange.com/questions/10859/how-to-check-bitcoind-block-chain-download-progress-level/12734#12734">How to check Bitcoind block chain download progress level</a></p>

<bitcoind><synchronization>
How to know if bitcoind synced?
Igor Barinov
# How to know if bitcoind synced?

(Asked by: username_0 on 2015-06-06)

I installed the bitcoind and started it as daemon.
After 10hours I've tried "du -h"

```
ubuntu@ip-172-31-37-93:~/.bitcoin$ du -h
16K     ./database
59M     ./blocks/index
29G     ./blocks
646M    ./chainstate
30G     . 

```

How to know if it synced or not?

UPD found an interesting script to monitor node sync status [How to check Bitcoind block chain download progress level](https://bitcoin.stackexchange.com/questions/10859/how-to-check-bitcoind-block-chain-download-progress-level/12734#12734)

**Tags:** bitcoind, synchronization


---

## 7 answers

### Answer by username_1 on 2015-06-06. Score: 18

You can compare the block count from Blockexplorer with your local block count. Something like this:

```

$ wget -q -O- https://blockchain.info/q/getblockcount; echo
359721
$ bitcoin-cli -conf=/u0/bitcoin/bitcoin.conf getblockcount
359721

```

As you can see above my node is synched since the counter is equal.


---

### Answer by username_2 on 2017-05-26. Score: 12

bitcoind logs the current sync status to its `debug.log` file:

```
$ tailf ~/.bitcoin/debug.log
2017-05-26 03:49:16 UpdateTip: new best=0000000000000001e0b7c8cffb8e7fa23909b8728913663decfaebffe24ca689 height=280022 version=0x00000002 log2_work=75.644236 tx=30854900 date='2014-01-12 03:50:07' **progress=0.137838** cache=312.7MiB(396972tx)
…

```

The field `progress=0.137838` means that I'm currently ~13.7838% synced.


---

### Answer by username_3 on 2018-06-01. Score: 3

test my masterpiece:

```
#!/bin/bash
coin="$1";
if [ -z $coin ]; then
        /bin/echo "No coin given... using btc as default";
        coin="bitcoin";
fi
count=$(/usr/local/bin/${coin}-cli getblockcount);
/bin/echo "block count: $count";

hash=$(/usr/local/bin/${coin}-cli getblockhash $count);
/bin/echo "block hash: $hash";

t=$(/usr/local/bin/${coin}-cli getblock "$hash" | grep '"time"' | awk '{print $2}' | sed -e 's/,$//g');
/bin/echo "block timestamp is: $t";

cur_t=$(date +%s);
diff_t=$[$cur_t - $t];
/bin/echo -n "Difference is: ";
/bin/echo $diff_t | /usr/bin/awk '{printf "%d days, %d:%d:%d\n",$1/(60*60*24),$1/(60*60)%24,$1%(60*60)/60,$1%60}';

```

Usage:

```
$ bash masterpiece.sh bitcoin
block count: 525432
block hash: 000000000000000000373849d360010906852493fc3f8e51c3b6063de1ac70e8
block timestamp is: 1527848948
Difference is: 0 days, 0:10:11

```

> **Comments:**
> **username_4**: this is reasonably nice  

---

### Answer by username_5 on 2015-06-06. Score: 2

29G doesn't look after fully synced up.

But you should use bitcoin-cli (RPC command line app).

Do `bitcoin-cli getinfo` (check the "blocks" value and compare against blockchain or another full node) or `bitcoin-cli getchaintips` (more complicated to read)

Example:

```
:~/node/bitcoin$ ./src/bitcoin-cli getblockchaininfo
{
    "version" : 109900,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 359646,  // <--------------
    "timeoffset" : 0,
    "connections" : 63,
    "proxy" : "",
    "difficulty" : 47589591153.62500763,
    "testnet" : false,
    "keypoololdest" : 1425569670,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
}

```


---

### Answer by username_6 on 2020-12-24. Score: 1

Extending the work done by *hiding\_ninja*, I have crafter a script that gives you a readable answer if the node is reasonably in sync. (Last block less than 30 minutes old)

It does some extra error checking that help debug wrong parameters or common mistakes as trying to use CLI with the node not running.

```
#!/bin/bash

# Default Parameters
clis_path=/opt/bin/
configs_path=$HOME
max_allowed_last_block_age=1800 # 30 Minutes expressed in seconds

coin="$1";

if [ -z $coin ]; then
        /bin/echo "ERR: No coin selected. Usage example 'syncstate bitcoin'";
        exit 1;
fi
coin_cli="${clis_path}${coin}-cli"

if [ ! -f ${coin_cli} ]; then
    echo "ERR: The selected coin is not available or you should modify the clis_path variable"
    exit 2
fi

coin_cli="${coin_cli} -conf=${configs_path}/.${coin}/${coin}.conf"

count=$(${coin_cli} getblockcount);

RESULT=$?
if [ $RESULT != 0 ]; then
  echo "ERR: The cli does not seem to be available. Maybe the node is not running or rpc is not enabled?"
  exit 3
fi

hash=$(${coin_cli} getblockhash $count);

t=$(${coin_cli} getblock "$hash" | grep '"time"' | awk '{print $2}' | sed -e 's/,$//g');

cur_t=$(date +%s);
diff_t=$[$cur_t - $t];
if (( $diff_t <= max_allowed_last_block_age )); then
        echo ""
        echo "${coin} is in synch. Last block is ${diff_t} seconds old."
        echo ""
else
        echo "WARNING:"
        echo "${coin} node could be NOT in synch. Details:"
        echo "Last block hash: $hash";
        echo "Last block timestamp is: $t";
        echo "Last block count: $count";
        echo -n "Last synched ${coin} block is: ";
        echo $diff_t | /usr/bin/awk '{printf "%ddays %dhours %dminutes %dseconds old\n",$1/(60*60*24),$1/(60*60)%24,$1%(60*60)/60,$1%60}';
        echo ""
fi

```


---

### Answer by username_7 on 2022-03-12. Score: 0

Run:

```
bitcoin-cli getblockchaininfo

```

.. and check response. For example, this node is not synchronized yet:

```
{
  "chain": "main",
  "blocks": 624371,
  "headers": 726916,
  ...

```


---

### Answer by username_8 on 2020-04-30. Score: 0

I found the easiest way to do this:

```
tail -n 1  ~/.bitcoin/debug.log | grep -Po 'progress=\K.*?(.*)\s'

```


---

