TransWikia.com

Invalid block XX: unknown ancestor while restoring the chain - private blockchain

Ethereum Asked by Div on August 26, 2021

I’m trying to restore blockchain using import a rlp file

geth import backup.rlp

It show an error

enter image description here

Is there any way to exclude the bad blocks while exporting the chain data?

Also, if the gcmode is archive then only can get past data of smart contract state?

Geth version: 1.8.16

One Answer

Looking at the image, it seems to me you are importing the backup of a private network to a node initializated with the Mainnet.

I suspect this because:

  • geth says ChainID is 1, so Mainnet
  • the import process seems to stop with the very first block and the error is unknown ancestor, so it don't know the genesis block
  • your block #1 hash is not the hash of the first block of the Mainnet, that is 0x88e96d4537bea4d9c05d12549907b32561d3bf31f45aae734cdc119f13406cb6

If this is the case, just remove the geth database:

$ geth removedb

and init again with the correct genesis block:

$ geth --networkid [yourNetworkID] init [yourGenesisFile.json]

If you don't remember the networkID, you should be able to read it in the genesis file.

Correct answer by Giuseppe Bertone on August 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP