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

1 Answer 1


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.

  • This worked, thanks a lot! the only change is the flags need to come after geth and before init as stated here
    – Div
    Commented Jul 27, 2020 at 11:00
  • Unfortunately bounty has ended :(
    – Div
    Commented Jul 27, 2020 at 11:01
  • 1
    No problem for the bounty, if I can I respond to questions in any case :) I fixed the syntax as you reported. Commented Jul 27, 2020 at 14:06
  • Hey, I have some further questions. here, here, here and here Would be great if you can help there.
    – Div
    Commented Aug 27, 2020 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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