What does Geth export-preimages /import-preimages do?


geth stores the ethereum world state in a trie. This try uses images within the tree. So for instance, the balance for address 0x0000000000000000000000000000000000000000 is not stored in a node indexed by 0x0000000000000000000000000000000000000000, but in one indexed by sha3(0x0000000000000000000000000000000000000000).

geth has also had support for dumping this world state via geth dump for quite some time. This dumps the entire state trie out to file. However, it only includes the sha3(key) values, and not the key values. Due to this, while it was possible to look up the information for any known address (by computing its sha3 hash and checking that element in the dump), it was not possible to go the other way around, making it hard to do large scale analysis.

The import and export preimage options solve this, by allowing you to dump the preimages out to disk, along with their corresponding image. You can also then export the same data back, allowing you to export it from an archival node (which is required for a complete image set), and into a node with a full or fast sync.

  • Can i use this for backup and restoration purpose.
    – Nathan Aw
    Jul 28 '18 at 6:25
  • You want geth export and geth import for that. You can only use them to back up a full or archival node, tho. A fast sync won't work. Jul 28 '18 at 6:58

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.