14

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

11

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


$ wget -q -O- https://blockexplorer.com/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.

6

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 process=0.137838 means that I'm currently ~13.78% synced.

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 getinfo { "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" }

2

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
  • this is reasonably nice – tofutim Aug 28 '18 at 22:49
0

Based on @hiding_ninja response here's my masterpiece and assuming you have the configs in ~/.btcd/btcctl.conf

#!/bin/bash
count=$(btcctl -C ~/.btcd/btcctl.conf getblockcount);
echo "block count: $count";

hash=$(btcctl -C ~/.btcd/btcctl.conf getblockhash $count);
echo "block hash: $hash";

t=$(btcctl -C ~/.btcd/btcctl.conf getblock "$hash" | grep '"time"' | awk '{print $2}' | sed -e 's/,$//g');
echo "block timestamp is: $t";

cur_t=$(date +%s);
diff_t=$[$cur_t - $t];
echo -n "Difference is: ";
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}';

Then you can monitor it with

watch -n 1 ./masterpiece.sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.