Skip to content
83 changes: 83 additions & 0 deletions coinjoins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Coinjoins & Privacy UX Primer

- Bitcoin is not anonymous.
- Consider each address you generate as a new identity.
- Coin has history
- Histories can link addresses into clusters
- Public ledger
- Anyone can lookup
- New users may not be aware

## Address Reuse

Use a [hierarchical deterministic wallet](https://en.bitcoin.it/wiki/Deterministic_wallet) in order to avoid reusing an identity.

Practicality

- How do you adverise an address to be paid in a video?
- Handling gap limit, online and during recovery

## Wallet Fingerprinting

The way the transaction is constructed can give chain analysts an idea of which wallet was used.

1. Change is sometimes the last output
1. Solutions
1. [Lexicographical Ordering (BIP 0069)](https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki) (see also [arguments against, search for bip 69 in transcript](https://diyhpl.us/wiki/transcripts/london-bitcoin-devs/2020-05-05-socratic-seminar-payjoins/))
2. Random Ordering - is there a standard? verifiable? deniable?
2. If the `nLockTime` in the transaction or `nSequence` of the inputs are set
- locktime type (absolute/`nLockTime`, [relative/`nSequence` (BIP 68)](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki), and their [interactions](https://b10c.me/mempool-observations/1-locktime-stairs/))
- locktime value type (blockheight, [MTP (BIP 113)](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki))
- [RBF opt in (BIP 125)](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki)

## Routing Transaction

- Should use Tor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

joinmarket, electrum personal server and wasabi support broadcasting by connecting to a random node over tor.

there are also well known broadcast services, such as blockstream.

more details on the section on tor broadcasting on the bitcoin wiki Privacy page

note that broadcasting with bitcoin core is potentially problematic for privacy, especially before the recent rebroadcast improvements.

- Research Dandelion
- If an attacker has enough nodes in the network it can determine the location of where the transaction was broadcasted.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebroadcast attacks also interact with dust attacks here, by dusting old addresses spy nodes that aggressively connect can increase likelyhood of broadcast being linkable via network level information.

Cc @amitiuttarwar - see twitter search for talks, PR reviews on rebroadcast work

and also block lists (e.g. AWS IP ranges etc), a number have circulated


## Methods

### Coinswap

Privacy through a swap for another users coin history.

### Coinjoins

Privacy by combining of coin history.

#### Censoring

- Some exchanges may not accept deposits from coinjoins
- Adding hops — *see Samourai Wallet's Ricochet*

#### Components

##### Rounds

- Role of the coordinatior

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JoinMarket doesn't have a coordinator (technically the taker does the same job as the coordinator, i.e. putting together a transaction, but the privacy model is different)

perhaps a better typology is centralized coinjoins, using blind signatures like Samourai and wasabi, and peer to peer as in JoinMarket. I'm not aware of other implementations being in use.


##### Coin Selection

- Post-mix wallet MUST prevent joining inputs together. [cite_1]

---

#### Techniques

Types of coinjoin techniques...

##### Equal Output Coinjoin

- All parties mix the same output denominations

##### PayJoin

A type of coinjoin which involves two parties adding their inputs, and outputs on the same transaction so the direction of payment cannot be determined.

- is not obviously visible as an equal-output [CoinJoin](https://en.bitcoin.it/wiki/CoinJoin)

> If [PayJoin transactions](https://en.bitcoin.it/wiki/PayJoin) became even moderately used then it would make the [common-input-ownership heuristic](https://en.bitcoin.it/wiki/Common-input-ownership_heuristic) be completely flawed in practice. As they are undetectable we wouldn't even know whether they are being used today. As [Transaction surveillance companies](https://en.bitcoin.it/wiki/Transaction_surveillance_company) mostly depend on that heuristic, as of 2019 there is great excitement about the PayJoin idea.

[1]: https://github.com/nopara73/ZeroLink#i-introduction
[2]: https://zmnscpxj.github.io/bitcoin/coinjoinxt.html
92 changes: 92 additions & 0 deletions coinjoins/process.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Coinjoin Process

## Events

### Start

1. Connect to the coordinator
2. See how many rounds are active

### Check Active Rounds

- Fee Rate
- List of Preferred Denominations

Rounds have a fee rate
Maximum input number

### Request Registration

Every registration request needs you to present credentials.

- Request 0 credentials
- 0 credentials have no value

### Input Registration

- Show coordinator the inputs (outputs )
- Prove you can spend it (sign round params)
- Show crednetials (0 credntials at first)
- Difference = Sum(10000 * )

### Connection Confriamtion

- Keep telling the server that you're interested in the round — so others don't rely on your inputs if you are not available.
- How often must this be done?

### Output Registration Phase

- Everyone needs to query the status once more
- They learn all of the input signatures
- They want to know that everyone is seeing the same key for the server
- They wanna make sure everyones inputs is legit
- Everyone gets the signatures and verify them
- Then register outputs
- Same like registering inputs except it is negative
- Credentials as change
- Prove output amount is the same as the presented and requested credentials
- Everyone runs out of credentials
- All of the outputs are registered

### Transaction Signing

1. Now the round proceeds to transaction signing
2. They check for their own outputs, and sign for everyone of their inputs

### Broadcast

1. Coordinator broadcasts transactions with all signatures

---



## Challenges

### Time-staggered batched coinjoin payments

- what is the problem
- what is the proposed flow
- what is the goals

### Handling Change

Change after a mix poses a problem as it can be tracked — so how do you dispose of very small outputs?

#### WabiSabi

- Dispose them through the coordinator — so someone doesnt know what charitiy. `wabisabi`

- - Change can be tracked

- Fee Credentials

- Prepaid Fees

- Opt in to donations using change


### Coin Selection

- Wallet is able to select intelegently for you in cost effeicent ways but pershaps not in private ways because it does not understand the meaning of the labels.
- High anonimity coins can be auto-selected.