What does Geth export-preimages /import-preimages do?
1 Answer
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.
-
-
You want
geth export
andgeth import
for that. You can only use them to back up a full or archival node, tho. A fast sync won't work. Commented Jul 28, 2018 at 6:58