4

I heard rumors about double-spending is possible after a snapshot if you don't create new addresses. Now I have 70 addresses in my actual wallet/seed. Does that mean I have to create 71 new addresses after the snapshot?

1
  • Some users had to create more than 100 (and used scripts for that). If you know that you have that many addresses, you can avoid it by moving your funds to a new seed before the snapshot.
    – mihi
    Commented Dec 10, 2017 at 21:32

3 Answers 3

5

tl;dr version: In order to find your entire balance after a snapshot, you will need to attach the same number of addresses as you had before the snapshot.


Wait a sec, why do I even have to attach addresses in the first place?

The current IOTA Wallet released by the IOTA Foundation is stateless. This means that it doesn't store any information about your seed/addresses/balance/etc.

Every time you launch the wallet application and enter your seed, the Wallet needs to figure out which addresses you've already used, and what your total balance is — as if it was the very first time you ever logged in.1

The way that it does this is, it generates addresses one-at-a-time and then checks the Tangle to see if there are any transactions that reference that address. It continues this process until it finds an address without any transactions.

Keep that last bit in mind; it'll be important later.

There are two ways that an address might have transactions on the Tangle:

  • Someone else sends IOTAs to that address or otherwise references that address in a transaction, or
  • You create a transaction referencing that address and publish it to the Tangle.2

Again, note the consistent emphasis on the presence of transactions.

Great. So what does that have to do with snapshots?

During a snapshot, all of the transactions are deleted from the Tangle, so that only the addresses and their balances are left.

In other words, after the snapshot, none of your addresses have any transactions on the Tangle any more.

The next time you enter your seed, the wallet starts its usual process of generating addresses one-at-a-time and checking the Tangle to see if there are any matching transactions.

... except that the very first address it tries won't have any transactions, because those transactions were deleted during the snapshot.

So, the wallet thinks, "Aha! I've only generated one address, and there are no transactions that reference it. This must be a new seed! Enjoy your zero balance!!"

Um... okay, that makes sense, I guess. So, how many addresses do I have to attach then?

In order to find your entire balance after a snapshot, you will need to attach the same number of addresses as you had before the snapshot.

The next time you log in, the wallet will again generate addresses one-at-a-time, and for each address that you've attached to the Tangle, it will find a transaction (and possibly some IOTAs), so it knows to keep going and check more addresses.

Wow, that sounds really... how to put this nicely... inefficient.

To be fair, stateless wallets are pretty cool. You can open the IOTA Wallet on any device anywhere in the world, and as long as you know your seed (and your addresses are attached to the Tangle), you will have full access to your IOTAs.

Plus, there are no private keys or other valuable information stored on your hard drive for someone to steal — the only thing you have to worry about protecting is your seed.

That said, stateful wallets are pretty awesome, too. You can still access your IOTAs on any device anywhere using just your seed, but once you've logged in, your addresses and balance will stick around after every snapshot.

Hopefully future versions of the wallet will start introducing some stateful features... and we may even live to see the demise of the ATTACH TO TANGLE button.

1 I nicknamed my wallet Leonard.

2 Incidentally, this is what the ATTACH TO TANGLE button does in the Wallet interface.

1

Not true, After the last few snapshots i've created no more then 5 or so address untill all of my balanced showed up. I've had similar results in multiple wallets. As far as re-attachments, once the UCL wallet is release - Sneak peak: https://i.redd.it/qt6v8yia2q201.png

You no longer have to worry about reattachment's / wallet address recreation as this will all be automated in the background.

Hope this answers the question

1
  • If OP used 70 addresses he will have to reattach 70 addresses after a snapshot. Commented Dec 11, 2017 at 7:33
1

You will have to do as many reattachments as there are addresses that you had generated previously, I believe.

Two solutions to this in the future: stateful wallet, which will mean you don't need to manually re-attach as your addressees will be maintained locally, and more frequent local snapshotting so you don't have as many addresses to manage at once.

4
  • Sorry you are mixing stuff up. 1. The current wallet is stateless. It has to get its state from the Tangle at every action. What you mean is that the state of the wallet is stored locally instead, hence it will be a stateful wallet. 2. Snapshots have nothing to do with the amount of addresses you have to manage. In fact more frequent snapshotting means that you would have to do the reattach loop with the current wallet more frequent as well. Commented Dec 11, 2017 at 7:31
  • You're right about the stateful wallet, I got it backwards. For the snapshot part though, each time there is a snapshot old addresses are pruned, correct? So to me, each snapshot, you would have less and less addresses to re-generate.
    – aboose
    Commented Dec 11, 2017 at 18:59
  • No, addresses are not really pruned. Only transactions. The snapshot will restart from a list of all addresses with non-zero balance. But you will still have to reattach every single one you ever used manually after every snapshot. Even the empty ones. Because the wallet generates them from index 0. The wallet uses the transactions involving the addresses to keep track of which addresses it has used before. A snapshot will wipe those out. Therefore you need to reattach them all. So they show up as 0i transactions and the wallet knows they were used before. Commented Dec 11, 2017 at 20:21
  • Make sure you definitely do this, because otherwise you open yourself up to multi-spending from those previously used addresses. Commented Dec 11, 2017 at 20:22

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.