Sending payments with CoinJoin

Adam Gibson edited this page Jul 28, 2017 · 15 revisions

You must read this ; at the very least, the bold parts, before starting, especially for new wallets.

sendpayment.py and patientsendpayment.py are bots which create CoinJoins to send payments to other addresses. They can send from the JoinMarket internal wallet or a Bitcoin Core wallet accessed with json-rpc.

A single coinjoin does not provide unlinkability from strong motivated attackers. For example if you bought bitcoins from an institution and don't want them to be able to see anything you do with your coins, you're better off using the tumbler script instead, which creates many coinjoins chained together.

The number of other parties in the CoinJoin can be configured with the -N command line flag. When sending from the JoinMarket wallet, the mixing depth to spend from is controlled by -m.

You can also choose which orders to pick. By default, sendpayment.py chooses orders randomly (weighted) which increases privacy. The other options are to pick the orders by cheapest (-C) or to pick manually (-P). Manual picking only works when not sweeping.

Use --help on the command line for a complete list of parameters.

Send Payment

python sendpayment.py wallet.json 500000 mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c

Sends 500000 satoshi (0.005btc) to the address mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c with the default two other parties from the default zeroth mixing depth from the wallet contained in the file wallet.json

python sendpayment.py -N 5 -m 1 wallet.json 500000 mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c

Sends the same amount as before from the first mixing depth, mixing with five other parties.

Setting the amount to zero will cause the bot to sweep. Meaning it will empty that mixing depth, calculating the coinjoin fee so that no coins are left.

python sendpayment.py -N 1 wallet.json 0 mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c

Wait Time Parameter

The -w or --wait-time parameter controls how much the bot will wait for orders to arrive. A longer wait time is useful if any liquidity providers are using a higher-latency network like Tor or I2P.

Patient Send Payment

###Note that this is in the as-yet unreleased version of JoinMarket

Very similar to sendpayment.py but will act as a market maker for a given amount of time. If another bot starts a coinjoin, patientsendpayment.py will put the desired address as the destination. After the time limit is up, the bot will cancel its order and start a coinjoin with other market makers.

To avoid address reuse, the bot can accept many addresses to send to. For example:

python patientsendpayment.py -w 4 wallet.json addr1 addr2 addr3 addr4 100000000

Which sends 1 bitcoin (100000000 satoshi) to those four addresses, if it runs out of addresses it will loop back to the start. It will wait for 4 hours as a market maker, and if not finished by then will become a taker and send a final coinjoin to the destination.

The bot also accepts BIP32 xpub keys instead of lists for addresses. It will start from the zeroth index unless an index is specified. For example:

python patientsendpayment.py -w 8 wallet.json xpubXXXXX:10 150000000

Which sends 1.5 bitcoin (150000000 satoshi) to the addresses from the given xpub key, starting from index 10. Note that patientsendpayment.py will print out the first few addresses so users can be sure they are correct. After 8 hours it will stop being a market maker and send the rest as a taker.

patientsendpayment.py can also have multiple send jobs. It will send an amount of bitcoin to one destination and when that's done it can start sending to another. For example:

python patientsendpayment.py -w 0 wallet.json addr1 addr2 addr3 addr4 100000000 xpubXXXXXX:10 150000000 xpubYYYYYY 200000000

Which will send 1 bitcoin to the four addresses listed. After that's done it will send 1.5 btc to the given xpub key starting from the 10th index. After that it will send 2 btc to the given xpub key starting from the zeroth index. It will wait forever as a market maker, never becoming a taker.

Sending from Bitcoin Core wallet

Requires the blockchain source to be Bitcoin Core with json-rpc. The bot will use RPC commands like listunspent, dumpprivkey and getrawchangeaddress to access the required information.

Use the --rpcwallet command line flag. The wallet file parameter becomes fromaccount as in the sendfrom RPC function.

python sendpayment.py --rpcwallet "" 1000000 mjeYBCV8ZNmx5fkDe5f9z4fnroV3FCXgBt

Sends 1000000 satoshi (0.01btc) to the address mjeYBCV8ZNmx5fkDe5f9z4fnroV3FCXgBt. It sends from the account "" in the Bitcoin Core wallet. You can modify the number of coinjoin participants with the -N flag. The -m flag is not used as Bitcoin Core wallet does not have the mixing depths concept.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.