28

Have a Geth 1.5.5 node running on a raspberry pi 3. When I type in

sudo systemctl status geth

I'll get ever changing time and block information. Neat, but how do I know when I am synced up? Is there another sudo command I should do?

37

Continuing to research, need to enter the geth node console to enter special commands. The following works:

geth attach

Sends user to the geth node console.

eth.syncing

Produces a result like current block: 82,100; highest block 2,910,032.

exit

To go back to Pi prompt.

  • 5
    when I am typing eth.syncing just getting false printed – sreginogemoh Jun 24 '17 at 3:45
  • Wait a few seconds and it will prompt a result – Coren Jul 4 '17 at 8:58
  • 1
    @Coren you can wait forever – NineCattoRules Sep 14 '17 at 16:21
  • You pretty much need a supercomputer to run Ethereum nowadays. – Dagelf Dec 25 '17 at 18:58
  • 2
    geth syntax for windows: geth attach ipc:\\.\pipe\geth.ipc – naXa Jun 30 '18 at 16:06
23

After running your normal geth --fast command you can open a new window and run the "geth attach" command as this will attach you to the javascript interface

$ geth attach

Then you can use this script to have a nice output of what is happening. It is very rudimentary but works really well to give you an idea of how long you will still need to wait. First wait 10 seconds (as the first ETA is incorrect) then after the second display of estimates you will start to see the actual numbers.

var lastPercentage = 0;var lastBlocksToGo = 0;var timeInterval = 10000;
setInterval(function(){
    var percentage = eth.syncing.currentBlock/eth.syncing.highestBlock*100;
    var percentagePerTime = percentage - lastPercentage;
    var blocksToGo = eth.syncing.highestBlock - eth.syncing.currentBlock;
    var bps = (lastBlocksToGo - blocksToGo) / (timeInterval / 1000)
    var etas = 100 / percentagePerTime * (timeInterval / 1000)

    var etaM = parseInt(etas/60,10);
    console.log(parseInt(percentage,10)+'% ETA: '+etaM+' minutes @ '+bps+'bps');

    lastPercentage = percentage;lastBlocksToGo = blocksToGo;
},timeInterval);

This will give you an output similar to this:

85% ETA: 573 minutes @ 134.4bps
86% ETA: 533 minutes @ 144.3bps
86% ETA: 442 minutes @ 173.9bps
  • Hello, this helps me a lot to see the ETAs being continuously printed in the terminal. I would choose this as the answer if I were to ask the question. – Arefe Dec 20 '17 at 2:19
  • 1
    Or like this: 99% ETA: 399672 minutes @ 0.2bps 99% ETA: 399672 minutes @ 0.2bps 99% ETA: 399672 minutes @ 0.2bps 99% ETA: 399672 minutes @ 0.2bps 99% ETA: 399672 minutes @ 0.2bps Ethereum is dead to me. – Dagelf Dec 25 '17 at 18:58
  • 1
    @Dagelf you're probably "stuck" on state trie syncing. read more about in this issue github.com/ethereum/go-ethereum/issues/… (find comments by maintainer karalabe) – naXa Jun 30 '18 at 16:43
3

While running geth sync process, I used geth attach and then used eth.syncing on geth console.

eth.syncing on "geth attach" console.

I could get block info. And if you're just after running geth command itself, you need to wait until geth starts "real" syncing process. Otherwise you'll see false.

geth version result

Geth
Version: 1.7.2-stable
Git Commit: 1db4ecdc0b9e828ff65777fb466fc7c1d04e0de9
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.1
Operating System: darwin
GOPATH=
GOROOT=/usr/local/Cellar/go/1.9.1/libexec
1

Firstly you will need to connect to the running geth process from a second terminal

$ geth attach

As the other answers have stated the structure you are interested is eth.syncing

To see the remaining blocks you could do

> eth.syncing.highestBlock - eth.syncing.currentBlock

And for the remaining states

> eth.syncing.knownStates - eth.syncing.pulledStates
0

You can use web3.eth.syncing, i.e.:

server:~# geth attach
> web3.eth.syncing
{
  currentBlock: 4504031,
  highestBlock: 4660759,
  knownStates: 31357681,
  pulledStates: 31357680,
  startingBlock: 4504031
}

Or the same as above but async using getSyncing:

web3.eth.getSyncing(callback(error, result){ ... })
-1

Eth syncing percent:

eth.syncing.currentBlock * 100 / eth.syncing.highestBlock
  • 1
    That formula works when you are syncing in full mode. In fast mode a large part is downloading states and the formula doesn't take that into account. – Ismael Jul 7 at 17:40

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.