Does receiving multiple times to the same address reduce the tx size when sending money from that address?
I assume not, because transactions refer to other txes rather than addresses. But maybe there are still opportunities to optimize something away?
No, it does not. On a technical level, addresses do not exist. What exists are transaction outputs. Receiving 100 times with 100 transaction outputs associated with the same address is no different from receiving 100 times with 100 transaction outputs all associated with 100 different addresses. When you spend those 100 outputs, the fee will be the same regardless of which addresses you used.
I want to add some definitions to this discussion as it was difficult for me to understand exactly what's talked about.
This is often the problem where very technical minded folks can't adjust their language to their audience. So here's some extra definitions
Output:
Output in a tx contains two fields: a value field for transferring satoshis, and a pubkey script for indicating conditions for those satoshis to be further spent.
https://bitcoin.org/en/developer-reference#compactsize-unsigned-integersSo the thing that I found it hard to get my head around, but now I understand, is that it doesn't matter if the coins are all at one address or multiple addresses. Because it's not relevant. Each tx you receive has a script that has certain criteria to spend the coins included in that tx. You need to satisfy the script for each tx to spend each coin. You can't just assume because all the coins are at one address they're the same. They're not.
Although...
That leads me to a thought.
Could you have all your coins sent to a single address, and then make a second transaction of all those coins once again to a single address? Would that reduce the UTXO set?
e.g,:
tx 0 > address 1
tx 1 > address 1
tx 2 > address 1
tx 3 > address 1
tx 4 > address 1
tx 5 > address 1
tx 6 > address 1
In this case UTXO set is 7. If I then did a transfer like this:
address 1 > tx 7 > address 1
Now UTXO set is 1
I believe it would work wouldn't it? It's a two step process but it would consolidate the UTXO set.