Imagine that my privacy conscious wallet always creates a new child address to receive tokens. And imagine I was sent 2 USDC from Alice and 2 USDC from Bob.
My mental model is that the USDC token contract has a mapping of these two balances, but does not (and cannot) know they both relate to a single wallet and come from the same seed.
When I come to send 4 USDC to Carol, how many transactions are needed, what functions are called, and what address (or array of bytes) is used to sign the transactions?
The msg.sender
is derived from the transaction signer, so I assume common wallet apps check the distribution of funds and create n transactions each signed by the private keys of the child addresses until the total is fully composed.
If this is the case (many transactions), if I've received many tiny payments into many new addresses, then emptying (or consolidating) my balance would required a lot of gas, no?