2

I'm trying to build a small C# client and use the C#-Api on Github. My problem is: With one seed I can generate millions of adresses. How do I find all addresses with balance when I type in my seed?

It seems to be like this:

  1. type in seed
  2. generate n addresses with starting index x
  3. with every address ask for getbalances But: generating one new address takes 0.5 to 1.0sec

Is there another way? Maybe something like:

  • get all addresses with balance.
  • for every address I can check really fast that it belongs to my seed?
3

You don't need to generate million of addresses at least if your seed was use properly.

Normally, a wallet should use addresses one after the other by just incrementing by one the index of the previous address. It means that a transaction from address at index n exists if and only if a transaction at address n-1 exists.

So, what you should do is searching for a transaction at first address index, and if it exists, search for a transaction at next index, and you continue until you don't find a transaction at address with index X.

This strategy works fine, with 2 important restrictions :

  1. seed should have been used properly, i.e. using index incrementally.
  2. if a snapshot occurs, be sure to perform your search on a permanode (or keep locally the index of the last used index)
  • thank you. So this means, if I use a new seed and start generating new addresses with index 10 or 1000, and I type in that seed in another wallet, this other wallet probably will not find the addresses with balance? So it would be more secure against an attacker who tries out seeds and try to find a balance? – FrankToast Feb 10 '18 at 16:14
  • No (for 2nd part of your comment). The probability that an attacker guess your seed (if it was really random) is so low that it don't make any difference. – ben75 Feb 10 '18 at 22:23

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.