I'm wondering, if I sent some bitcoins from one of my own addresses to another address in my wallet, will it be possible for someone to figure out that both addresses are in the same wallet? Or can I claim the other address is not my own and no one can find out?
It is possible to tell that two addresses are in the same wallet if they both appear as an input of a transaction. This indicates that one person owns both of them as they can spend both of them.
It is also quite likely that when you are sending a transaction that has one neat input (say, 1BTC), and one not so neat (say, 0.59721364BTC), that the latter is most likely a change left over from a transaction you sent to someone and is being sent to another address you own from the same wallet. This claim could be possibly deniable, but should be true in most cases.
No, it is not possible to determine definitively if two addresses are in the same wallet. The protocol does not have the concept of the wallet. The wallet is a concept within the client.
That is to say, that the client presents the concept of a wallet as a collection of addresses. The only relation between addresses that the protocol knows about is senders and receivers, or, really, inputs and outputs.
It may be possible through a thorough analysis of taint to determine within a reasonable amount of certainty that several addresses are related to each other in a wallet.
There is no way to prove in the protocol that two address belong in the same wallet when you send from address A to address B in your wallet. Of course, if you are using some kind of online wallet they do know, but I'm assuming you are using a full one.
However, there can be clues that combined can be quite definitive.
1. Clues when you send the transaction
However, depending on the amount in address A, sending all funds to B with no change could be a clue that both belong to the same person. This is not a problem if you are sending a round amount like 1 BTC, but if you are sending 0.82421871 BTC and there is no change it is weird unless you are sending all your funds to donate or pay for something without a fixed price. It is the same if you send from A a round amount to another address and B gets a very weird amount.
2. Clues after the original transaction
- Spending from both addresses in the same transaction. This is no proof because there are ways to build a transaction with inputs from two wallets, but it is extremely rare.
- Sending funds between the two addresses frequently, specially if you do it both ways (from A to B and from B to A). This could happen with two parties that work a lot together, but it is a clue of some relation.
- Sending from both addresses at the same time, even if it is to different addresses (you send two transactions, one from A and another from B, that get to the same block long after you did the original one). It can be a coincidence, but it is one more signal.
3. IP address clue
This is extremely unlikely, but if you connect to a rogue node that records your IP address when you send from A to B and then you connect to that same rogue node (or another one acting in coordination) when you send from B to somewhere else, it would have the same IP address associated to both addresses. You could avoid this by using Tor or changing your IP address in some other way.
It depends. Bitcoin is traceable but pseudonymous.
So there would be a path from your first address to your second address. There's no way to prove that the second address is in your wallet at that point. But when you spend from that second address, any party that knows the second address is yours would know that the second address came from funds from the first address.
In other words, simply moving funds from one address to another address is not an effective measure for protecting your privacy regarding your financial transactions.
If you had the xpub you could see all the addresses derived from a particular seed, and as such determine if two addresses are linked in the manner you described. However it's extremely rare that any entity other than the actual wallet (in some cases) would be able to see this "extended public key" as it is very much a bit of private data.
Each address (corresponding to a public key) in your wallet has a corresponding private key. All private keys in the wallet are generated based on a single seed / passphrase. This why you are able to reconstitute your wallet on a new clean device. So a "wallet" is not strictly a client-side concept. Anyone with the phassphrase + pwd basically has access to all your private keys. Since nobody except the owners know about the passphrase there is no way for someone to mathematically prove that two addresses came out of the same wallet.
However, like others have mentioned, I/O and UTXO can provide some clues about the association between two addresses.