Detecting Wash Sales/Transactions I run a site which is essentially an e-commerce platform where buyers connect with sellers and all transactions happen in Bitcoin. I worry about sellers on the site continuously buying their own items on the site to gain visibility (more sales means higher ranking on the front page).

Is it possible to detect whether an incoming transaction originated from the same bitcoin wallet?

I am thinking that I could run a tree/graph traversal of transactions starting at a given payment address and see if I end up at that same address again. But I'm not sure how this would work with wallets where each payment generates a new address from a master public/private key pair. As far as I know, it's not possible to tell whether two addresses originated from the same MPK.

PS: Maybe wash sale is not the correct term here.
It is not possible to determine if multiple addresses belong to one wallet, whether it is a deterministic wallet or not.

At best, you can do some form of chain analysis that traces UTXOs back along the chain until you find a common root. For most transactions in a single wallet, there will usually be a convergence point of the coins. However, this is not an exact science, and the results may not be of a high enough confidence to be certain it is happening.

Similarly, you can trace the future spending of the outputs created to see if they converge into a single address. If so, it may indicate the same person was selling/buying items.