1

My mental model so you can put me on the right track:

  • A HD wallet is a mathematical tree construct from a seed key.
  • The idea being that new key pairs, and therefore Ethereum addresses, can be created for every new transaction, e.g. to receive money.
  • I can presumably have USDC sent to one of these extended addresses.
  • Presumably the USDC token updates its record of how much each address has and ends up with the extended address in its state of balances.
  • I can transfer this USDC so long as I send a transaction to the network calling the appropriate USDC contract function and having signed it with the corresponding extended private key of the address from which I am spending/deducting balance and that code in Circle's ERC-20 contract checks this.

Questions arise from this:

  • Does the HD wallet persist state about the tree structure it has created so far?
  • Does a wallet have to query every single ERC-20 contract on the blockchain and ask for its balance for a given address to give me a total of how much is "in" my wallet?
  • If I only have a backup of of the seed key, then how can it create the extended keys and addresses? How does it know if I created 1 or 1 million extended addresses?
  • How then does a wallet app arrive at a total without producing every conceivable extended address and asking every ERC-20 token for its balance?

There are two solutions:

  1. The wallet apps persist state that also must be backed up.
  2. I have totally misunderstood something which has led to this faulty thinking.

Thanks!!

Update

I added an answer from GPT-4 which was much more full and interesting than the pretty bad single word answers I got from the community.

Even though I explained that it was from GPT-4, the post was removed citing that AI answers are discouraged (words: "discouraged", actions: banned) citing that AI is not good for technical stuff, even though we all use it and code with it.

Why not just discuss or correct the answer? I expect it wasn't wrong. And who cares where a bunch of text comes from? Whether it came from my mind or the weights and biases of a system far more knowledgable than me, who cares?

This is an example of why AI will destroy all Stack sites.

The group of people with sticks that go around bashing everyone and everything on here destroyed these sites years ago but no one had another choice.

Now we all have a choice, no one is going to use these Stack sites and risk being beaten down by the guards.

StackOverflow is the online equivalent of the Stanford Prisoner experiment.

If you downvote this or try to remove it, YOU killed StackOverflow, just like the parking wardens killed the high street, not Amazon.

1 Answer 1

0

Does the HD wallet persist state about the tree structure it has created so far?

No

Does a wallet have to query every single ERC-20 contract on the blockchain and ask for its balance for a given address to give me a total of how much is "in" my wallet?

Yes

If I only have a backup of of the seed key, then how can it create the extended keys and addresses? How does it know if I created 1 or 1 million extended addresses?

It does not

How then does a wallet app arrive at a total without producing every conceivable extended address and asking every ERC-20 token for its balance?

Because wallets use server-sidecode to track balances of all ERC-20 balances or all addresses in the world.

5
  • Interesting. I wonder whether that means I can lose track of money if the wallet provider vanishes. Mar 28, 2023 at 13:39
  • No you cannot. You can import your wallet to another seed and manually click through all one million addresses you have generated. Mar 28, 2023 at 13:41
  • Waiting on more votes, fyi. I don't have the knowledge to vote it up. It's plausible but ever since GPT I distrust anything plausible ;-) Mar 28, 2023 at 16:39
  • You need to press green checkmark for the correct answer Mar 29, 2023 at 9:55
  • I was waiting for anyone, someone, to come along and vote it up as a good answer before I clicked the tick. Alas, no one has. Mar 31, 2023 at 20:26

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.