21

I am using geth client (VERSION: 1.4.12-stable-421df866) to sync to the Ethereum testnet. To check the status of the sync, I ran web3.eth.syncing in the geth console. This is the output I see:

{ 
    currentBlock: 1743872,
    highestBlock: 1744966,
    knownStates: 1193229,
    pulledStates: 1143482,
    startingBlock: 1732018
}

Every time I check the status, knownStates value keeps going up.

  1. What does knownStates mean in the above output?
  2. How do I find out how far I am from being completely in sync with the testnet blockchain?
11

during fast sync, web3.eth.syncing downloads the state trie.

knownStates is the number of trie nodes that the sync algo knows about

pulledStates is the number it already downloaded there's no way to know in advance how much state entries there are and I haven't figured out a meaningful statistical way to estimate it, current mainnet is around 2.8M.

| improve this answer | |
  • Where did you pull the number of 2.8M? It would be helpful to know how to find this, to get some kind of measure of progress during the horrendously long sync process. – Nuzzolilo Apr 29 '18 at 11:43
  • from the command eth.syncing excuted in a full node connected to mainnet. this was in 2016!! – Badr Bellaj Apr 29 '18 at 12:08
9

From the code:

// SyncProgress gives progress indications when the node is synchronising with
// the Ethereum network.
type SyncProgress struct {
    StartingBlock uint64 // Block number where sync began
    CurrentBlock  uint64 // Current block number where sync is at
    HighestBlock  uint64 // Highest alleged block number in the chain
    PulledStates  uint64 // Number of state trie entries already downloaded
    KnownStates   uint64 // Total number os state trie entries known about
}
| improve this answer | |
3

I will venture that:

  1. Each block contains the Merkle root of the transactions, plus the Merkle root of the whole system state. The state is computed from the history of transactions. By loading just blocks, which is fairly fast, Geth can only know the Merkle root of all states. It then needs to fetch the transactions and compute those states, which is slow. My take is that knownStates indicates where it is at in the computation. In fact, instead of computing the state, Geth can also choose to download it from cooperating nodes. I believe this is what pulledStates is, although I could be wrong.
  2. highestBlock is how far it has to go, roughly, as it apparently does not update this value while syncing. Look at Etherscan for a more up to date block number.
| improve this answer | |

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.