4

For example, how can a wallet determine what addresses correspond to a given seed (before and after a snapshot)?

1 Answer 1

5

An address is generated from a private key.

A private key is generated from any random 81 trytes (e.g. a seed)

If you want to know how this generating works in detail, you should look at the implementations in the GitHub. (e.g. here in PyOTA) It's basically just a lot of Kerl/Curl hashing.

Since we want to create more than 1 private key from a seed, we do this:

  • private key 0 is generated from seed
  • private key 1 is generated from seed + 1
  • private key 2 is generated from seed + 2
  • private key 3 is generated from seed + 3
  • ...

Since the seed consists of trytes, it's basically just a number in ternary format, so we can add to it.


If you already used the first 10 addresses of your seed, you could theoretically use seed + 10 as your new seed and you would still see your total balance in a wallet.

I made a program that does exactly that. It trims your seed so that your used addresses aren't generated anymore when you log in to a wallet.

(Here is the part where I add a number to a seed.)

7
  • 1. In a wallet, should there be the ability to generate a new address at a user's request or should a new address be generated automatically under certain circumstances (e.g., after an old address has been used as the input of some transaction)?
    – new_xxx
    Commented Feb 15, 2018 at 18:12
  • 2. Should a wallet store or in some way keep track of all the addresses it has generated? Also, should it mostly ignore the “used” addresses and use only the “active” one(s) in a meaningful way?
    – new_xxx
    Commented Feb 15, 2018 at 18:12
  • 3. And why do they say that addresses should be regenerated in a wallet after a snapshot? Isn’t it so that a wallet should constantly have all the required info about its addresses, why does a snapshot require it to take some extra steps to reobtain such info?
    – new_xxx
    Commented Feb 15, 2018 at 18:12
  • 1. both have advantages and disadvantages, depends on circumstances and opinion
    – Zauz
    Commented Feb 15, 2018 at 18:26
  • 2. definitely keep track of spent addresses and never use them again (for security reasons) or do something like the current GUI Wallet: never use leading and empty addresses of a seed
    – Zauz
    Commented Feb 15, 2018 at 18:30

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.