JoinMarket-Org / joinmarket

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

Market makers use a p2sh address with some probability #84

Open chris-belcher opened 9 years ago

chris-belcher commented 9 years ago

It would provide some privacy for senders to p2sh. The actual form of p2sh could be a mixture of 2-of-2, 2-of-3 and perhaps other types. Passive observers of the blockchain don't know the private keys are all owned by the same entity.

I think 2-of-3 is the most common, although sites like http://p2sh.info/ don't show that specific statistic.

adlai commented 9 years ago

Two thoughts:

  1. A market maker running off RPC should pick address type according to popularity over the last N blocks.
  2. It's no longer sufficient to store a single index, or a single gap limit; there needs to be some way of knowing which address combinations to check for p2sh. One possibility is to use a separate BIP32 branch for each address type, for example (M representing an arbitrary mixdepth):
    • m/0/M/0/### - P2PKH, incoming
    • m/0/M/1/### - P2PKH, change
    • m/0/M/2/### - 2of2 P2SH, incoming
    • m/0/M/2/even - 1st pubkey
    • m/0/M/2/odd - 2nd pubkey
    • m/0/M/3/### - 2of2 P2SH, change
    • m/0/M/3/even - 1st pubkey
    • m/0/M/3/odd - 2nd pubkey
    • m/0/M/4/### - 2of3 P2SH, incoming
    • m/0/M/4/0mod3 - 1st pubkey
    • m/0/M/4/1mod3 - 2nd pubkey
    • m/0/M/4/2mod3 - 3rd pubkey
    • m/0/M/5/### - 2of3 P2SH, change
    • m/0/M/5/0mod3 - 1st pubkey
    • m/0/M/5/1mod3 - 2nd pubkey
    • m/0/M/5/2mod3 - 3rd pubkey
inaltoasinistra commented 8 years ago

This would increase the size of the tx. What about use p2sh only when this is requested by the taker? S/he could request (N-K) P2SH outputs and K P2PKH outputs

chris-belcher commented 8 years ago

CoinJoins in general make the transaction bigger, it might end up being something we simply accept. But your idea could also be a viable solution too, yes.

What happens when each of those makers wants to spend their p2sh coins under the taker-requests idea? Does it draw any more attention to the transaction.

inaltoasinistra commented 8 years ago

What happens when each of those makers wants to spend their p2sh coins under the taker-requests idea? Does it draw any more attention to the transaction.

I don't think that it is an issue when p2sh are used as inputs, this does not reveal anything of unknown.