Cryddit,
Is there a difference between a CoinJoin transaction and a regular bitcoin transaction that has many inputs and many outputs? What I mean is, for example, I have a large wallet with 10 different and unconnected unspent bitcoins, in 10 separate addresses. Then since I am the owner of that wallet, I can do a transaction and use those 10 as inputs to a transaction that pays out or sends out bitcoins to 20 different addresses.
What I'm wondering is if there is a fundamental difference between that, and a CoinJoin transaction with 9 other people.
In terms of the bytes that appear in the transaction itself, there is no difference.
The difference is all in what the snoops can infer from the bytes. When you make that transaction you described, the snoops would look at the block chain and say,
Oh, these twenty new addresses were all funded by the same transaction. Therefore all the funding came from the same source (because almost always it's a single source sending money). And since this doesn't look like a purchase (purchases typically have one large output and one much smaller "change" output) it must have been a logistical or bookkeeping movement of coins. So we're going to assume that now all twenty of these new addresses are owned by the same person.
Later on, they'll confirm it if, say, one of those 20 outputs gets spent, and you get a millibitcoin of change, and then later that millibitcoin of change gets spent in the same transaction as another of those 20 outputs, or as change from another of those 20 outputs - they go, Aha, look! This new evidence means that what we thought about the addresses being owned by the same person, is now confirmed! These two txOuts were owned by the same person, and now we can link all the purchases that were made with both of them!
Now consider what happens with a coinjoin. Alice is buying an Anvil, Bob is buying a Book. Carol is buying a Coat, Dave is buying a duck, and so on.... Maybe Zebulon is buying a Zebra, who knows. They do a coinjoin transaction, and there's an output to the blacksmith shop and an output to the bookstore, and an output to the clothier, and also outputs to Alice, Bob, Dave, Carol, and everybody else - and the outputs are all kinds of different sizes instead of just being clearly "payment" and "change."
Superficially, it looks like the same transaction. Some number of inputs, some number of outputs. But the snoops looking at it say, "Oh, all these inputs must have come from the same person, and it doesn't look like a regular purchase, so we'll assume all the outputs are going to the same person too...." except this time they're wrong. They'll pretty quickly figure out (because the way merchants combine the money that they get paid is very obvious) which outputs went to merchants and how much each merchant got. They may be able to backtrace a lot of the unconnected txIns to figure out who owned them before the transaction. But they will never figure out who it was that bought the duck, who it was that bought the book, and who it was that bought the zebra. The best they'll be able to say is, "one of these people whose coins went into the transaction."
And by the same token, even after they figure out which outputs were paid to merchants, they won't know which of those people now have the other outputs, until or unless those other people spend them along with txOuts they can link to that person. Again, best they'll be able to say is "one of these people whose coins went into the transaction."
But this requires that Alice, and Bob, and Carol, and Dave, etc have a way to set up the coinjoin that Eve can't figure out. Even if Eve is one of the people putting coins into the coinjoin and getting coins out, she shouldn't be getting information about what other people are putting in and getting out.