19

I have installed bitcoind on ubuntu server, and when I run screen -x for btc it says error -10 blockchain is downloading.

How do I know the progress level? currently 125600 blocks are downloaded, but how many blocks yet to go? where do i check the blockchain download progress level? does it has capability to resume if the server is powered off?

user1623521
  • 107
  • 4
Stephen Paulraj
  • 191
  • 1
  • 2
  • 3

9 Answers9

14

Do

cd /home/

then

nano block.sh

copy the code below and paste (right click if you use putty) to the script.

#!/bin/bash
while true ; do
    clear
    echo "Press enter to break loop. Script will loop every 3 seconds"
    echo "script by Nixsy 18th august 2013"
    echo "If loop freezes press CTRL+C"
    echo ""
    echo -e "    \033[31mdownloaded\e[0m/\033[32mavailable\e[0m"
    echo -e "    \033[31m"`bitcoin-cli getblockcount 2>&1`"\e[0m"/"\033[32m"`wget -O - http://blockchain.info/q/getblockcount 2>/dev/null`"\e[0m"
    read -t 3 -n 3 && break
done

When you have copied the text to nano hold CTRL+X and then press Y to save.

In terminal type or copy from below followed by the enter key.

chmod +x block.sh

to start the script type.

./block.sh

This is just a little edit of the script from Lohoris, It will clear the screen then loop the script every 3 seconds until a key press.

Credit to Lohoris for the original script.

Nick ODell
  • 29,396
  • 11
  • 72
  • 130
Nixsy
  • 141
  • 1
  • 3
8

As of 2019, you can use the following script

echo `bitcoin-cli getblockcount 2>&1`/`wget -O - http://blockchain.info/q/getblockcount 2>/dev/null`
o0'.
  • 5,240
  • 6
  • 39
  • 66
  • 2
    Using Bitcoin Core Daemon v0.14.0 Error: There is no RPC client functionality in bitcoind anymore. Use the bitcoin-cli utility instead./463021

    Simply replace "bitcoind" with "bitcoin-cli" to see progress.

    – Matt Jensen Apr 22 '17 at 15:03
6

I just installed bitcoind on an RPi and wanted to do this exact thing. Thought I'd post what worked for me:

$ bitcoin-cli getblockcount
7437

Block height is 366678 at the time of this post...long way to go

Justin O'Brien
  • 146
  • 2
  • 3
3

I wanted a nicer output.

Based off @o0'. answer ...

BC_CURRENT=`./bitcoin-cli getblockcount 2>&1`; BC_HEIGHT=`wget -O - http://blockchain.info/q/getblockcount 2>/dev/null`; perl -E "say sprintf('Block %s of %s (%.2f%%)', $BC_CURRENT, $BC_HEIGHT, ($BC_CURRENT/$BC_HEIGHT)*100)";

Outputs ...

Block 360693 of 471139 (76.56%)
farinspace
  • 131
  • 3
3
tail -f .bitcoin/debug.log

You will see the progress % in the end of every line.

2019-05-21T15:53:22Z UpdateTip: new best=00000000000007463022a75f47fbce4832d885cccfddc66b9ae6d332888f825d height=181720 version=0x00000001 log2_work=68.184645 tx=3482689 date='2012-05-26T22:08:18Z' progress=0.008422 cache=256.7MiB(1838887txo)

Here, in case you did not find it above:

... progress=0.008422 ...
3

here a bash script for see the live progress

  • create a file nano [nom fichier] and copy the code below

  • run script with bash [nom fichier]

  • stop script by type on your keyboard

Script :

sleepTime=4 #set time between updates

blocksPris=$(bitcoin-cli getblockcount)
blocksTotal=$(wget -O - http://blockchain.info/q/getblockcount 2>/dev/null)
pourcentage=$(((blocksPris*100)/blocksTotal))
input=""

tput smcup
clear
\e[25l ou tput civis
stty -echo
tput civis

while ["$input" -eq ""]
do
        echo -en "\e[1A\e[0K\r"

        echo "- $blocksPris/$blocksTotal - [$pourcentage%]"
        i=1
        echo -e "\e[47m \e[42m\c"
        while [ "$i" -lt "$pourcentage" ]
        do
                echo -e "_\c"
                i=$(( $i + 1))
        done
        echo -e "\e[41m\c"
        i=1
        while [ "$i" -lt "$((100-pourcentage))" ]
        do
                echo -e "_\c"
                i=$(( $i + 1))
        done
        echo -e "\e[47m \e[49m\c"

        sleep $sleepTime
        read -t 0.25 -N 1 input

        blocksPris=$(bitcoin-cli getblockcount)
        blocksTotal=$(wget -O - http://blockchain.info/q/getblockcount 2>/dev/null)
        pourcentage=$(((blocksPris*100)/blocksTotal))
done

tput cnorm
stty echo
tput sgr0
tput rmcup

Result: enter image description here

2

You can see the current total amount of blocks on public block chain browsers:

Steven Roose
  • 11,841
  • 8
  • 45
  • 73
2

If you have bitcoin cli installed. The below command will help.

echo `bitcoin-cli getblockcount 2>&1`/`wget -O - http://blockchain.info/q/getblockcount 2>/dev/null`

Sample output

365320/512421

This is slight improvement of above answer. But it returned Error: Command line contains unexpected token 'getblockcount', see bitcoind -h for a list of options./512421 in my case. Hope it helps someone.

SMJ
  • 141
  • 8
1

The easiest way is to run birtcoind getinfo, then compare the nHeight to a block explorer, which should give you a ratio of how completed it is. Keep in mind that earlier blocks sync fastest, so 50% of black may not be 50% of the time required to sync.

nuggetbram
  • 151
  • 1