JoinMarket-Org / joinmarket

CoinJoin implementation with incentive structure to convince people to take part
398 stars 119 forks source link

DOS's against makers #58

Open chris-belcher opened 9 years ago

chris-belcher commented 9 years ago

DOS's against takers might be solved by issue https://github.com/chris-belcher/joinmarket/issues/57

DOS's against makers needs discussion.

Now the maker never commits to certain UTXOs belonging to the taker until the taker has actually broadcast them. So if two takers simultaneously fill the maker's offer, the maker might well send them both the same UTXO and only one transaction would actually succeed.

As long as the maker has enough bandwidth, I don't think there's any resource that a DOSer could consume.

chris-belcher commented 9 years ago

Actually one resource of the maker's that a DOSer could use up is position in the HD wallet. If a DOSer partially fills a maker's order it will cause the maker to get another address from it's wallet. Do this a couple of times and the next address pointer will go beyond the gap limit. Do a real coinjoin and coins will be moved beyond the gap limit.

Then when the operator of the maker queries the balance of the wallet, it will appear as if they lost coins. The worst this attack can do is scare the operator a little, they would check their logs and set their gap limit to the required number to reach their coins.

chris-belcher commented 9 years ago

An obvious solution is to store the HD key pointer in the wallet file. Restoring the wallet from seed may not find these keys but there could be an added message to try increasing the gap limit (or max mix depth) if the user believes coins have gone missing.

chris-belcher commented 9 years ago

wallet file now stores the index of the HD wallet https://github.com/chris-belcher/joinmarket/commit/b3dc7c7291a38183324175326dcf70eedadb3861 closing this dos opportunity

chris-belcher commented 9 years ago

Another obvious DOS method is that the taker can create transactions that take a long time, or never get mined into a block. For example by the change address having size 1 satoshi.

Makers could check for simple non-standard transactions but they'd also need a timeout for waiting for their UTXOs to confirm. Perhaps even a timeout related to how much in fees they're earning for that transaction.