6

We are in the middle of the January 2018 snapshot. Time to understand the inner workings.

First: The upcoming IRI update includes a long list of addresses and balances.

However, strictly speaking there is no such entity as an address on the tangle. There are only transactions. The sum of all non-zero transactions pointing towards address A constitute its balance.

Now, a snapshot removes all zero-transactions from the tangle but doesn’t touch those with value. Is this correct?

If it is: Why do we need Snapshot.txt at all?

Second: How does IRI make use of Snapshot.txt? Does it use it to seed an (empty / new) database? Is reading it into memory and performing lookups?

ralf
  • 1,063
  • 5
  • 10
  • Hunting down how all of this works, as far as I understand the IRI codebase, Snapshot.txt is read on every IRI start triggered by this line: https://github.com/iotaledger/iri/blob/27aae832094f91276ebf41544f4f7cb5f14be0ab/src/main/java/com/iota/iri/Iota.java#L83. The question remains, how bundles based off of the initial milestone are built. – ralf Jan 28 '18 at 21:20

1 Answers1

5

A snapshot removes all transactions from the tangle, and only keeps the balances. The balances at snapshot time (you can verify them if you are running a full node right now) are moved into Snapshot.txt instead. Also the minimum milestone number and minimum transaction time gets increased a bit (to avoid new nodes to see old transactions from before the snapshot).

When the new iri is released, the Coordinator will create a new milestone with the milestone number in MILESTONE_START_INDEX approving NULL_HASH (i. e. 999⋯9) twice. This will be seen by iri as the initial milestone (compare to genesis block on a blockchain) and this milestone is considered by iri to have the balances that are in Snapshot.txt.

A new tangle will then grow from this transaction until it gets too big again, and the snapshot process repeats.

mihi
  • 7,324
  • 2
  • 15
  • 34